Projects

Ticket #709 (closed defect: duplicate)

Opened 21 months ago

Last modified 14 months ago

Different behaviour when including a module into Class in MacRuby vs Ruby 1.9.2

Reported by: james@… Owned by: lsansonetti@…
Priority: major Milestone:
Component: MacRuby Keywords: #reduction mocha class module include
Cc: james@…

Description

I'm seeing different behaviour when including a module into Class in MacRuby vs Ruby 1.9.2. This is a simplification of a problem I'm seeing running Mocha [1] tests in MacRuby. I seems to be specific to including the module into the Class class and not a user-defined class. It also doesn't seem to matter whether the class has already been defined or not.

$ rvm macruby
$ irb
macruby-0.6 > module X; def x; "x"; end; end
 => nil 
macruby-0.6 > class Class; include X; end
 => Class 
macruby-0.6 > Class.new.x
NoMethodError: undefined method `x' for #<Class:0x20020f960>
	from /Users/jamesmead/Code/mocha/(irb):3:in `<main>'
$ rvm 1.9.2
$ irb
ruby-1.9.2-preview1 > module X; def x; "x"; end; end
 => nil 
ruby-1.9.2-preview1 > class Class; include X; end
 => Class 
ruby-1.9.2-preview1 > Class.new.x
 => "x" 
$ rvm macruby
$ irb
macruby-0.6 > module X; def x; "x"; end; end
 => nil 
macruby-0.6 > class Y; include X; end
 => Y 
macruby-0.6 > Y.new.x
 => "x" 
$ rvm macruby
$ irb
macruby-0.6 > module X; def x; "x"; end; end
 => nil 
macruby-0.6 > class Y; end
 => nil 
macruby-0.6 > class Y; include X; end
 => Y 
macruby-0.6 > Y.new.x
 => "x" 

[1]  http://github.com/floehopper/mocha/tree/macruby

Attachments

709.rb Download (77 bytes) - added by emil@… 14 months ago.
reduction

Change History

Changed 21 months ago by james@…

  • cc james@… added

Cc Me!

Changed 21 months ago by james@…

I've just come across this commit [1] which looks like it adds a test for this problem to known_bugs.rb.

I'm now trying to investigate whether the problem has been fixed.

[1]  http://github.com/masterkain/macruby/commit/40455e95942cffb0b30001efb1bc4e55c05ed664

Changed 21 months ago by james@…

It now looks like this may be a duplicate of #562.

Changed 14 months ago by emil@…

reduction

Changed 14 months ago by emil@…

problem stil exists in trunk rev 4976, reduction uploaded

Changed 14 months ago by mattaimonetti@…

  • keywords #reduction added

Changed 14 months ago by eloy.de.enige@…

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #562.

Note: See TracTickets for help on using tickets.