Actions
Bug #22140
openPrism rejects a trailing comma in a pattern-matching loop condition before do, while parse.y accepts it
Bug #22140:
Prism rejects a trailing comma in a pattern-matching loop condition before do, while parse.y accepts it
ruby -v:
ruby 4.1.0dev (2026-07-02T00:24:43Z master e91f477e21) +PRISM [arm64-darwin25]
Description
Prism rejects the following code, while parse.y accepts it:
Prism:
$ ruby --parser=prism -ce 'while a in b, do end'
ruby: -e:1: syntax error found (SyntaxError)
> 1 | while a in b, do end
| ^~ expected a pattern expression after `,`
parse.y:
The same appears with until and for loops.
I have a draft patch here: https://github.com/ruby/prism/pull/4154
Updated by Earlopain (Earlopain _) 3 days ago
- Assignee set to prism
Actions