#513: MacRuby gets confused about inheritance under certain conditions -----------------------------------+---------------------------------------- Reporter: matt...@… | Owner: lsansone...@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Given the following code,
{{{ module Foo module Baz def initialize(a, b) end end end module Foo module Bar module Baz include Foo::Baz def initialize(a, b, c, d) super(a, b) end end end end module Foo module Bar module Quux include Baz end end end module Foo module Bar module Baz class Bat include Foo::Bar::Baz include Foo::Bar::Quux end end end end }}} There are two related errors associated with this piece of code. 1. {{{Foo::Bar::Baz::Bat.new}}} '''Expected result (Ruby 1.9.1)''' ArgumentError: wrong number of arguments (0 for 4) '''Actual result (MacRuby 0.5b2)''' => #<Foo::Bar::Baz::Bat:0x200252380> Note the difference in response from #512! 2. {{{Foo::Bar::Baz::Bat.new(nil, nil, nil, nil)}}} '''Expected result (Ruby 1.9.1)''' => #<Foo::Bar::Baz::Bat:0x913598> '''Actual result (MacRuby 0.5b2)''' ArgumentError: wrong number of arguments (4 for 2) It seems that MacRuby is becoming confused. Here are a few ways to make it understand that Foo::Bar::Baz::Bat#initialize should accept 4 arguments. - Comment out Foo::Bar::Baz::Bat's second include statement (line 33)[[BR]] - Comment out Foo::Bar::Quux's include statement (line 23)[[BR]] - Comment out Foo::Bar::Baz's include statement (line 11) and Foo::Bar::Baz#initialize's super call (line 14) Of course, for my application I need the original functionality, so none of those will work for me. :-) If you find a workaround while investigating, please let me know. -- Ticket URL: <http://www.macruby.org/trac/ticket/513> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel