Actions
Bug #21010
closed
Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism
ruby -v:
ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) +PRISM [x86_64-linux]
Description
These codes is SyntaxError in parse.y but accepted in Prism
def []=(k,v)=1
def obj.[]=(k,v)=1
These are both SyntaxError in parse.y and Prism by design.
# 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.
Updated by eileencodes (Eileen Uchitelle) about 2 months ago
- Assignee set to prism
Updated by eileencodes (Eileen Uchitelle) about 2 months ago
Updated by nobu (Nobuyoshi Nakada) about 2 months ago
- Status changed from Open to Closed
Updated by nobu (Nobuyoshi Nakada) about 2 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED
Updated by k0kubun (Takashi Kokubun) 8 days ago
- 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 82f7cb794109794f6ffa95ffb3be8e5149dd74bd merged revision(s) ad96c5a72908042489357b73dc936c4bc38d919b, ca81142eff98cccb03ff523322aefe4e7346fd0e.
Actions
Like0
Like0Like0Like0Like0Like0