diff --git a/S02-types/bag.t b/S02-types/bag.t
index 6792f60e77..32febf8326 100644
--- a/S02-types/bag.t
+++ b/S02-types/bag.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 237;
+plan 242;
sub showkv($x) {
$x.keys.sort.map({ $^k ~ ':' ~ $x{$k} }).join(' ')
@@ -582,4 +582,13 @@ subtest '.hash does not cause keys to be stringified' => {
# R#2289
is-deeply (1,2,3).Bag.ACCEPTS( ().Bag ), False, 'can we smartmatch empty';
+{
+ my $bag = .Bag;
+ is-deeply $bag.Set, .Set, 'coerce Bag -> Set';
+ is-deeply $bag.SetHash, .SetHash, 'coerce Bag -> SetHash';
+ is-deeply $bag.BagHash, .BagHash, 'coerce Bag -> BagHash';
+ is-deeply $bag.Mix, .Mix, 'coerce Bag -> Mix';
+ is-deeply $bag.MixHash, .MixHash, 'coerce Bag -> MixHash';
+}
+
# vim: ft=perl6
diff --git a/S02-types/baghash.t b/S02-types/baghash.t
index 9fa9d058c5..63065bcb63 100644
--- a/S02-types/baghash.t
+++ b/S02-types/baghash.t
@@ -3,7 +3,7 @@ use Test;
use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers';
use Test::Util;
-plan 308;
+plan 313;
# L
@@ -730,4 +730,13 @@ is-deeply ('foo' => 10000000000000000000).BagHash.grab(1), ('foo',),
# R#2289
is-deeply (1,2,3).BagHash.ACCEPTS(().BagHash), False, 'can we smartmatch empty';
+{
+ my $bag = .BagHash;
+ is-deeply $bag.Set, .Set, 'coerce BagHash -> Set';
+ is-deeply $bag.SetHash, .SetHash, 'coerce BagHash -> SetHash';
+ is-deeply $bag.Bag, .Bag, 'coerce BagHash -> Bag';
+ is-deeply $bag.Mix, .Mix, 'coerce BagHash -> Mix';
+ is-deeply $bag.MixHash, .MixHash, 'coerce BagHash -> MixHash';
+}
+
# vim: ft=perl6
diff --git a/S02-types/mix.t b/S02-types/mix.t
index 9f29deda8a..8387dc9b39 100644
--- a/S02-types/mix.t
+++ b/S02-types/mix.t
@@ -3,7 +3,7 @@ use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
-plan 227;
+plan 232;
sub showkv($x) {
$x.keys.sort.map({ $^k ~ ':' ~ $x{$k} }).join(' ')
@@ -544,4 +544,13 @@ subtest '.hash does not cause keys to be stringified' => {
# R#2289
is-deeply (1,2,3).Mix.ACCEPTS(().Mix), False, 'can we smartmatch empty';
+{
+ my $mix = .Mix;
+ is-deeply $mix.Set, .Set, 'coerce Mix -> Set';
+ is-deeply $mix.SetHash, .SetHash, 'coerce Mix -> SetHash';
+ is-deeply $mix.Bag, .Bag, 'coerce Mix -> Bag';
+ is-deeply $mix.BagHash, .BagHash, 'coerce Mix -> BagHash';
+ is-deeply $mix.MixHash, .MixHash, 'coerce Mix -> MixHash';
+}
+
# vim: ft=perl6
diff --git a/S02-types/mixhash.t b/S02-types/mixhash.t
index 62166fc71d..54d4bb93ff 100644
--- a/S02-types/mixhash.t
+++ b/S02-types/mixhash.t
@@ -3,7 +3,7 @@ use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
use Test;
-plan 274;
+plan 279;
# L
@@ -635,4 +635,13 @@ subtest "elements with negative weights are allowed in MixHashes" => {
# R#2289
is-deeply (1,2,3).MixHash.ACCEPTS(().MixHash), False, 'can we smartmatch empty';
+{
+ my $mix = .MixHash;
+ is-deeply $mix.Set, .Set, 'coerce MixHash -> Set';
+ is-deeply $mix.SetHash, .SetHash, 'coerce MixHash -> SetHash';
+ is-deeply $mix.Bag, .Bag, 'coerce MixHash -> Bag';
+ is-deeply $mix.BagHash, .BagHash, 'coerce MixHash -> BagHash';
+ is-deeply $mix.Mix, .Mix, 'coerce MixHash -> Mix';
+}
+
# vim: ft=perl6
diff --git a/S02-types/set.t b/S02-types/set.t
index 16778bb85f..1c0e594651 100644
--- a/S02-types/set.t
+++ b/S02-types/set.t
@@ -3,7 +3,7 @@ use Test;
use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers';
use Test::Util;
-plan 229;
+plan 234;
sub showset($s) { $s.keys.sort.join(' ') }
@@ -580,4 +580,13 @@ is +set(.3e0, .1e0+.2e0, 1e0, 1e0+4e-15), 4,
# R#2289
is-deeply (1,2,3).Set.ACCEPTS(().Set), False, 'can we smartmatch empty';
+{
+ my $set = .Set;
+ is-deeply $set.SetHash, .SetHash, 'coerce Set -> SetHash';
+ is-deeply $set.Bag, .Bag, 'coerce Set -> Bag';
+ is-deeply $set.BagHash, .BagHash, 'coerce Set -> BagHash';
+ is-deeply $set.Mix, .Mix, 'coerce Set -> Mix';
+ is-deeply $set.MixHash, .MixHash, 'coerce Set -> MixHash';
+}
+
# vim: ft=perl6
diff --git a/S02-types/sethash.t b/S02-types/sethash.t
index 15c7bdab57..024acf50ce 100644
--- a/S02-types/sethash.t
+++ b/S02-types/sethash.t
@@ -3,7 +3,7 @@ use Test;
use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers';
use Test::Util;
-plan 262;
+plan 267;
# L
@@ -661,4 +661,13 @@ subtest "elements with negative weights are allowed in SetHashes" => {
# R#2289
is-deeply (1,2,3).SetHash.ACCEPTS(().SetHash), False, 'can we smartmatch empty';
+{
+ my $set = .SetHash;
+ is-deeply $set.Set, .Set, 'coerce SetHash -> Set';
+ is-deeply $set.Bag, .Bag, 'coerce SetHash -> Bag';
+ is-deeply $set.BagHash, .BagHash, 'coerce SetHash -> BagHash';
+ is-deeply $set.Mix, .Mix, 'coerce SetHash -> Mix';
+ is-deeply $set.MixHash, .MixHash, 'coerce SetHash -> MixHash';
+}
+
# vim: ft=perl6