Skip to content
Permalink
Browse files

Die on Associative <<op>> Iterable

This can never work due to the random order of keys in the Associative.
This used to die before, but with a very LTA error about a Pair.new()
not finding a suitable candidate.
  • Loading branch information...
lizmat committed Nov 3, 2018
1 parent bb43acd commit 1b7253dfc62975090bfe35fde918f336c27d5353
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/core/metaops.pm6
@@ -549,6 +549,10 @@ multi sub HYPER(&op, Associative:D \left, Associative:D \right, :$dwim-left, :$d
nqp::iscont(left) ?? result.item !! result;
}

multi sub HYPER(&op, Associative:D \left, Iterable:D \right, :$dwim-left, :$dwim-right) {
die "{left.^name} {&op.name} {right.^name} can never work reliably:
the order of keys in {left.^name} is indeterminate"
}
multi sub HYPER(&op, Associative:D \left, \right, :$dwim-left, :$dwim-right) {
my @keys = left.keys;
my \result := left.WHAT.new.STORE(
@@ -558,6 +562,10 @@ multi sub HYPER(&op, Associative:D \left, \right, :$dwim-left, :$dwim-right) {
nqp::iscont(left) ?? result.item !! result;
}

multi sub HYPER(&op, Iterable:D \left, Associative:D \right, :$dwim-left, :$dwim-right) {
die "{left.^name} {&op.name} {right.^name} can never work reliably:
the order of keys in {right.^name} is indeterminate"
}
multi sub HYPER(&op, \left, Associative:D \right, :$dwim-left, :$dwim-right) {
my @keys = right.keys;
my \result := right.WHAT.new.STORE(

0 comments on commit 1b7253d

Please sign in to comment.
You can’t perform that action at this time.