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

Block variable shadowing and local_variables not matching up right #2129

Closed
headius opened this issue Nov 6, 2014 · 2 comments
Closed

Block variable shadowing and local_variables not matching up right #2129

headius opened this issue Nov 6, 2014 · 2 comments

Comments

@headius
Copy link
Member

@headius headius commented Nov 6, 2014

Here's the cases from MRI:

  def test_shadowing_local_variables
    bug9486 = '[ruby-core:60501] [Bug #9486]'
    x = tap {|x| break local_variables}
    assert_equal([:x, :bug9486], x)
  end

  def test_shadowing_block_local_variables
    bug9486 = '[ruby-core:60501] [Bug #9486]'
    x = tap {|;x| break local_variables}
    assert_equal([:x, :bug9486], x)
  end

And our results:

123) Failure:
TestVariable#test_shadowing_block_local_variables [/Users/headius/projects/jruby/test/mri/ruby/test_variable.rb:95]:
<[:x, :bug9486]> expected but was
<[:bug9486, :x, :x]>.

[5903/5997] TestVariable#test_shadowing_local_variables = 0.00 s              
124) Failure:
TestVariable#test_shadowing_local_variables [/Users/headius/projects/jruby/test/mri/ruby/test_variable.rb:89]:
<[:x, :bug9486]> expected but was
<[:bug9486, :x, :x]>.

Combination of parser and IR I would guess, but I have not investigated.

@headius headius added parser ir labels Nov 6, 2014
@headius headius added this to the JRuby 9000 milestone Nov 6, 2014
@subbuss
Copy link
Contributor

@subbuss subbuss commented Jan 15, 2015

Maybe this is just 'local_variables' implementation that needs an update?

@headius
Copy link
Member Author

@headius headius commented Jan 26, 2015

@subbuss That seems likely. I bet it's just not excluding duplicate names, or not ignoring variables in parent scopes shadowed by child scopes. I will mark as beginner.

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

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.