Skip to content

Commit

Permalink
Make Blob concatenation always return the left-hand type
Browse files Browse the repository at this point in the history
Looking back at the history, this goes back until at least 2013 when
it was implemented as returning Buf if the types didn't match.

Other Blob related infixes return the type of the left-hand side,
so it makes sense to do this for concatentation as well.

In response to #5071
  • Loading branch information
lizmat committed Oct 6, 2022
1 parent 30a9d3a commit 02a28de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.c/Buf.pm6
Expand Up @@ -1423,7 +1423,7 @@ multi sub prefix:<~>(Blob:D \a) {

multi sub infix:<~>(Blob:D $a) { $a }
multi sub infix:<~>(Blob:D $a, Blob:D $b) {
my $res := nqp::create(nqp::eqaddr($a.WHAT,$b.WHAT) ?? $a !! Buf.^pun);
my $res := nqp::create($a);
my $adc := nqp::decont($a);
my $bdc := nqp::decont($b);
my int $alen = nqp::elems($adc);
Expand Down

0 comments on commit 02a28de

Please sign in to comment.