Bug #1018: return in an eigenclass definition
http://redmine.ruby-lang.org/issues/show/1018

Author: Shugo Maeda
Status: Assigned, Priority: Low
Assigned to: Koichi Sasada

Hi,

return in an eigenclass definition causes compile error on Ruby 1.9.

$ cat /tmp/t.rb
class Object
  def eigenclass
    class <<self
      return self
    end
  end
end
p Object.eigenclass
$ ruby-trunk -v /tmp/t.rb
ruby 1.9.0 (2008-11-25 revision 20352) [i686-linux]
/tmp/t.rb:4: Invalid return
/tmp/t.rb: compile error (SyntaxError)
$ ruby-1_8 -v /tmp/t.rb
ruby 1.8.7 (2009-01-14 revision 21505) [i686-linux]
#<Class:Object>

It's a bug, isn't it?

FYI, It seems that the program execution is terminated on JRuby.

$ jruby -v /tmp/t.rb 
jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2008-12-17 rev 8388) [i386-java]
$ 

Shugo


----------------------------------------
http://redmine.ruby-lang.org