diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-14 22:35:13 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-14 22:35:13 +0000 |
commit | 7606806cd9a75cd2a9efc1b17f86a57230bd92a6 (patch) | |
tree | 678ebea2249bea7ad91bc5c8e0f07e2ed8ef74e4 /test | |
parent | dc9ce32864a99391ef8892946c769c0d5bdf1c41 (diff) |
compile.c: drop freezestring insn on String#-@
Followup to r62039 and remove the redundant freezestring
insn which was preventing deduplication from String#-@
* compile.c (iseq_peephole_optimize): drop freezestring insn on String#-@
[ruby-core:85542] [Bug #14475]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_optimization.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 83a3a1191a..8aa5c39323 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -568,6 +568,21 @@ class TestRubyOptimization < Test::Unit::TestCase end end + def test_peephole_dstr + code = "#{<<~'begin;'}\n#{<<~'end;'}" + begin; + exp = (-'a').object_id + z = 'a' + exp == (-"#{z}").object_id + end; + [ false, true ].each do |fsl| + iseq = RubyVM::InstructionSequence.compile(code, + frozen_string_literal: fsl) + assert_equal(true, iseq.eval, + "[ruby-core:85542] [Bug #14475] fsl: #{fsl}") + end + end + def test_branch_condition_backquote bug = '[ruby-core:80740] [Bug #13444] redefined backquote should be called' class << self |