Permalink
Browse files

Update KeyBag.new-from-pairs so that it doesn't issue warnings.

  • Loading branch information...
1 parent b15a162 commit 6314dd4b2316541965b32524eb40b06d8ceee22d @colomon colomon committed Jun 9, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/CORE.setting
View
@@ -2474,7 +2474,8 @@ class KeyBag does Associative does Baggy {
method new-from-pairs(@pairs --> Bag) {
my %e;
for @pairs {
- $_ ~~ Pair ?? %e{.key} += .value !! %e{$_}++;
+ when Pair { %e{.key} = .value + (%e{.key} // 0); }
+ %e{$_}++;
}
for %e -> $p {
die "Negative values are not allowed in KeyBags" if $p.value < 0;

0 comments on commit 6314dd4

Please sign in to comment.