Project

General

Profile

Actions

Bug #16343

closed

Inconsistent behavior of 'circular argument reference' error

Added by ibylich (Ilya Bylich) over 4 years ago. Updated over 4 years ago.

Status:
Closed
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

Like0
Like0Like0