From 0cb1fc3850db6367fa720bf3b603bb1fde2ef813 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 2 Nov 2023 17:38:24 +0100 Subject: Fix vm_getivar to handle module with TOO_COMPLEX shape --- test/ruby/test_shapes.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb index 09a99c4855..4967b404e2 100644 --- a/test/ruby/test_shapes.rb +++ b/test/ruby/test_shapes.rb @@ -275,6 +275,25 @@ class TestShapes < Test::Unit::TestCase end; end + def test_run_out_of_shape_for_module_ivar + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + o = Object.new + i = 0 + while RubyVM::Shape.shapes_available > 0 + o.instance_variable_set(:"@i#{i}", 1) + i += 1 + end + + module Foo + @a = 1 + @b = 2 + assert_equal 1, @a + assert_equal 2, @b + end + end; + end + def test_run_out_of_shape_for_class_cvar assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; -- cgit v1.2.3