aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authorJimmy Miller <jimmy.miller@shopify.com>2023-03-23 13:11:46 -0400
committerGitHub <noreply@github.com>2023-03-23 13:11:46 -0400
commit8286544dc5518f59bd607f6b6f8870fd22b3bac7 (patch)
tree25c5ac9e1e5bbb035b257158e0876e4c6e8dbd5a /bootstraptest
parented4dc1c33de945401999078bac836dc882aa8ba2 (diff)
downloadruby-8286544dc5518f59bd607f6b6f8870fd22b3bac7.tar.gz
YJIT: Use starting context for status === CantCompile (#7583)
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb42
1 files changed, 42 insertions, 0 deletions
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
+}