Skip to content

Commit

Permalink
Oops, forgot to check on types in MixHash.AT-KEY
Browse files Browse the repository at this point in the history
Found thanks to the power of tests!
  • Loading branch information
lizmat committed Jan 15, 2019
1 parent bdc63f0 commit 87b71c2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core/MixHash.pm6
Expand Up @@ -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(
Expand Down Expand Up @@ -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
)
)
)
Expand Down

0 comments on commit 87b71c2

Please sign in to comment.