Commit 0fa8d8f
Reject modifier conditionals in
Prism accepted a modifier conditional as the predicate of an `if`/`unless`
(and `elsif`), while parse.y rejects it:
if a if b then end # parse.y: SyntaxError, prism: accepted
unless a unless b then end
The `if`/`unless`/`elsif` predicate was parsed with a floor of
`PM_BINDING_POWER_MODIFIER`, which is inclusive of the modifier
conditionals (`if`/`unless`/`while`/`until`, left binding power
`PM_BINDING_POWER_MODIFIER`), so they were absorbed into the predicate.
`while`/`until` predicates already use `PM_BINDING_POWER_COMPOSITION` and
reject these correctly.
Raise the floor to `PM_BINDING_POWER_MODIFIER + 1` so the predicate still
absorbs `and`/`or` (and tighter operators) but excludes the modifier
conditionals, matching parse.y and aligning `if`/`unless` with
`while`/`until`.if/unless predicates1 parent d290a34 commit 0fa8d8f
2 files changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15486 | 15486 | | |
15487 | 15487 | | |
15488 | 15488 | | |
15489 | | - | |
| 15489 | + | |
15490 | 15490 | | |
15491 | 15491 | | |
15492 | 15492 | | |
| |||
15524 | 15524 | | |
15525 | 15525 | | |
15526 | 15526 | | |
15527 | | - | |
| 15527 | + | |
15528 | 15528 | | |
15529 | 15529 | | |
15530 | 15530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments