Project

General

Profile

Bug #7107

Updated by Eregon (Benoit Daloze) 5 months ago

=begin 
 With ruby 1.9 and newer C cannot be found if m is duplicated: 

 ```ruby 
   

   module M 
     C = 1 
  
     def self.m 
       C 
     end 
   end 
  
   puts 'named module' 
   M.m 
  
   puts 'anonymous module' 
   m = M.dup 
   m.m 
 ``` 

 Ruby 1.8: 

 ``` 
   


   $ ruby -v t.rb  
   ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] 
   named module 
   anonymous module 
 ``` 

 With Ruby 1.9: 

 ``` 
   

   $ ruby19 -v t.rb  
   ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0] 
   named module 
   anonymous module 
   t.rb:5:in `m': uninitialized constant Module::C (NameError) 
  	 from t.rb:14:in `<main>' 
 ``` 

 With trunk: 

 ``` 
     

     $ ruby19 -v t.rb  
     ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0] 
     named module 
     anonymous module 
     t.rb:5:in `m': uninitialized constant Module::C (NameError) 
    	 from t.rb:14:in `<main>' 
 ``` 

 `m::C` (({m::C})) works in all three versions, though. 
 =end 

Back