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] Issue with zsuper calls and optional arguments #2947

Closed
nirvdrum opened this issue May 15, 2015 · 2 comments
Closed

[Truffle] Issue with zsuper calls and optional arguments #2947

nirvdrum opened this issue May 15, 2015 · 2 comments
Assignees
Milestone

Comments

@nirvdrum
Copy link
Contributor

Truffle currently will not pass the default values for optional arguments up to super calls. E.g.,

class A
  def m(x, y, z)
    p "A#m(#{x}, #{y}, #{z})"
  end
end

class B < A
  def m(x, y, z = nil)
    super
    p "B#m(#{x}, #{y}, #{z})"
  end
end

B.new.m(5, 4, 3)
B.new.m(5, 4)

Running in MRI we get:

> ruby -v zsuper.rb 
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
A#m(5, 4, 3)
B#m(5, 4, 3)
A#m(5, 4, )
B#m(5, 4, )

In JRuby+Truffle, we get:

> bin/jruby -X+T -v zsuper.rb 
jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-14 5ed91b4 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
A#m(5, 4, 3)
B#m(5, 4, 3)
zsuper.rb:2:in `m': wrong number of arguments (2 for 3) (ArgumentError)
    from zsuper.rb:9:in `m'
    from zsuper.rb:15:in `<main>'
@nirvdrum nirvdrum changed the title [Truffle] Issue with zsuper calls and option arguments [Truffle] Issue with zsuper calls and optional arguments May 15, 2015
@chrisseaton chrisseaton self-assigned this May 19, 2015
@chrisseaton
Copy link
Contributor

Specs in d265a61

@chrisseaton
Copy link
Contributor

Fixed in various commits. There are still limitations if we have both rest arguments and named args, and probably also with unnamed rest args, but these are now documented in failing specs.

@chrisseaton chrisseaton added this to the truffle-dev milestone May 19, 2015
@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

3 participants