Project

General

Profile

Actions

Bug #21711

open

Prism 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

Added by tompng (tomoya ishida) about 10 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0dev (2025-11-26T06:41:42Z master 43ed35de6c) +YJIT +MN +PRISM [arm64-darwin24]
[ruby-core:123913]

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

Also available in: PDF Atom