зеркало из https://github.com/github/ruby.git
YJIT: Add regression test for local type tracking
The test in [1] was removed because it stopped working when we limited the power of Kernel#binding in [2]. However, the underlying issue could still be reproduced using blocks. Add back a regression test. I tested the test by commenting out the fix from [1]. [1]:54c91042ed
[2]:343ea9967e
This commit is contained in:
Родитель
0b58059f15
Коммит
333754ace8
|
@ -1,3 +1,23 @@
|
|||
assert_equal 'true', %q{
|
||||
# regression test for tracking type of locals for too long
|
||||
def local_setting_cmp(five)
|
||||
victim = 5
|
||||
five.define_singleton_method(:respond_to?) do |_, _|
|
||||
victim = nil
|
||||
end
|
||||
|
||||
# +1 makes YJIT track that victim is a number and
|
||||
# defined? calls respond_to? from above indirectly
|
||||
unless (victim + 1) && defined?(five.something)
|
||||
# Would return wrong result if we still think `five` is a number
|
||||
victim.nil?
|
||||
end
|
||||
end
|
||||
|
||||
local_setting_cmp(Object.new)
|
||||
local_setting_cmp(Object.new)
|
||||
}
|
||||
|
||||
assert_equal '18374962167983112447', %q{
|
||||
# regression test for incorrectly discarding 32 bits of a pointer when it
|
||||
# comes to default values.
|
||||
|
|
Загрузка…
Ссылка в новой задаче