# New Ticket Created by Rob Hoelz
# Please include the string: [perl #120704]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=120704 >
There's a bug such that the following doesn't work as expected:
my $value = @!values[0] = @!values.pop;
-Rob
use v6;
use Test;
plan 1;
class BinaryHeap {
has @!values = (84, 85);
method push($value) {
fail 'I should never be called!';
# commenting this line out fixes the problem (note how this method is
never called?!?!)
@!values[0] = 1;
}
method pop {
my $result = @!values[0];
if @!values == 1 {
@!values.pop;
} else {
# changing this line...
my $value = @!values[0] = @!values.pop;
# ...to this fixes the problem
#my $value = @!values.pop;
#@!values[0] = $value;
is $value, @!values[0], '$value and @!values[0] should be equal';
}
$result
}
}
my BinaryHeap $heap .= new;
$heap.pop;
$heap.pop;