Actions
Bug #20216
closedCircular parameter reference not checked for assignment
    Bug #20216:
    Circular parameter reference not checked for assignment
  
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) almost 2 years ago
          Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
          
          
        
        
      
      They are not "reference"s, I think.
        
           Updated by kddnewton (Kevin Newton) over 1 year ago
          Updated by kddnewton (Kevin Newton) over 1 year ago
          
          
        
        
      
      - Status changed from Open to Closed
Actions