Project

General

Profile

Actions

Bug #20764

closed

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

Added by tompng (tomoya ishida) 3 months ago. Updated 3 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 #1

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

Also available in: Atom PDF

Like0
Like0