Skip to content

Commit c554b68

Browse files
jnthnAlexDaniel
authored andcommitted
Correct bad state expectation
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.
1 parent 592a8d8 commit c554b68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

S04-declarations/state.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,14 @@ plan 41;
134134
#?DOES 1
135135
{
136136
my $str = "abc";
137-
138137
my $re = {
139-
$str ~~ s:Perl5/^(.)/{ state $++; }/;
138+
state $a = 0;
139+
$str ~~ s:Perl5/^(.)/{ $a++ }/;
140140
};
141141
$re();
142142
$re();
143143
$re();
144-
is $str, "2bc", "state() inside regular expressions works";
144+
is $str, "2bc", "state() variable referenced from regex replacement part works";
145145
}
146146

147147
# state() inside subs, chained declaration

0 commit comments

Comments
 (0)