When a variable is captured anywhere in a pattern, the operands of each alternation are visited to report captures inside them. That visitor treated every local variable target as a capture, including underscore-prefixed names and target...yuki300 (y h)
A follow-up on "every form I tried gives the same answer": while writing more tests I found a few forms where it's Prism that gets it wrong, the other way around. With a sibling capture present, Prism also rejects `in [x, 1 | _a]`, `in [...yuki300 (y h)
Thanks, that matches what I was seeing. I got curious about *which* change actually started rejecting these, so I built the two commits around https://github.com/ruby/ruby/pull/15329 and ran the `ng.rb` from the description through `-...yuki300 (y h)
`p_kwrest` is the only binding rule in patterns that does not go through `error_duplicate_pattern_variable`. `p_variable`, `p_rest` and the `{a:}` shorthand in `p_kw` all call it before `assignable`; for `**rest` the name is handed st...yuki300 (y h)
`parse.y` rejects patterns in which a variable binding appears *before* an alternative pattern, even when the alternative itself binds nothing. Prism accepts the same code. Is this intended? ## Reproduction ```ruby # ok.rb case...yuki300 (y h)