summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-08-26 11:45:05 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commit812597676ba2b1e3c41c50e9da624441e0c40a6b (patch)
tree42faa784fca02f8efab59803c89cc3c5847efc0e /test/ruby
parent54db64f7a59f1f14b280a80491336a128f792b42 (diff)
Avoid immediate side exits in checktype
Previously checktype only supported heap objects, however it's not uncommon to receive an immediate, for example when string interpolating a Symbol or Integer.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_yjit.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 1f5f99f9a8..04502f925c 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -152,6 +152,16 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_string_interpolation_cast
+ assert_compiles(<<~'RUBY', insns: %i[checktype concatstrings tostring], result: "123")
+ def make_str(foo, bar)
+ "#{foo}#{bar}"
+ end
+
+ make_str(1, 23)
+ RUBY
+ end
+
def test_fib_recursion
assert_compiles(<<~'RUBY', insns: %i[opt_le opt_minus opt_plus opt_send_without_block], result: 34)
def fib(n)