Project

General

Profile

Actions

Bug #21927

closed

Prism: misleading error message for forwarding in lambda argument

Bug #21927: Prism: misleading error message for forwarding in lambda argument

Added by nobu (Nobuyoshi Nakada) about 14 hours ago. Updated about 4 hours ago.

Status:
Closed
Assignee:
Target version:
-
[ruby-core:124888]

Description

Even in a forwarding method:

$ 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:

$ 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":

$ ruby --parser=parse.y -e 'def m(...) ->(...){}; end'
-e:1: unexpected ... in lambda argument
def m(...) ->(...){}; end
ruby: compile error (SyntaxError)

Updated by Earlopain (Earlopain _) about 4 hours ago Actions #2

  • Status changed from Open to Closed

Applied in changeset git|6af0de237935f162ee3089b314f0c33911d442da.


[ruby/prism] Fix error message for block/lambda with ... argument

They currently complain that the parent method is not forwarding.
But the actual problem is that these types of arguments simply don't
accept ...

Fixes [Bug #21927]

https://github.com/ruby/prism/commit/0aa2363331

Actions

Also available in: PDF Atom