[MacRuby] #182: The constant lookup in MacRuby does not behave correctly
#182: The constant lookup in MacRuby does not behave correctly ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- MacRuby: {{{
class A class B end end => nil B => A::B
A::B::B::B => A::B
}}}
Ruby 1.9: {{{ irb(main):001:0> class A irb(main):002:1> class B irb(main):003:2> end irb(main):004:1> end => nil irb(main):005:0> B NameError: uninitialized constant B from (irb):5 from /usr/local/bin/irb-1.9:12:in `<main>' irb(main):006:0> irb(main):014:0> A::B::B::B NameError: uninitialized constant A::B::B from (irb):14 from /usr/local/bin/irb-1.9:12:in `<main>' }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/182> MacRuby <http://macruby.org/>
#182: The constant lookup in MacRuby does not behave correctly ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by vincent.isambart@…): The problem is in variable.c, in rb_const_get_0: {{{ /* Classes are typically pre-loaded by Kernel#framework and imported by * rb_objc_resolve_const_value(), but it is still useful to keep the * dynamic import facility, because someone in the Objective-C world may * dynamically define classes at runtime (like ScriptingBridge.framework). */ { Class k = (Class)objc_getClass(rb_id2name(id)); if (k != NULL) return (VALUE)k; } }}} You should keep this, but only return the class if it's not a Ruby class because if it's a Ruby class and you did not find it before, it's that it's in a different place in the namespace. -- Ticket URL: <http://www.macruby.org/trac/ticket/182#comment:1> MacRuby <http://macruby.org/>
#182: The constant lookup in MacRuby does not behave correctly ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by eloy.de.enige@…): Added failing test in r777 -- Ticket URL: <http://www.macruby.org/trac/ticket/182#comment:2> MacRuby <http://macruby.org/>
#182: The constant lookup in MacRuby does not behave correctly ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------------+----------------------------------- Changes (by eloy.de.enige@…): * status: new => closed * resolution: => fixed Comment: Fixed in r790 -- Ticket URL: <http://www.macruby.org/trac/ticket/182#comment:3> MacRuby <http://macruby.org/>
#182: The constant lookup in MacRuby does not behave correctly ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------------+----------------------------------- Comment(by eloy.de.enige@…): Well actually it was fixed in r791 for your example :) -- Ticket URL: <http://www.macruby.org/trac/ticket/182#comment:4> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby