Project

General

Profile

Actions

Misc #20503

closed

Dedenting heredoc line continuation

Added by kddnewton (Kevin Newton) 5 months ago. Updated 5 months ago.

Status:
Closed
Assignee:
-
[ruby-core:117984]

Description

When there is a line continuation inside a dedenting heredoc, occasionally it will impact the dedent calculation in interesting ways. I'm not sure if it's a bug, or if my understanding is incorrect.

<<~eos
  TEXT
eos

In this case the string is `"TEXT\n", because the common whitespace is 2 and it's removed from the only line. However if there is a line continuation:

<<~eos
  \
TEXT
eos

then the results is " TEXT\n". To me this seems incorrect, because the second line is supposed to be considered as part of the first, which would mean it should have the same result as the first one.

So either my understanding is incorrect or this is a bug. Could someone clarify? Thanks!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0