|
2 | 2 |
|
3 | 3 | use Test;
|
4 | 4 |
|
5 |
| -plan 43; |
| 5 | +plan 40; |
6 | 6 |
|
7 | 7 | # L<S04/The Relationship of Blocks and Declarations/There is a new state declarator that introduces>
|
8 | 8 |
|
@@ -114,50 +114,14 @@ plan 43;
|
114 | 114 | is $rhs_calls, 1, 'RHS of state $x = ... only called once';
|
115 | 115 | }
|
116 | 116 |
|
117 |
| -# Return of a reference to a state() var |
118 |
| -#?rakudo skip 'references' |
119 |
| -#?DOES 1 |
120 |
| -{ |
121 |
| - my $gen = { |
122 |
| - state $svar = 42; |
123 |
| - \$svar; |
124 |
| - }; |
125 |
| - |
126 |
| - my $svar_ref = $gen(); |
127 |
| - $$svar_ref++; $$svar_ref++; |
128 |
| - |
129 |
| - $svar_ref = $gen(); |
130 |
| - #?pugs todo "state bug" |
131 |
| - is $$svar_ref, 44, "reference to a state() var"; |
132 |
| -} |
133 |
| - |
134 |
| -# Anonymous state vars |
135 |
| -# L<http://groups.google.de/group/perl.perl6.language/msg/07aefb88f5fc8429> |
136 |
| -# fudged a bit on syntax |
137 |
| -#?pugs todo 'anonymous state vars' |
138 |
| -#?rakudo todo 'references and anonymous state vars' |
139 |
| -#?DOES 1 |
140 |
| -{ |
141 |
| - my $gen = sub { \(state $ ) }; |
142 |
| - |
143 |
| - my $svar_ref = $gen(); # $svar == 0 |
144 |
| - try { $$svar_ref++; $$svar_ref++ }; # $svar == 2 |
145 |
| - |
146 |
| - $svar_ref = $gen(); # $svar == 2 |
147 |
| - is try { $$svar_ref }, 2, "anonymous state() vars"; |
148 |
| -} |
149 |
| - |
150 |
| -#?rakudo todo 'nom regression' |
151 |
| -eval_lives_ok 'if 0 { \(state $) }', '$) not misinterpreted in capterm'; |
152 |
| - |
153 | 117 | # L<http://www.nntp.perl.org/group/perl.perl6.language/20888>
|
154 | 118 | # ("Re: Declaration and definition of state() vars" from Larry)
|
155 | 119 | #?pugs eval 'Parse error'
|
156 | 120 | {
|
157 | 121 | my ($a, $b);
|
158 | 122 | my $gen = {
|
159 | 123 | (state $svar) = 42;
|
160 |
| - my $ret = { $svar++ }; |
| 124 | + -> { $svar++ }; |
161 | 125 | };
|
162 | 126 |
|
163 | 127 | $a = $gen(); # $svar == 42
|
|
0 commit comments