diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-11 09:15:14 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-11 09:15:14 +0000 |
commit | d65bc80d3f71bf5423a6a6d9b3f8d4ff2faf6bd5 (patch) | |
tree | 5c5e19aaf27ec4b384a18ca0b5bbd973a9fd5eeb /test/ruby/test_optimization.rb | |
parent | 89288e30bfad9458bfd2580e903f1e844af795f2 (diff) |
insns.def (opt_case_dispatch): avoid converting Infinity
Infinity cannot be written as an optimizable literal,
so it can never match a key in a CDHASH.
Avoid converting it to prevent FloatDomainError.
* insns.def (opt_case_dispatch): avoid converting Infinity
* test/ruby/test_optimization.rb (test_opt_case_dispatch_inf): new
[ruby-dev:49423] [Bug #11804]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_optimization.rb')
-rw-r--r-- | test/ruby/test_optimization.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 1c50044f7f..3573d1267f 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -362,4 +362,15 @@ class TestRubyOptimization < Test::Unit::TestCase assert_redefine_method(k, '===', "assert_equal(#{v.inspect} === 0, 0)") end end + + def test_opt_case_dispatch_inf + inf = 1.0/0.0 + result = case inf + when 1 then 1 + when 0 then 0 + else + inf.to_i rescue nil + end + assert_nil result, '[ruby-dev:49423] [Bug #11804]' + end end |