Project

General

Profile

Actions

Bug #20764

closed

Forwarding parameter `...` is wrongly allowed in lambda

Added by tompng (tomoya ishida) about 2 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-09-27T00:58:32Z master 0c25eb4ffe) +PRISM [x86_64-linux]
[ruby-core:119328]

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)
Actions

Also available in: Atom PDF

Like0
Like0