diff options
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | spec/ruby/core/symbol/shared/id2name.rb | 17 | ||||
-rw-r--r-- | string.c | 5 | ||||
-rw-r--r-- | test/-ext-/string/test_capacity.rb | 4 |
4 files changed, 3 insertions, 31 deletions
@@ -371,14 +371,6 @@ RubyVM:: * +RubyVM.resolve_feature_path+ moved to <code>$LOAD_PATH.resolve_feature_path</code>. [Feature #15903] [Feature #15230] -Symbol:: - - Modified method:: - - * Symbol#to_s now always returns a frozen String. The returned String - is always the same for a given Symbol. This change is - experimental. [Feature #16150] - String:: Unicode:: diff --git a/spec/ruby/core/symbol/shared/id2name.rb b/spec/ruby/core/symbol/shared/id2name.rb index a0e190a680..47f97bd332 100644 --- a/spec/ruby/core/symbol/shared/id2name.rb +++ b/spec/ruby/core/symbol/shared/id2name.rb @@ -6,21 +6,4 @@ describe :symbol_id2name, shared: true do :@ruby.send(@method).should == "@ruby" :@@ruby.send(@method).should == "@@ruby" end - - ruby_version_is "2.7" do - it "returns a frozen String" do - :my_symbol.to_s.frozen?.should == true - :"dynamic symbol #{6 * 7}".to_s.frozen?.should == true - end - - it "always returns the same String for a given Symbol" do - s1 = :my_symbol.to_s - s2 = :my_symbol.to_s - s1.should equal(s2) - - s1 = :"dynamic symbol #{6 * 7}".to_s - s2 = :"dynamic symbol #{2 * 3 * 7}".to_s - s1.should equal(s2) - end - end end @@ -10880,8 +10880,7 @@ sym_inspect(VALUE sym) * sym.id2name -> string * sym.to_s -> string * - * Returns a frozen string corresponding to <i>sym</i>. - * The returned String is always the same String instance for a given Symbol. + * Returns the name or string corresponding to <i>sym</i>. * * :fred.id2name #=> "fred" * :ginger.to_s #=> "ginger" @@ -10891,7 +10890,7 @@ sym_inspect(VALUE sym) VALUE rb_sym_to_s(VALUE sym) { - return rb_sym2str(sym); + return str_new_shared(rb_cString, rb_sym2str(sym)); } diff --git a/test/-ext-/string/test_capacity.rb b/test/-ext-/string/test_capacity.rb index f5830a033b..df59e76778 100644 --- a/test/-ext-/string/test_capacity.rb +++ b/test/-ext-/string/test_capacity.rb @@ -14,9 +14,7 @@ class Test_StringCapacity < Test::Unit::TestCase end def test_capacity_shared - str = :abcdefghijklmnopqrstuvwxyz.to_s.dup - assert Bug::String.shared_string? str - assert_equal 0, capa(str) + assert_equal 0, capa(:abcdefghijklmnopqrstuvwxyz.to_s) end def test_capacity_normal |