-
-
Save zoffixznet/25015bc476e076d0ebf60bd20b47b314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Rakudo/Internals.pm b/src/core/Rakudo/Internals.pm | |
index 5e5f940..6da8951 100644 | |
--- a/src/core/Rakudo/Internals.pm | |
+++ b/src/core/Rakudo/Internals.pm | |
@@ -1481,11 +1481,6 @@ my class Rakudo::Internals { | |
proto method coremap(|) {*} | |
- multi method coremap(\op, Associative \h, Bool :$deep) { | |
- my @keys = h.keys; | |
- hash @keys Z self.coremap(op, h{@keys}, :$deep) | |
- } | |
- | |
multi method coremap(\op, \obj, Bool :$deep) { | |
my \iterable = obj.DEFINITE && nqp::istype(obj, Iterable) | |
?? obj | |
diff --git a/src/core/metaops.pm b/src/core/metaops.pm | |
index f50dd12..a00765b 100644 | |
--- a/src/core/metaops.pm | |
+++ b/src/core/metaops.pm | |
@@ -649,11 +649,6 @@ multi sub deepmap(\op, \obj) { | |
Rakudo::Internals.coremap(op, obj, :deep) | |
} | |
-multi sub deepmap(\op, Associative \h) { | |
- my @keys = h.keys; | |
- hash @keys Z deepmap(op, h{@keys}) | |
-} | |
- | |
proto sub nodemap(|) {*} | |
multi sub nodemap(\op, \obj) { | |
my Mu $rpa := nqp::create(IterationBuffer); | |
@@ -692,19 +687,9 @@ multi sub nodemap(\op, \obj) { | |
nqp::p6bindattrinvres(nqp::create(List), List, '$!reified', $rpa) | |
} | |
-multi sub nodemap(\op, Associative \h) { | |
- my @keys = h.keys; | |
- hash @keys Z nodemap(op, h{@keys}) | |
-} | |
- | |
proto sub duckmap(|) {*} | |
multi sub duckmap(\op, \obj) { | |
Rakudo::Internals.coremap(sub (\arg) { CATCH { return arg ~~ Iterable:D ?? duckmap(op,arg) !! arg }; op.(arg); }, obj); | |
} | |
-multi sub duckmap(\op, Associative \h) { | |
- my @keys = h.keys; | |
- hash @keys Z duckmap(op, h{@keys}) | |
-} | |
- | |
# vim: ft=perl6 expandtab sw=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/S32-list/deepmap.t b/S32-list/deepmap.t | |
index e49667a..5dc4489 100644 | |
--- a/S32-list/deepmap.t | |
+++ b/S32-list/deepmap.t | |
@@ -2,7 +2,7 @@ use v6; | |
use Test; | |
-plan 8; | |
+plan 9; | |
=begin description | |
@@ -14,7 +14,7 @@ This test tests C<deepmap>. | |
is-deeply deepmap({ $_ + 1}, (1, 2, 3)), (2, 3, 4), "deepmap works"; | |
is-deeply deepmap(* + 1, (1, 2, (3, (4)))), (2, 3, (4, (5))), "deepmap descends into sublists"; | |
is-deeply deepmap(* + 1, (1, 2, (), (3, ()))), (2, 3, (), (4, ())), "deepmap copes with empty lists"; | |
- is-deeply deepmap(* ~ "_", {a => "a", b => "b"}), {a => "a_", b => "b_"}, "deepmap descends into hashes"; | |
+ is-deeply deepmap(*.value.uc, {a => "a", b => "b"}), {a => "a_", b => "b_"}, "deepmap descends into hashes"; | |
my $list = ("a", ("bb", "ccc"), "dddd"); | |
is-deeply deepmap({.chars}, $list), (1, (2, 3), 4), "deepmap applies correctly"; | |
@@ -31,4 +31,17 @@ This test tests C<deepmap>. | |
lives-ok { Array».gist; deepmap *.self, Array }, | |
'hypering or deepmapping an Iterable type object does not hang'; | |
+subtest '[node|duck|deep]maps do not break Pairs' => { | |
+ plan 4; | |
+ for &deepmap, &nodemap, &duckmap -> &xxxmap { | |
+ is-deeply gather { xxxmap {.take}, :foo{:80ber}.Pair }, | |
+ (:foo({:ber(80)}),).Seq, &xxxmap.name; | |
+ } | |
+ | |
+ # hyper uses deepmap/nodemap under the hood on some implementations | |
+ is-deeply gather { %(:42foo, :bar{:_{:_{:40meows}}})».take }, | |
+ (:foo(42), :bar({:_(${:_(${:meows(40)})})})).Seq, | |
+ 'hypered .take'; | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment