Project

General

Profile

Actions

Bug #21010

closed

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

Added by tompng (tomoya ishida) 8 days ago. Updated 8 days 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0