Dedenting interpolating heredoc can interpret escapes incorrectly
It is clear that the dedenting <<~HEREDOC feature was intended to only consider actual whitespace in the source file as indentation, not any escaped whitespace. E.g.:
p <<~"E" \ x y E
" x\n y\n". So
"\ " does not count as whitespace. There is even an MRI test for this.
However, this case is handled differently:
p <<~"E" x\n y E
"x\n y\n". So
"\n" is counted as whitespace, like an actual newline would be. I think it should print
Updated by nobu (Nobuyoshi Nakada) over 4 years ago
- Status changed from Open to Closed
Applied in changeset r53573.
parse.y: escaped newline in dedenting heredoc
- parse.y (parser_here_document): an escaped newline is not an actual newline, and the rest part should not be dedented. [ruby-core:72855] [Bug #11989]