Project

General

Profile

Actions

Bug #16343

closed

Inconsistent behavior of 'circular argument reference' error

Added by ibylich (Ilya Bylich) about 5 years ago. Updated about 5 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


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20478: Circular parameter syntax error rulesClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0