diff --git a/parse.y b/parse.y index 21be51cb74..8dcc25bfea 100644 --- a/parse.y +++ b/parse.y @@ -6134,12 +6134,14 @@ heredoc_dedent(struct parser_params *p, NODE *root) return 0; } else { + NODE *end = node->nd_end; node = prev_node->nd_next = node->nd_next; if (!node) { if (nd_type(prev_node) == NODE_DSTR) nd_set_type(prev_node, NODE_STR); break; } + node->nd_end = end; goto next_str; } diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 28f563046f..bd9c996138 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -759,6 +759,10 @@ eom assert_syntax_error('<<~ "#{}"', /unexpected <