Project

General

Profile

« Previous | Next » 

Revision 2591b935

Added by Stan Lo 4 days ago

[ruby/prism] Fix crash when using arithmetic expressions in pattern matching

When arithmetic expressions like -1**2 are used in pattern matching contexts,
Ruby crashes with "Unexpected node type in pattern matching expression: PM_CALL_NODE".
This happens because the Prism parser creates PM_CALL_NODE for arithmetic operations,
but Ruby's pattern matching compiler doesn't handle call nodes.

This fix adds validation to reject PM_CALL_NODE in pattern contexts with a proper
syntax error.

https://github.com/ruby/prism/commit/365049a767