1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add a regression test for opt_plus with unknown type (#5878)

This commit is contained in:
Maxime Chevalier-Boisvert 2022-05-03 13:44:43 -04:00 committed by GitHub
parent 4d28553c7d
commit cf71e5f62a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2022-05-04 02:45:16 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>

View file

@ -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