Project

General

Profile

Actions

Bug #14584

closed

Squigly heredoc with interpolation that has a string literal withe spaces gets incorrect value

Added by asterite (Ary Borenszweig) almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
[ruby-core:85983]

Description

Given this program:

text1 = <<~FOO
  one#{"   two   "}
  FOO

text2 = <<~FOO
one#{"   two   "}
FOO

p text1
p text2

The output is:

"one two   \n"
"one   two   \n"

The two should be equal.

I think the problem happens because squigly heredoc will remove the first two spaces from each line in the heredoc, but it seems to also be removing it from literals inside interpolation inside a heredoc.


Related issues

Related to Ruby master - Bug #11989: Dedenting interpolating heredoc can interpret escapes incorrectlyClosedActions
Actions

Also available in: Atom PDF