summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-02-19 11:20:55 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:30 -0400
commit064e3450536ad4c4fe49cb282d13713775d4ba8a (patch)
treee3eea7b24e48350b2acd917ba72422be5b2a46b8 /bootstraptest
parent9d62ab303c118eb4f21f8147fac33e187902e339 (diff)
Check for ::Array, not T_ARRAY in opt_aref
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ujit.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/bootstraptest/test_ujit.rb b/bootstraptest/test_ujit.rb
index 318d07c670..f28d1f37df 100644
--- a/bootstraptest/test_ujit.rb
+++ b/bootstraptest/test_ujit.rb
@@ -197,3 +197,20 @@ assert_equal "nil\n", %q{
p other.read
}
+
+# Test that opt_aref checks the class of the receiver
+assert_equal ":special\n", %q{
+ def foo(array)
+ array[30]
+ end
+
+ UJIT.install_entry(RubyVM::InstructionSequence.of(method(:foo)))
+
+ special = []
+ def special.[](idx)
+ :special
+ end
+
+ p foo(special)
+ nil
+}