#609 √ resolved
cremes

does not parse defined?(self::FOO) correctly

Reported by cremes | June 17th, 2008 @ 04:58 PM | in 1.0 preview

This code fails in rubinius but works correctly in MRI and JRuby:

module A
  self::FOO = 'x' unless defined? self::FOO
end

It throws a NameError exception and produces this backtrace:

NameError: wrong constant name self

from Module#normalize_const_name at kernel/core/module.rb:895

from Module#recursive_const_get at kernel/core/module.rb:854

from MethodContext#const_path_defined? at kernel/core/context.rb:238

from A.__module_init__ (A) at (irb):2

from Object#irb_binding {} at (irb):1

This was discovered while trying to load gem 'arrayfields' for testing. It uses the above construct to track the VERSION of the gem.

I would have attached a spec but I am not sure where it ought to go.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket