From: merch-redmine@... Date: 2019-06-10T23:27:27+00:00 Subject: [ruby-core:93038] [Ruby trunk Bug#15720] SystemStackError when referencing a refinement in a module that isn't used Issue #15720 has been updated by jeremyevans0 (Jeremy Evans). Assignee set to ko1 (Koichi Sasada) Status changed from Open to Assigned File sse-unused-refinement.patch added I can confirm this issue. I believe it stems from the fact that in `vm_call_method_each_type`, `cc->me` is getting overwritten by `ref_me` even if they already have the same `def` but a different `defined_class`, which results in infinite recursion. The attached patch should fix your example, but my understanding of this code is limited. ko1 or shugo should probably review this patch and determine if it is the proper way to fix this issue. This could possibly be related to #14068. ---------------------------------------- Bug #15720: SystemStackError when referencing a refinement in a module that isn't used https://bugs.ruby-lang.org/issues/15720#change-78424 * Author: chocolateboy (Chocolate Boy) * Status: Assigned * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: * ruby -v: ruby 2.7.0dev (2019-03-21 trunk 67332) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ```ruby module M1 refine Kernel do def foo 'foo called!' end end end module M2 refine Kernel do def bar 'bar called!' end end end using M1 puts foo puts bar ``` Expected: ``` foo called! Traceback (most recent call last): bug.rb:20:in `
': undefined local variable or method `bar' for main:Object (NameError) ``` Actual: ``` foo called! Traceback (most recent call last): bug.rb:20:in `
': stack level too deep (SystemStackError) ``` Platform: Linux (Arch) ruby -v: - ruby 2.7.0dev (2019-03-21 trunk 67332) [x86_64-linux] - ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux] - ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux] ---Files-------------------------------- bug.rb (188 Bytes) sse-unused-refinement.patch (1.85 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: