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

Comments

Projects
None yet
2 participants
@headius
Member

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

This comment has been minimized.

Show comment
Hide comment
@subbuss

subbuss Jan 15, 2015

Contributor

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

Contributor

subbuss commented Jan 15, 2015

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

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 26, 2015

Member

@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.

Member

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