From: naruse@... Date: 2018-02-26T07:48:15+00:00 Subject: [ruby-core:85814] [Ruby trunk Bug#14407] defined? still returning true for top-level constant when referenced with scope Issue #14407 has been updated by naruse (Yui NARUSE). Backport changed from 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONE ruby_2_5 r62568 merged revision(s) 62071. ---------------------------------------- Bug #14407: defined? still returning true for top-level constant when referenced with scope https://bugs.ruby-lang.org/issues/14407#change-70671 * Author: grzuy (Gonzalo Rodriguez) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: 2.5.0 * Backport: 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONE ---------------------------------------- ~~~ 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: