Actions
Bug #20764
closedForwarding parameter `...` is wrongly allowed in lambda
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-09-27T00:58:32Z master 0c25eb4ffe) +PRISM [x86_64-linux]
Description
These codes are all syntax error
->...{}
->(...){}
->(a,...){}
But these are allowed in --parser=parse.y. It should be syntax error
->a,...{}
->(a=1,...){}
# ruby --parser=parse.y -e "p ->a,...{}.parameters"
[[:opt, :b], [:rest, :*], [:keyrest, :**], [:block, :&]]
# ruby --parser=parse.y -e "p ->(a=1,...){}.parameters"
[[:opt, :b], [:rest, :*], [:keyrest, :**], [:block, :&]]
# ruby --parser=parse.y -e "p ->(a,...){}.parameters"
-e:1: syntax error, unexpected ...
p ->(a,...){}.parameters
ruby: compile error (SyntaxError)
Updated by nobu (Nobuyoshi Nakada) 3 months ago
- Status changed from Open to Closed
Applied in changeset git|86ae409467e3674c142f012ee3b2288b0305d87c.
[Bug #20764] Refactor argument forwarding in lambda
Reject argument forwarding in lambda:
- without parentheses
- after optional argument(s)
Actions
Like0
Like0