1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Transition frozen string to frozen root shape

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
This commit is contained in:
Jemma Issroff 2022-10-19 09:30:41 -04:00 committed by Aaron Patterson
parent 5ca23caa20
commit 0aaa6133ed
Notes: git 2022-10-19 18:06:40 +00:00
3 changed files with 13 additions and 9 deletions

View file

@ -203,14 +203,6 @@ rb_shape_transition_shape_frozen(VALUE obj)
rb_shape_t* next_shape;
if (shape == rb_shape_get_root_shape()) {
switch (BUILTIN_TYPE(obj)) {
case T_OBJECT:
case T_CLASS:
case T_MODULE:
break;
default:
return;
}
next_shape = rb_shape_get_frozen_root_shape();
}
else {

View file

@ -10,7 +10,7 @@ describe :rbasic, shared: true do
obj, _ = @data.call
initial = @specs.get_flags(obj)
obj.freeze
@specs.get_flags(obj).should == @freeze | initial
(@specs.get_flags(obj) & 0xFFFF).should == (@freeze | initial) & 0xFFFF
end
it "supports setting the FREEZE flag" do

View file

@ -887,6 +887,18 @@ CODE
end
end
class StringWithIVSet < String
def set_iv
@foo = 1
end
end
def test_ivar_set_after_frozen_dup
str = StringWithIVSet.new.freeze
str.dup.set_iv
assert_raise(FrozenError) { str.set_iv }
end
def test_each
verbose, $VERBOSE = $VERBOSE, nil