From: "tompng (tomoya ishida) via ruby-core" Date: 2025-01-07T14:44:12+00:00 Subject: [ruby-core:120524] [Ruby master Bug#21010] Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism Issue #21010 has been reported by tompng (tomoya ishida). ---------------------------------------- Bug #21010: Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism https://bugs.ruby-lang.org/issues/21010 * Author: tompng (tomoya ishida) * Status: Open * ruby -v: ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) +PRISM [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- These codes is SyntaxError in parse.y but accepted in Prism ~~~ruby def []=(k,v)=1 def obj.[]=(k,v)=1 ~~~ These are both SyntaxError in parse.y and Prism by design. ~~~ruby # invalid method name; a setter method cannot be defined in an endless method definition def f=(k,v)=1 def obj.f=(k,v)=1 ~~~ I think endless method definition of `[]=` should be also rejected. -- 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/