Issue #22140 has been updated by Earlopain (Earlopain _). Status changed from Open to Closed Fixed in https://github.com/ruby/ruby/commit/0f5e45d8cfab0f2eb5a2e85438d52ad31b5ee674 ---------------------------------------- Bug #22140: Prism rejects a trailing comma in a pattern-matching loop condition before do, while parse.y accepts it https://bugs.ruby-lang.org/issues/22140#change-118135 * Author: Kai (kai matsudate) * Status: Closed * Assignee: prism * ruby -v: ruby 4.1.0dev (2026-07-02T00:24:43Z master e91f477e21) +PRISM [arm64-darwin25] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Prism rejects the following code, while parse.y accepts it: Prism: ```sh $ 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:
```sh
$ ruby --parser=parse.y -ce 'while a in b, do end'
Syntax OK
The same appears with `until` and `for` loops. I have a draft patch here: https://github.com/ruby/prism/pull/4154 -- https://bugs.ruby-lang.org/