[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/

Issue #21010 has been updated by eileencodes (Eileen Uchitelle). Assignee set to prism ---------------------------------------- Bug #21010: Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism https://bugs.ruby-lang.org/issues/21010#change-111333 * Author: tompng (tomoya ishida) * Status: Open * Assignee: prism * 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/

Issue #21010 has been updated by eileencodes (Eileen Uchitelle). Fixed in https://github.com/ruby/prism/pull/3377 ---------------------------------------- Bug #21010: Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism https://bugs.ruby-lang.org/issues/21010#change-111335 * Author: tompng (tomoya ishida) * Status: Open * Assignee: prism * 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/

Issue #21010 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ruby_3_4 commit:82f7cb794109794f6ffa95ffb3be8e5149dd74bd merged revision(s) commit:ad96c5a72908042489357b73dc936c4bc38d919b, commit:ca81142eff98cccb03ff523322aefe4e7346fd0e. ---------------------------------------- Bug #21010: Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism https://bugs.ruby-lang.org/issues/21010#change-111915 * Author: tompng (tomoya ishida) * Status: Closed * Assignee: prism * ruby -v: ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) +PRISM [x86_64-linux] * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ---------------------------------------- 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/
participants (3)
-
eileencodes (Eileen Uchitelle)
-
k0kubun (Takashi Kokubun)
-
tompng (tomoya ishida)