Project

General

Profile

Actions

Bug #16343

closed

Inconsistent behavior of 'circular argument reference' error

Added by ibylich (Ilya Bylich) about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-11-04T16:32:26Z trunk a087e027bf) [x86_64-darwin19]
[ruby-core:95799]

Description

The following code gives a syntax error:

m { |foo = proc { || foo }|  }
# => SyntaxError (-e:14: circular argument reference - foo)

But this code is valid:

m { |foo = proc { |bar| foo }|  }

Is it intentional? foo becomes a proc that returns itself, so there must be a circular dependency

Actions

Also available in: Atom PDF