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]: 54c91042ed61a869d4a66fc089b21f56d165265f [2]: 343ea9967e4a6b279eed6bd8e81ad0bdc747f254
This commit is contained in:
parent
0b58059f15
commit
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user