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

singleton method + zsuper issue when contained in another class? #5634

Closed
enebo opened this issue Feb 27, 2019 · 1 comment
Closed

singleton method + zsuper issue when contained in another class? #5634

enebo opened this issue Feb 27, 2019 · 1 comment
Milestone

Comments

@enebo
Copy link
Member

@enebo enebo commented Feb 27, 2019

class Foo
  def one
    puts "Foo.one"
  end
end

class Bar
  foo = Foo.new

  def foo.one
    puts "singleton.one"
    super
  end

  foo.one
end

while examining a rails app I noticed another zsuper issue! If I remove class Bar from wrapping this we work as expected.

@enebo enebo added this to the JRuby 9.2.7.0 milestone Feb 27, 2019
@enebo
Copy link
Member Author

@enebo enebo commented Feb 27, 2019

Icky. So foo.one gets current.scope from static scope which is lexical so we end up with Bar. This is surprising to realize and I half wonder what else we hit from doing this.

@enebo enebo closed this in a58f304 Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant