From: usa@... Date: 2021-04-04T22:42:27+00:00 Subject: [ruby-core:103214] [Ruby master Bug#16764] Module.const_source_location does not work on autoloaded constants Issue #16764 has been updated by usa (Usaku NAKAMURA). Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE bacported into ruby_2_6 at r16764 ---------------------------------------- Bug #16764: Module.const_source_location does not work on autoloaded constants https://bugs.ruby-lang.org/issues/16764#change-91289 * Author: exterm (Philip M�ller) * Status: Closed * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19] * Backport: 2.5: REQUIRED, 2.6: DONE, 2.7: DONE ---------------------------------------- As we found when trying out `const_source_location` on a Rails project, it breaks when used on autoloaded constants. Example: ``` $ cat foo.rb autoload :Bar, './bar' Bar puts Module.const_source_location("Bar") ``` Returns `foo.rb:3`, when it should return `bar.rb:1`. -- https://bugs.ruby-lang.org/ Unsubscribe: