From 8286544dc5518f59bd607f6b6f8870fd22b3bac7 Mon Sep 17 00:00:00 2001 From: Jimmy Miller Date: Thu, 23 Mar 2023 13:11:46 -0400 Subject: YJIT: Use starting context for status === CantCompile (#7583) --- bootstraptest/test_yjit.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 14ed13035d..f428407195 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -3737,3 +3737,45 @@ assert_normal_exit %q{ ) foo 1 } + +# Regression test for CantCompile not using starting_ctx +assert_normal_exit %q{ + class Integer + def ===(other) + false + end + end + + def my_func(x) + case x + when 1 + 1 + when 2 + 2 + else + 3 + end + end + + my_func(1) +} + +# Regression test for CantCompile not using starting_ctx +assert_equal "ArgumentError", %q{ + def literal(*args, &block) + s = ''.dup + args = [1, 2, 3] + literal_append(s, *args, &block) + s + end + + def literal_append(sql, v) + [sql.inspect, v.inspect] + end + + begin + literal("foo") + rescue ArgumentError + "ArgumentError" + end +} -- cgit v1.2.1