Project

General

Profile

Bug #9236

Updated by matsuda (Akira Matsuda) over 10 years ago

The following code behaves differently under Ruby 1 and Ruby 2. 

 (({ 
 module Fun 
   def hello 
     orig_hello 
   end 
 end 

 module M1 
   def hello 
     p 'hello!' 
   end 
 end 

 module M2 
   def hello 
     super 
   end 
 end 

 class Foo 
   include M1 
   include M2 

   alias_method :orig_hello, :hello 
   include Fun 
 end 

 Foo.new.hello 


 
 })) 

 % ruby -v fun.rb 
 ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin12.5.0] 
 "hello!" 

 % ruby -v fun.rb 
 ruby 2.1.0dev (2013-12-10 trunk 44126) [x86_64-darwin12.0] 
 fun.rb:3: stack level too deep (SystemStackError) 

 Let's see if this is an intended spec change or a bug. 

 # This issue was originally reported to Rails Core ML by Gary Weaver. https://groups.google.com/forum/#!topic/rubyonrails-core/z5Japo3oIzk

Back