From b940a453572b5c3ed5c0951647929e14f5843a7d Mon Sep 17 00:00:00 2001 From: eileencodes Date: Tue, 20 Jul 2021 13:53:22 -0400 Subject: Fix interpolated heredoc This fixes https://bugs.ruby-lang.org/issues/18038. The provided reproduction showed that this happens in heredocs with double interpolation. In this case `DSTR` was getting returned but needs to be convered to a `EVSTR` which is what is returned by the function. There may be an additional bug here that we weren't able to produce. It seems odd that `STR` returns `DSTR` while everything else should return `EVSTR` since the function is `new_evstr`. [Bug #18038][ruby-core:104597] Co-authored-by: Aaron Patterson --- parse.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 0bea812670..4c4cbcf633 100644 --- a/parse.y +++ b/parse.y @@ -10181,7 +10181,10 @@ new_evstr(struct parser_params *p, NODE *node, const YYLTYPE *loc) switch (nd_type(node)) { case NODE_STR: nd_set_type(node, NODE_DSTR); - case NODE_DSTR: case NODE_EVSTR: + return node; + case NODE_DSTR: + break; + case NODE_EVSTR: return node; } } -- cgit v1.2.3