summaryrefslogtreecommitdiff
path: root/test/ruby/test_shapes.rb
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2023-11-17 14:05:37 -0500
committerPeter Zhu <[email protected]>2023-11-17 13:08:43 -0800
commit3dd77bc056de19a1cc0ad3fafdb8e49c429dec5a ()
treebc18b727a2a043d17dc66ffeec1352232bd37745 /test/ruby/test_shapes.rb
parent7c99e43c3f050244b06dbd18de4f605ea70d234c (diff)
Fix corruption when out of shape during ivar remove
Reproduction script: ``` o = Object.new 10.times { |i| o.instance_variable_set(:"@a#{i}", i) } i = 0 a = Object.new while RubyVM::Shape.shapes_available > 2 a.instance_variable_set(:"@i#{i}", 1) i += 1 end o.remove_instance_variable(:@a0) puts o.instance_variable_get(:@a1) ``` Before this , it would incorrectly output `2` and now it correctly outputs `1`.
-rw-r--r--test/ruby/test_shapes.rb21
1 files changed, 21 insertions, 0 deletions
@@ -414,6 +414,27 @@ class TestShapes < Test::Unit::TestCase
assert_equal true, A.instance_variable_defined?(:@a)
end;
end
def test_run_out_of_shape_remove_instance_variable
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;