From: whitequark@... Date: 2016-01-14T12:45:58+00:00 Subject: [ruby-core:72855] [Ruby trunk - Bug #11989] [Open] Dedenting interpolating heredoc can interpret escapes incorrectly Issue #11989 has been reported by whitequark *. ---------------------------------------- Bug #11989: Dedenting interpolating heredoc can interpret escapes incorrectly https://bugs.ruby-lang.org/issues/11989 * Author: whitequark * * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- 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 ~~~ It prints `" 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 ~~~ It prints `"x\n y\n"`. So `"\n"` is counted as whitespace, like an actual newline would be. I think it should print `"x\n y\n"`. -- https://bugs.ruby-lang.org/ Unsubscribe: