Project

General

Profile

Bug #11155

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

I have two files: 

 a.rb 

 
 ~~~ruby 
 module A 
   autoload :C, 'b' 
 end 

 p ::A::C 
 ~~~ 

 b.rb 

 
 ~~~ruby 
 puts "START" 
 module A 
   class C 
   end 
 end 
 puts "FINISH" 
 ~~~ 

 When I run a.rb, I get an exception: 

 ~~~ 
 [aaron@TC xxx (master)]$ ruby --disable-gems -I. a.rb  
 START 
 /Users/aaron/git/xxx/b.rb:3:in `<module:A>': uninitialized constant A::C (NameError) 
	 from /Users/aaron/git/xxx/b.rb:2:in `<top (required)>' 
	 from a.rb:5:in `require' 
	 from a.rb:5:in `<main>' 
 [aaron@TC xxx (master)]$ 
 ~~~ 

 If I change the file to something else, like `c`, then the exception will not happen.    This seems to break on every version that implements `autoload`.

Back