Skip to content

Commit

Permalink
[PRISM] Treat it as a local when compiling patterns
Browse files Browse the repository at this point in the history
Fixes [Bug #20973]
  • Loading branch information
eightbitraptor committed Dec 20, 2024
1 parent 2f6c694 commit f98986c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,7 @@ pm_compile_pattern(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_node_t
case PM_GLOBAL_VARIABLE_READ_NODE:
case PM_IMAGINARY_NODE:
case PM_INSTANCE_VARIABLE_READ_NODE:
case PM_IT_LOCAL_VARIABLE_READ_NODE:
case PM_INTEGER_NODE:
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
case PM_INTERPOLATED_STRING_NODE:
Expand Down
1 change: 1 addition & 0 deletions test/ruby/test_compile_prism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2526,6 +2526,7 @@ def test_PinnedVariableNode
assert_prism_eval("module Prism; @prism = 1; 1 in ^@prism; end")
assert_prism_eval("$prism = 1; 1 in ^$prism")
assert_prism_eval("prism = 1; 1 in ^prism")
assert_prism_eval("[1].each { 1 => ^it }")
end

############################################################################
Expand Down

0 comments on commit f98986c

Please sign in to comment.