Project

General

Profile

Feature #15883 ยป frozen-error-message-detail.patch

jeremyevans0 (Jeremy Evans), 05/28/2019 12:55 AM

View differences:

error.c
2897 2897
	VALUE path = rb_ary_entry(debug_info, 0);
2898 2898
	VALUE line = rb_ary_entry(debug_info, 1);
2899 2899

  
2900
        rb_frozen_error_raise(frozen_obj,
2901
            "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
2902
            CLASS_OF(frozen_obj), path, line);
2900
	rb_frozen_error_raise(frozen_obj,
2901
	    "can't modify frozen %"PRIsVALUE": %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
2902
	    CLASS_OF(frozen_obj), rb_inspect(frozen_obj), path, line);
2903 2903
    }
2904 2904
    else {
2905
        rb_frozen_error_raise(frozen_obj, "can't modify frozen %"PRIsVALUE,
2906
            CLASS_OF(frozen_obj));
2905
	rb_frozen_error_raise(frozen_obj, "can't modify frozen %"PRIsVALUE": %"PRIsVALUE,
2906
	    CLASS_OF(frozen_obj), rb_inspect(frozen_obj));
2907 2907
    }
2908 2908
}
2909 2909

  
eval.c
454 454
		goto noclass;
455 455
	    }
456 456
	}
457
        rb_frozen_error_raise(klass, "can't modify frozen %s", desc);
457
        rb_frozen_error_raise(klass, "can't modify frozen %s: %"PRIsVALUE, desc, klass);
458 458
    }
459 459
}
460 460

  
test/ruby/test_rubyoptions.rb
988 988

  
989 989
  def test_frozen_string_literal_debug
990 990
    with_debug_pat = /created at/
991
    wo_debug_pat = /can\'t modify frozen String \(FrozenError\)\n\z/
991
    wo_debug_pat = /can\'t modify frozen String: "\w+" \(FrozenError\)\n\z/
992 992
    frozen = [
993 993
      ["--enable-frozen-string-literal", true],
994 994
      ["--disable-frozen-string-literal", false],
test/ruby/test_variable.rb
135 135
  def test_special_constant_ivars
136 136
    [ true, false, :symbol, "dsym#{rand(9999)}".to_sym, 1, 1.0 ].each do |v|
137 137
      assert_empty v.instance_variables
138
      msg = "can't modify frozen #{v.class}"
138
      msg = "can't modify frozen #{v.class}: #{v.inspect}"
139 139

  
140 140
      assert_raise_with_message(FrozenError, msg) do
141 141
        v.instance_variable_set(:@foo, :bar)
142
-