Project

General

Profile

Actions

Bug #20973

closed

`it` in pattern matching pin operator causes BUG

Added by ktsj (Kazuki Tsujimoto) 2 days ago. Updated 2 days ago.

Status:
Closed
Target version:
ruby -v:
ruby 3.4.0dev (2024-12-20T00:48:01Z master 978df259ca) +PRISM [x86_64-linux]
[ruby-core:120342]

Description

$ ./miniruby --parser=prism -e 'tap { 0 => ^it }'
-e: [BUG] Unexpected node type in pattern matching expression: PM_IT_LOCAL_VARIABLE_READ_NODE
ruby 3.4.0dev (2024-12-20T00:48:01Z master 978df259ca) +PRISM [x86_64-linux]

With parse.y, it passes.

$ ./miniruby --parser=parse.y -e 'tap { 0 => ^it }'
-e:1:in 'block in <main>': 0: main === 0 does not return true (NoMatchingPatternError)
        from <internal:kernel>:91:in 'Kernel#tap'
        from -e:1:in '<main>'
Actions #1

Updated by eightbitraptor (Matt V-H) 2 days ago

  • Status changed from Assigned to Closed

Applied in changeset git|e8d393c8ae0c6282262b7a7886947379a9fd81a3.


[PRISM] Treat it as a local when compiling patterns

Fixes [Bug #20973]

Actions

Also available in: Atom PDF

Like0
Like0