[ruby/prism] Fix parser translator heredoc dedention with leading interpolation

```rb
<<~F
  foo
#{}
  bar
F
```

has zero common whitespace.

https://github.com/ruby/prism/commit/1f3c222a06
This commit is contained in:
Earlopain 2025-01-13 16:31:41 +01:00 committed by git
parent eab1f02149
commit 0a26a3de89
2 changed files with 5 additions and 1 deletions

View File

@ -569,6 +569,11 @@ module Prism
# String content inside nested heredocs and interpolation is ignored
if next_token.type == :HEREDOC_START || next_token.type == :EMBEXPR_BEGIN
# When interpolation is the first token of a line there is no string
# content to check against. There will be no common whitespace.
if nesting_level == 0 && next_token.location.start_column == 0
result = 0
end
nesting_level += 1
elsif next_token.type == :HEREDOC_END || next_token.type == :EMBEXPR_END
nesting_level -= 1

View File

@ -98,7 +98,6 @@ module Prism
"heredocs_with_ignored_newlines.txt",
"methods.txt",
"strings.txt",
"tilde_heredocs.txt",
"seattlerb/backticks_interpolation_line.txt",
"seattlerb/bug169.txt",
"seattlerb/case_in.txt",