Project

General

Profile

Bug #15720

SystemStackError when referencing a refinement in a module that isn't used

Added by chocolateboy (Chocolate Boy) about 1 month ago. Updated about 1 month ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-03-21 trunk 67332) [x86_64-linux]
[ruby-core:91916]

Description

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 `<main>': undefined local variable or method `bar' for main:Object (NameError)

Actual:

foo called!
Traceback (most recent call last):
bug.rb:20:in `<main>': 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) bug.rb chocolateboy (Chocolate Boy), 03/21/2019 08:07 PM

History

#1

Updated by chocolateboy (Chocolate Boy) about 1 month ago

  • Description updated (diff)
#2

Updated by chocolateboy (Chocolate Boy) about 1 month ago

  • Description updated (diff)
#3

Updated by chocolateboy (Chocolate Boy) about 1 month ago

  • Description updated (diff)

Also available in: Atom PDF