Commit 365049a
committed
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.1 parent 09d9ac3 commit 365049a
2 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17393 | 17393 | | |
17394 | 17394 | | |
17395 | 17395 | | |
| 17396 | + | |
| 17397 | + | |
| 17398 | + | |
| 17399 | + | |
| 17400 | + | |
| 17401 | + | |
| 17402 | + | |
| 17403 | + | |
17396 | 17404 | | |
17397 | 17405 | | |
17398 | 17406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments