Project

General

Profile

Actions

Bug #21010

closed

Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism

Bug #21010: Endless method definition of `[]=` is SyntaxError in parse.y but allowed in Prism

Added by tompng (tomoya ishida) 10 months ago. Updated 8 months ago.

Status:
Closed
Assignee:
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) +PRISM [x86_64-linux]
[ruby-core:120524]

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) 10 months ago Actions #1 [ruby-core:120530]

  • Assignee set to prism

Updated by nobu (Nobuyoshi Nakada) 10 months ago Actions #3

  • Status changed from Open to Closed

Updated by nobu (Nobuyoshi Nakada) 10 months ago Actions #4

  • 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 months ago Actions #5 [ruby-core:121007]

  • 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
Actions

Also available in: PDF Atom