Issue #19025 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1:
REQUIRED, 3.2: DONE
ruby_3_2 465eb7418d7ed91f5f0c75da77765c7f5ef8354f merged revision(s)
91c004885fc75a93cadf0094fa86ec3bd0ec25f5.
----------------------------------------
Bug #19025: Ripper cannot parse syntax ok code that has numbered parameters
https://bugs.ruby-lang.org/issues/19025#change-103944
* Author: tompng (tomoya ishida)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 3.2.0dev (2022-09-22T02:42:57Z :detached: 830b2e217b) [x86_64-linux]
* Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE
----------------------------------------
Ruby says `p { a = 0; [_1, _1 **2] }` is syntax ok, Ripper says syntax error
~~~ruby
code = 'p { a = 0; [_1, _1 **2] }'
eval(code) #=> nil (Syntax OK)
Ripper.sexp(code) #=> nil (Syntax Error)
~~~
Other similar codes. maybe not a bug
~~~ruby
p { a = 0; [a **2] } # Syntax OK
p { a = 0; [_1 **2] } # Syntax Error
p { a = 0; [a, _1 **2] } # Syntax Error
p { a = 0; [_1, _1 **2] } # Syntax OK, Ripper.sexp says Syntax Error
~~~
--
https://bugs.ruby-lang.org/