summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2021-07-20 13:53:22 -0400
committerAaron Patterson <aaron.patterson@gmail.com>2021-07-21 10:06:33 -0700
commitb940a453572b5c3ed5c0951647929e14f5843a7d (patch)
tree41d75724ad08b32809de0f7723b31d34f7d13cd6 /parse.y
parentfa308a683d507996ee68352753bbb1813dceff31 (diff)
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 <tenderlove@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4664
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y5
1 files changed, 4 insertions, 1 deletions
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;
}
}