From: sam.saffron@... Date: 2018-02-14T07:37:41+00:00 Subject: [ruby-core:85542] [Ruby trunk Bug#14475] String de-duplication is broken in files with frozen_string_literal: true Issue #14475 has been reported by sam.saffron (Sam Saffron). ---------------------------------------- Bug #14475: String de-duplication is broken in files with frozen_string_literal: true https://bugs.ruby-lang.org/issues/14475 * Author: sam.saffron (Sam Saffron) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.5.0, 2.6.0 * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Create 2 files: test.rb ``` $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'frozen' puts frozen.object_id puts frozen.object_id ``` frozen.rb ``` # frozen_string_literal: true A = "a" def frozen -"#{A}" end ``` Run `test.rb` ``` % ruby test.rb 70189973179400 70189973179260 ``` Change to `# frozen_string_literal: false` And you get ``` 70189973181360 70189973181360 ``` So something is over-optimising here, fix should be backported to 2.5.0 imo. -- https://bugs.ruby-lang.org/ Unsubscribe: