Project

General

Profile

Actions

Bug #21168

open

Prism doesn't require argument parentheses (in some cases) when a block is present but parse.y does

Added by Earlopain (Earlopain _) 2 days ago. Updated 2 days ago.

Status:
Open
Assignee:
Target version:
-
ruby -v:
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [x86_64-linux]
[ruby-core:121234]

Description

It's a bit more than that but explaining it in full would be a bit much. Instead, see this:

foo(
  bar baz do
  end
)
$ ruby -c --parser=prism test.rb
Syntax OK
$ ruby -c --parser=parse.y test.rb
ruby: test.rb:2: syntax error, unexpected 'do' for block, expecting ')' (SyntaxError)
  bar baz do
          ^~

OTOH, this is consistently rejected:

[
  foo bar do
  end,
]
# And also
foo || bar baz do
end
Actions

Also available in: Atom PDF

Like0
Like0