Skip to content

Commit

Permalink
Add a test for postfix→prefix optimization
Browse files Browse the repository at this point in the history
Resolves rakudo/rakudo#1315. See rakudo/rakudo#1477 for further
discussion.
  • Loading branch information
AlexDaniel committed Feb 4, 2018
1 parent 8d03e9a commit 396a739
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion S06-operator-overloading/prefix.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 10;
plan 11;

{
sub prefix:<X> ($thing) { return "ROUGHLY$thing"; };
Expand Down Expand Up @@ -76,3 +76,13 @@ subtest 'coverage for crashes in certain operator setups' => {
# (MYMINUS 1 MYPLUS 2 MYPLUS 3)
# }, -6, '(2)';
}
# GH #1315
{
class A {}
my $x;
sub prefix:<++>(A) { $x = 'foo' }
sub postfix:<++>(A) { $x = 'bar' }
A++;
is $x, 'bar', 'static optimization (if exists) is not too early';
}

0 comments on commit 396a739

Please sign in to comment.