Actions
Bug #21711
openPrism and parse.y parses private endless method definition with block differently
Bug #21711:
Prism and parse.y parses private endless method definition with block differently
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0dev (2025-11-26T06:41:42Z master 43ed35de6c) +YJIT +MN +PRISM [arm64-darwin24]
Description
In the following code, do end block is passed to private in Prism but passed to tap in parse.y
private def f = tap do end
f # different result(prism: LocalJumpError, parsey: returns main)
According to https://bugs.ruby-lang.org/issues/17398#note-10,
private def hello = puts "Hello" do expr end should be parsed as private (def hello = puts "Hello") do expr end.
This is correctly implemented in both Prism and parse.y, but when rhs is tap do end, there is a discrepancy.
Another example. Prism: parse success, parse.y: syntax error.
private def f = 1 do end
No data to display
Actions