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:
parent
4d28553c7d
commit
cf71e5f62a
Notes:
git
2022-05-04 02:45:16 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>
1 changed files with 25 additions and 0 deletions
|
@ -1,4 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# 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 'test/unit'
|
||||||
require 'envutil'
|
require 'envutil'
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
|
@ -453,6 +457,27 @@ class TestYJIT < Test::Unit::TestCase
|
||||||
RUBY
|
RUBY
|
||||||
end
|
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
|
def test_super_iseq
|
||||||
assert_compiles(<<~'RUBY', insns: %i[invokesuper opt_plus opt_mult], result: 15)
|
assert_compiles(<<~'RUBY', insns: %i[invokesuper opt_plus opt_mult], result: 15)
|
||||||
class A
|
class A
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue