Actions
Bug #20033
closed`/#{''}(?<lvar>)/ =~ s` looks like a dynamic regexp match but assigns to local variable
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-11-30T16:23:25Z master d048bae96b) [x86_64-linux]
Description
I expect all of these code not to assign to lvar because all regexp looks like embedded dynamic regexp.
/#{''}(?<lvar>)/ =~ '' # assings to lvar
/#{"#{''}"}(?<lvar>)/ =~ '' # does not assign to lvar
/#{<<A}(?<lvar>)/ =~ '' # assigns to lvar
string
A
/#{<<A}(?<lvar>)/ =~ '' # does not assign to lvar
#{'string'}
A
I think /#{'a'}/
can be a DREGX because for string, "#{'a'}#{'b'}"
is DSTR (DSTR@1:0-1:14 "ab" nil nil)
.
Actions
Like0
Like0Like0Like0