diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-09-25 14:06:32 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-09-25 16:00:13 +0900 |
commit | 96739c422206d55acab4aee917d9d965c27b6fff (patch) | |
tree | b8163686b8f90a1776deb778be37680ff84d9614 /bootstraptest | |
parent | 97416ae54cebe8bd4c77da5301b82509ec43aaf2 (diff) | |
download | ruby-96739c422206d55acab4aee917d9d965c27b6fff.tar.gz |
Frozen Struct can be shareable.
A frozen Struct object which refers to shareable objects should be
shareable.
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_ractor.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index f06513a784..5ed8f63958 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -427,6 +427,7 @@ assert_equal "ok", %q{ class C; end module M; end + S = Struct.new(:a, :b, :c, :d) shareable_objects = [ true, @@ -445,6 +446,8 @@ assert_equal "ok", %q{ [1, 2].freeze, # frozen Array which only refers to shareable {a: 1}.freeze, # frozen Hash which only refers to shareable [{a: 1}.freeze, 'str'.freeze].freeze, # nested frozen container + S.new(1, 2).freeze, # frozen Struct + S.new(1, 2, 3, 4).freeze, # frozen Struct C, # class M, # module Ractor.current, # Ractor @@ -454,6 +457,9 @@ assert_equal "ok", %q{ 'mutable str'.dup, [:array], {hash: true}, + S.new(1, 2), + S.new(1, 2, 3, 4), + S.new("a", 2).freeze, # frozen, but refers to an unshareable object ] results = [] |