Skip to content

a => [-2**b] should be SyntaxError but parse succeeds #3381

Open
@tompng

Description

@tompng

Parsing a in [-2**b] succeeds and executing it crash with this error

$ ruby -e "a in [-2**b]"
-e: [BUG] Unexpected node type in pattern matching expression: PM_CALL_NODE
ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) +PRISM [x86_64-linux]

Found this code failed to RubyVM::InstructionSequence.compile while compiling every ruby code fragments in ruby repository

# spec/ruby/core/marshal/fixtures/marshal_data.rb:328
"Integer -2**8" => [-2**8,
                       "\004\bi\377\000"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions