[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-core
Subject: [ruby-core:104428] [Ruby master Bug#17887] Missed constant lookup after prepend
From: merch-redmine () jeremyevans ! net
Date: 2021-06-28 20:00:13
Message-ID: redmine.journal-92681.20210628200013.13423 () ruby-lang ! org
[Download RAW message or body]
Issue #17887 has been updated by jeremyevans0 (Jeremy Evans).
Assignee set to nobu (Nobuyoshi Nakada)
Status changed from Open to Assigned
@alanwu came up with a much simpler fix for this issue, so I closed my pull request \
in favor of his. @nobu, could you please review his pull request: \
https://github.com/ruby/ruby/pull/4585 ?
----------------------------------------
Bug #17887: Missed constant lookup after prepend
https://bugs.ruby-lang.org/issues/17887#change-92681
* Author: bjfish (Brandon Fish)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* ruby -v: 2.6.x-3.0.x
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
**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**
``` ruby
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"
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic