[#97536] [Ruby master Bug#16694] JIT vs hardened GCC with PCH — v.ondruch@...
Issue #16694 has been reported by vo.x (Vit Ondruch).
11 messages
2020/03/18
[ruby-core:97587] [Ruby master Bug#16736] Prepending blank module breaks super call in aliased method
From:
merch-redmine@...
Date:
2020-03-24 17:30:57 UTC
List:
ruby-core #97587
Issue #16736 has been updated by jeremyevans0 (Jeremy Evans).
Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED
This is due to the origin pointers on the module iclasses being incorrectly set to the module's origin instead of the iclass origin. Setting the origin pointers correctly requires using a stack, as the origin iclasses are created after the iclasses themselves. I already did part of the work in the prepend patch in #9573. I've merged the necessary parts of the prepend patch locally and am running tests now. Assuming no errors I'll submit a pull request.
----------------------------------------
Bug #16736: Prepending blank module breaks super call in aliased method
https://bugs.ruby-lang.org/issues/16736#change-84771
* Author: tycooon (Yuri Smirnov)
* Status: Assigned
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
* ruby -v: 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
* Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED
----------------------------------------
Here is the test script:
```
class A
def key
["some_key"]
end
end
module M
prepend Module.new
def self.included(base)
base.alias_method :base_key, :key
end
def key
super + ["new_key"]
end
def generate
base_key
end
end
class B < A
include M
end
x = B.new
p x.generate
```
In Ruby 2.7 I get the following error:
```
Traceback (most recent call last):
2: from test.rb:28:in `<main>'
1: from test.rb:19:in `generate'
test.rb:15:in `key': super: no superclass method `key' for #<B:0x00007fbc1704d028> (NoMethodError)
```
If I remove the `prepend Module.new` line or switch to Ruby 2.6, I get the expected result:
```
["some_key", "new_key"]
```
--
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>