diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2022-05-03 13:44:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 13:44:43 -0400 |
commit | cf71e5f62a28eda22d67e3b4bad30fdff766fedc (patch) | |
tree | 727f0fa2a3921d83dd5d6c4f490261ff807170f1 /test/ruby | |
parent | 4d28553c7d5393e939ecada5c12d837604d3a42d (diff) | |
download | ruby-cf71e5f62a28eda22d67e3b4bad30fdff766fedc.tar.gz |
Add a regression test for opt_plus with unknown type (#5878)
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_yjit.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 9ad59bc962..88be6622ce 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -1,4 +1,8 @@ # frozen_string_literal: true +# +# This set of tests can be run with: +# make test-all TESTS='test/ruby/test_yjit.rb' RUN_OPTS="--yjit-call-threshold=1" + require 'test/unit' require 'envutil' require 'tmpdir' @@ -453,6 +457,27 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_getivar_opt_plus + assert_no_exits(<<~RUBY) + class TheClass + def initialize + @levar = 1 + end + + def get_sum + sum = 0 + # The type of levar is unknown, + # but this still should not exit + sum += @levar + sum + end + end + + obj = TheClass.new + obj.get_sum + RUBY + end + def test_super_iseq assert_compiles(<<~'RUBY', insns: %i[invokesuper opt_plus opt_mult], result: 15) class A |