YJIT: add an extra btest for shape too complex (#9013)

Following Jean Boussier's comment that some shape bugs were not
caught by our tests, I'm trying to improve our test coverage a
tiny bit.
This commit is contained in:
Maxime Chevalier-Boisvert 2023-11-22 14:06:37 -05:00 committed by GitHub
parent 3720d4c39a
commit 7a93bee4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -278,6 +278,33 @@ assert_equal '["instance-variable", 5]', %q{
Foo.new.foo
}
# getinstancevariable with shape too complex
assert_normal_exit %q{
class Foo
def initialize
@a = 1
end
def getter
@foobar
end
end
# Initialize ivars in changing order, making the Foo
# class have shape too complex
100.times do |x|
foo = Foo.new
foo.instance_variable_set(:"@a#{x}", 1)
foo.instance_variable_set(:"@foobar", 777)
# The getter method eventually sees shape too complex
r = foo.getter
if r != 777
raise "error"
end
end
}
assert_equal '0', %q{
# This is a regression test for incomplete invalidation from
# opt_setinlinecache. This test might be brittle, so