Project

General

Profile

Actions

Bug #20216

closed

Circular parameter reference not checked for assignment

Added by kddnewton (Kevin Newton) 5 months ago. Updated 3 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:116458]

Description

I wanted to check if this was a bug or desired.

Usually when you reference a parameter within its own default value (optional positional or optional keyword) it raises a syntax error. This is unless you use it in an assignment, in which case it is not checked. Is this desired? Here's an example:

def foo(bar = bar = 1); end
def foo(bar: bar = 1); end

I'm not sure what this code is supposed to be doing. I expected it to raise a syntax error.

Updated by nobu (Nobuyoshi Nakada) 5 months ago

They are not "reference"s, I think.

Actions #2

Updated by kddnewton (Kevin Newton) 3 months ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0