Skip to content
Permalink
Browse files

Oops, forgot to check on types in MixHash.AT-KEY

Found thanks to the power of tests!
  • Loading branch information...
lizmat committed Jan 15, 2019
1 parent bdc63f0 commit 87b71c2758df5a7f58be388abaa8353d2f0d59f4
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/core/MixHash.pm6
@@ -30,6 +30,7 @@ my class MixHash does Mixy {
)
}
multi method AT-KEY(MixHash:D: \k) is raw {
my \type := self.keyof;
Proxy.new(
FETCH => {
nqp::if(
@@ -61,16 +62,18 @@ my class MixHash does Mixy {
),
nqp::unless(
$value == 0,
nqp::bindkey($!elems,$which,Pair.new(k,nqp::decont($value)))
Rakudo::QuantHash.BIND-TO-TYPED-BAG(
$!elems, $which, k, nqp::decont($value), type
)
)
),
nqp::unless( # no hash allocated yet
$value == 0,
nqp::bindkey(
Rakudo::QuantHash.BIND-TO-TYPED-BAG(
nqp::bindattr(self,::?CLASS,'$!elems',
nqp::create(Rakudo::Internals::IterationSet)),
k.WHICH,
Pair.new(k,nqp::decont($value))
nqp::create(Rakudo::Internals::IterationSet)
),
k.WHICH, k, nqp::decont($value), type
)
)
)

0 comments on commit 87b71c2

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