Issue #21927 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED, 4.0: DONE to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE, 4.0: DONE Backported into ruby_3_4 with https://github.com/ruby/ruby/pull/16324. ---------------------------------------- Bug #21927: Prism: misleading error message for forwarding in lambda argument https://bugs.ruby-lang.org/issues/21927#change-117486 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Assignee: prism * ruby -v: d256629bf9 * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE, 4.0: DONE ---------------------------------------- Even in a forwarding method: ```console $ ruby --parser=prism -e 'def m(...) ->(...){}; end' -e: -e:1: syntax error found (SyntaxError)
1 | def m(...) ->(...){}; end | ^~~ unexpected ... when the parent method is not forwarding
This message is proper for method arguments:
```console
$ ruby --parser=prism -e 'def m() p(...); end'
-e: -e:1: syntax error found (SyntaxError)
> 1 | def m() p(...); end
| ^~~ unexpected ... when the parent method is not forwarding
The message from parse.y is different; "unexpected ... in lambda argument": ```console $ ruby --parser=parse.y -e 'def m(...) ->(...){}; end' -e:1: unexpected ... in lambda argument def m(...) ->(...){}; end ruby: compile error (SyntaxError) ``` -- https://bugs.ruby-lang.org/