Skip to content

Commit

Permalink
Correct bad state expectation
Browse files Browse the repository at this point in the history
Due to a compiler bug, the closure here was not being cloned by its
outer scope. This caused various nasty thread safety bugs, and has now
been rectified. However, this test depended on the buggy behavior.
  • Loading branch information
jnthn authored and AlexDaniel committed Sep 11, 2017
1 parent 592a8d8 commit c554b68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions S04-declarations/state.t
Expand Up @@ -134,14 +134,14 @@ plan 41;
#?DOES 1
{
my $str = "abc";

my $re = {
$str ~~ s:Perl5/^(.)/{ state $++; }/;
state $a = 0;
$str ~~ s:Perl5/^(.)/{ $a++ }/;
};
$re();
$re();
$re();
is $str, "2bc", "state() inside regular expressions works";
is $str, "2bc", "state() variable referenced from regex replacement part works";
}

# state() inside subs, chained declaration
Expand Down

0 comments on commit c554b68

Please sign in to comment.