[ruby-core:123632] [Ruby Bug#21661] Endless method definition as a default value of block parameter is wrongly accepted in Prism

From: "tompng (tomoya ishida) via ruby-core" <ruby-core@...>
Date: 2025-11-01 07:28:55 UTC
List: ruby-core #123632
Issue #21661 has been reported by tompng (tomoya ishida).

----------------------------------------
Bug #21661: Endless method definition as a default value of block parameter is wrongly accepted in Prism
https://bugs.ruby-lang.org/issues/21661

* Author: tompng (tomoya ishida)
* Status: Open
* Assignee: prism
* ruby -v: ruby 3.5.0dev (2025-11-01T00:18:01Z master 17a7b4e031) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
These are syntax error in parse.y but not in Prism.
~~~ruby
p do |a = def f = 1; b| end
p do |a = def f = 1| 2; b|c end # `|` inside block parameter
~~~
Normal assignment as a default value `p do |a = b = 1| end` is already syntax error. 





-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

In This Thread

Prev Next