https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112015-01-14T21:11:06ZRuby Issue Tracking SystemRuby master - Bug #10741: const_defined? triggers autoload where it did not beforehttps://bugs.ruby-lang.org/issues/10741?journal_id=510122015-01-14T21:11:06Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Test in JRuby that caught this change: <a href="https://github.com/jruby/jruby/blob/master/test/jruby/test_autoload.rb#L4-L24" class="external">https://github.com/jruby/jruby/blob/master/test/jruby/test_autoload.rb#L4-L24</a></p>
<p>Fix in JRuby: <a href="https://github.com/jruby/jruby/commit/496c638d2419e089e93eec9759d9775de0390901" class="external">https://github.com/jruby/jruby/commit/496c638d2419e089e93eec9759d9775de0390901</a></p> Ruby master - Bug #10741: const_defined? triggers autoload where it did not beforehttps://bugs.ruby-lang.org/issues/10741?journal_id=510132015-01-14T21:15:13Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>To be more specific, this assertion fails on MRI:</p>
<blockquote>
<p>assert_equal("#{File.dirname(<strong>FILE</strong>)}/autoloaded.rb", Object.autoload?("Autoloaded"))</p>
</blockquote>
<p>Because the previous const_defined? call has already triggered the autoload.</p> Ruby master - Bug #10741: const_defined? triggers autoload where it did not beforehttps://bugs.ruby-lang.org/issues/10741?journal_id=510142015-01-14T22:15:19Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Boo...my fix was bad because it stopped searching superclasses. Since I did not have an appropriate method to search superclasses, split up :: elements, and check private consts all in one, I reverted JRuby to the autoload-inducing state for now: <a href="https://github.com/jruby/jruby/commit/ccfee85c717a8235d18c63aacfe5f015f4f14261" class="external">https://github.com/jruby/jruby/commit/ccfee85c717a8235d18c63aacfe5f015f4f14261</a></p>
<p>Tagged some specs and removed an assertion in JRuby's test: <a href="https://github.com/jruby/jruby/commit/cffeaab92d5a893240f6ba35159c29eb4cc8d4d5" class="external">https://github.com/jruby/jruby/commit/cffeaab92d5a893240f6ba35159c29eb4cc8d4d5</a></p> Ruby master - Bug #10741: const_defined? triggers autoload where it did not beforehttps://bugs.ruby-lang.org/issues/10741?journal_id=791962019-07-08T01:21:52Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This was fixed between 2.6 and 2.7.0-preview1:</p>
<pre><code>$ ruby26 a.rb
in b
true
$ ruby27 a.rb
true
</code></pre> Ruby master - Bug #10741: const_defined? triggers autoload where it did not beforehttps://bugs.ruby-lang.org/issues/10741?journal_id=791992019-07-08T01:40:46Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/15780">Bug #15780</a>: Module#const_defined?(String) executes autoloads</i> added</li></ul>