From: grzuy0@... Date: 2018-01-27T02:40:30+00:00 Subject: [ruby-core:85143] [Ruby trunk Bug#14407] defined? still returning true for top-level constant when referenced with scope Issue #14407 has been updated by grzuy (Gonzalo Rodriguez). Related to https://bugs.ruby-lang.org/issues/11547 ---------------------------------------- Bug #14407: defined? still returning true for top-level constant when referenced with scope https://bugs.ruby-lang.org/issues/14407#change-69879 * Author: grzuy (Gonzalo Rodriguez) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.5.0 * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- ~~~ ruby class A end class B end if defined?(A::B) puts "defined" puts A::B else puts "not defined" end ~~~ When running this script with ruby 2.5.0 i get: ~~~ defined Traceback (most recent call last): test.rb:10:in `
': uninitialized constant A::B (NameError) Did you mean? B ~~~ while my expectation was that after the top-level constant lookup was removed from ruby 2.5, defined? would return false and i would actually get ~~~ not defined ~~~ as output -- https://bugs.ruby-lang.org/ Unsubscribe: