Project

General

Profile

Actions

Bug #17887

closed

Missed constant lookup after prepend

Added by bjfish (Brandon Fish) almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Target version:
-
ruby -v:
2.6.x-3.0.x
[ruby-core:104013]

Description

Description
The following shows that the constant lookup from B does not find the constant in the prepended M module. I would expect this lookup to behave like "B.include M" which does print the constant from module M.

Example

module M
  FOO = 'm'
end
class A
  FOO = 'a'
end
class B < A
  def foo
    FOO
  end
end
b = B.new
p b.foo
A.prepend M
p b.foo

Expected Result

"a"
"m"

Actual Result

"a"
"a"
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0