Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument destructuring fails when the argument shadows a local in the containing scope #1953

Closed
brixen opened this issue Oct 11, 2012 · 0 comments
Assignees

Comments

@brixen
Copy link
Member

brixen commented Oct 11, 2012

Given the following code:

def m
  yield [[1,2], [3,4]]
end

def n(b)
  m do |(b, c)|
    p b, c
  end
end

n 5

The output on Rubinius 1.9 mode is:

5
nil

while the expected output is:

[1, 2]
[3, 4]

The correct output is produced by Rubinius if the destructuring is removed from the block arguments or the parameter to #n is changed so that it is not shadowed by the block argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants