Skip to content

Commit

Permalink
Update KeyBag.new-from-pairs so that it doesn't issue warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Jun 9, 2013
1 parent b15a162 commit 6314dd4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/CORE.setting
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6314dd4

Please sign in to comment.