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

[Truffle] Super not passing correct value #2927

Closed
bjfish opened this issue May 11, 2015 · 4 comments
Closed

[Truffle] Super not passing correct value #2927

bjfish opened this issue May 11, 2015 · 4 comments
Assignees
Milestone

Comments

@bjfish
Copy link
Contributor

bjfish commented May 11, 2015

This issue comes up while running rubygems.

Example

class Test
  def self.new value 
    value = 5
    super
  end

  def initialize value
    puts "VALUE:#{value}"
  end

end
Test.new("Five")

Expected

ruby super.rb 
VALUE:5

Actual

 ~/Documents/jruby/bin/jruby -X+T super.rb 
VALUE:Five
@eregon
Copy link
Member

eregon commented May 11, 2015

The dreaded zsuper ... not sure why the local assignment does not assign to the frame though.

@chrisseaton chrisseaton added this to the truffle-dev milestone May 11, 2015
@chrisseaton chrisseaton self-assigned this May 11, 2015
@chrisseaton
Copy link
Contributor

We load the arguments from the original arguments array - looks like we need to load them from the locals they went into instead - not sure how that interacts with rests though...

@enebo
Copy link
Member

enebo commented May 11, 2015

@chrisseaton unnamed rests are also preserved to the call if I remember correctly. You are correct though:

def foo(a)
    a = 2
    super
end

super gets a = 2 and not what was passed in. I think zsuper is a top 5 confusing feature for rubyists.

@chrisseaton
Copy link
Contributor

Fixed in 9505ba8

@enebo enebo added this to the Non-Release milestone Dec 7, 2017
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

4 participants