6 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
7 print "1..0 # Skip -- Perl configured without B module\n";
10 if (!$Config::Config{useperlio}) {
11 print "1..0 # Skip -- need perlio to walk the optree\n";
20 Code test snippets here are adapted from `perldoc -f map`
22 Due to a bleadperl optimization (Dave Mitchell, circa apr 04), the
23 (map|grep)(start|while) opcodes have different flags in 5.9, their
24 private flags /1, /2 are gone in blead (for the cases covered)
26 When the optree stuff was integrated into 5.8.6, these tests failed,
27 and were todo'd. They're now done, by version-specific tweaking in
28 mkCheckRex(), therefore the skip is removed too.
33 #examples poached from perldoc -f sort
35 NOTE: name is no longer a required arg for checkOptree, as label is
36 synthesized out of others. HOWEVER, if the test-code has newlines in
37 it, the label must be overridden by an explicit name.
39 This is because t/TEST is quite particular about the test output it
40 processes, and multi-line labels violate its 1-line-per-test
45 # chunk: # sort lexically
46 @articles = sort @files;
50 checkOptree(note => q{},
52 code => q{@articles = sort @files; },
53 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
54 # 1 <;> nextstate(main 545 (eval 15):1) v
58 # 5 <1> rv2av[t4] lK/1
61 # 8 <#> gv[*articles] s
62 # 9 <1> rv2av[t2] lKRM*/1
63 # a <2> aassign[t5] KS/COMMON
64 # b <1> leavesub[1 ref] K/REFC,1
66 # 1 <;> nextstate(main 545 (eval 15):1) v
70 # 5 <1> rv2av[t2] lK/1
73 # 8 <$> gv(*articles) s
74 # 9 <1> rv2av[t1] lKRM*/1
75 # a <2> aassign[t3] KS/COMMON
76 # b <1> leavesub[1 ref] K/REFC,1
82 # chunk: # same thing, but with explicit sort routine
83 @articles = sort {$a cmp $b} @files;
87 checkOptree(note => q{},
89 code => q{@articles = sort {$a cmp $b} @files; },
90 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
91 # 1 <;> nextstate(main 546 (eval 15):1) v
95 # 5 <1> rv2av[t7] lK/1
98 # 8 <#> gv[*articles] s
99 # 9 <1> rv2av[t2] lKRM*/1
100 # a <2> aassign[t3] KS/COMMON
101 # b <1> leavesub[1 ref] K/REFC,1
103 # 1 <;> nextstate(main 546 (eval 15):1) v
107 # 5 <1> rv2av[t3] lK/1
110 # 8 <$> gv(*articles) s
111 # 9 <1> rv2av[t1] lKRM*/1
112 # a <2> aassign[t2] KS/COMMON
113 # b <1> leavesub[1 ref] K/REFC,1
119 # chunk: # now case-insensitively
120 @articles = sort {uc($a) cmp uc($b)} @files;
124 checkOptree(note => q{},
126 code => q{@articles = sort {uc($a) cmp uc($b)} @files; },
127 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
128 # 1 <;> nextstate(main 546 (eval 15):1) v
132 # 5 <1> rv2av[t9] lK/1 < 5.019002
133 # 5 <1> rv2av[t9] lKM/1 >=5.019002
136 # 8 <#> gv[*articles] s
137 # 9 <1> rv2av[t2] lKRM*/1
138 # a <2> aassign[t10] KS/COMMON
139 # b <1> leavesub[1 ref] K/REFC,1
141 # 1 <;> nextstate(main 546 (eval 15):1) v
145 # 5 <1> rv2av[t5] lK/1 < 5.019002
146 # 5 <1> rv2av[t5] lKM/1 >=5.019002
149 # 8 <$> gv(*articles) s
150 # 9 <1> rv2av[t1] lKRM*/1
151 # a <2> aassign[t6] KS/COMMON
152 # b <1> leavesub[1 ref] K/REFC,1
158 # chunk: # same thing in reversed order
159 @articles = sort {$b cmp $a} @files;
163 checkOptree(note => q{},
165 code => q{@articles = sort {$b cmp $a} @files; },
166 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
167 # 1 <;> nextstate(main 546 (eval 15):1) v
171 # 5 <1> rv2av[t7] lK/1
174 # 8 <#> gv[*articles] s
175 # 9 <1> rv2av[t2] lKRM*/1
176 # a <2> aassign[t3] KS/COMMON
177 # b <1> leavesub[1 ref] K/REFC,1
179 # 1 <;> nextstate(main 546 (eval 15):1) v
183 # 5 <1> rv2av[t3] lK/1
186 # 8 <$> gv(*articles) s
187 # 9 <1> rv2av[t1] lKRM*/1
188 # a <2> aassign[t2] KS/COMMON
189 # b <1> leavesub[1 ref] K/REFC,1
195 # chunk: # sort numerically ascending
196 @articles = sort {$a <=> $b} @files;
200 checkOptree(note => q{},
202 code => q{@articles = sort {$a <=> $b} @files; },
203 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
204 # 1 <;> nextstate(main 546 (eval 15):1) v
208 # 5 <1> rv2av[t7] lK/1
211 # 8 <#> gv[*articles] s
212 # 9 <1> rv2av[t2] lKRM*/1
213 # a <2> aassign[t3] KS/COMMON
214 # b <1> leavesub[1 ref] K/REFC,1
216 # 1 <;> nextstate(main 546 (eval 15):1) v
220 # 5 <1> rv2av[t3] lK/1
223 # 8 <$> gv(*articles) s
224 # 9 <1> rv2av[t1] lKRM*/1
225 # a <2> aassign[t2] KS/COMMON
226 # b <1> leavesub[1 ref] K/REFC,1
232 # chunk: # sort numerically descending
233 @articles = sort {$b <=> $a} @files;
237 checkOptree(note => q{},
239 code => q{@articles = sort {$b <=> $a} @files; },
240 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
241 # 1 <;> nextstate(main 587 (eval 26):1) v
245 # 5 <1> rv2av[t7] lK/1
246 # 6 <@> sort lK/DESC,NUM
248 # 8 <#> gv[*articles] s
249 # 9 <1> rv2av[t2] lKRM*/1
250 # a <2> aassign[t3] KS/COMMON
251 # b <1> leavesub[1 ref] K/REFC,1
253 # 1 <;> nextstate(main 546 (eval 15):1) v
257 # 5 <1> rv2av[t3] lK/1
258 # 6 <@> sort lK/DESC,NUM
260 # 8 <$> gv(*articles) s
261 # 9 <1> rv2av[t1] lKRM*/1
262 # a <2> aassign[t2] KS/COMMON
263 # b <1> leavesub[1 ref] K/REFC,1
269 # chunk: # this sorts the %age hash by value instead of key
270 # using an in-line function
271 @eldest = sort { $age{$b} <=> $age{$a} } keys %age;
275 checkOptree(note => q{},
277 code => q{@eldest = sort { $age{$b} <=> $age{$a} } keys %age; },
278 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
279 # 1 <;> nextstate(main 592 (eval 28):1) v
283 # 5 <1> rv2hv[t9] lKRM/1
284 # 6 <1> keys[t10] lK/1 < 5.019002
285 # 6 <1> keys[t10] lKM/1 >=5.019002
288 # 9 <#> gv[*eldest] s
289 # a <1> rv2av[t2] lKRM*/1
290 # b <2> aassign[t11] KS/COMMON
291 # c <1> leavesub[1 ref] K/REFC,1
293 # 1 <;> nextstate(main 546 (eval 15):1) v
297 # 5 <1> rv2hv[t3] lKRM/1
298 # 6 <1> keys[t4] lK/1 < 5.019002
299 # 6 <1> keys[t4] lKM/1 >=5.019002
302 # 9 <$> gv(*eldest) s
303 # a <1> rv2av[t1] lKRM*/1
304 # b <2> aassign[t5] KS/COMMON
305 # c <1> leavesub[1 ref] K/REFC,1
311 # chunk: # sort using explicit subroutine name
313 $age{$a} <=> $age{$b}; # presuming numeric
315 @sortedclass = sort byage @class;
319 checkOptree(note => q{},
321 code => q{sub byage { $age{$a} <=> $age{$b}; } @sortedclass = sort byage @class; },
322 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
323 # 1 <;> nextstate(main 597 (eval 30):1) v
326 # 4 <$> const[PV "byage"] s/BARE
328 # 6 <1> rv2av[t4] lK/1 < 5.019002
329 # 6 <1> rv2av[t4] lKM/1 >=5.019002
332 # 9 <#> gv[*sortedclass] s
333 # a <1> rv2av[t2] lKRM*/1
334 # b <2> aassign[t5] KS/COMMON
335 # c <1> leavesub[1 ref] K/REFC,1
337 # 1 <;> nextstate(main 546 (eval 15):1) v
340 # 4 <$> const(PV "byage") s/BARE
342 # 6 <1> rv2av[t2] lK/1 < 5.019002
343 # 6 <1> rv2av[t2] lKM/1 >=5.019002
346 # 9 <$> gv(*sortedclass) s
347 # a <1> rv2av[t1] lKRM*/1
348 # b <2> aassign[t3] KS/COMMON
349 # c <1> leavesub[1 ref] K/REFC,1
355 # chunk: sub backwards { $b cmp $a }
356 @harry = qw(dog cat x Cain Abel);
357 @george = qw(gone chased yz Punished Axed);
359 # prints AbelCaincatdogx
360 print sort backwards @harry;
361 # prints xdogcatCainAbel
362 print sort @george, 'to', @harry;
363 # prints AbelAxedCainPunishedcatchaseddoggonetoxyz
367 checkOptree(name => q{sort USERSUB LIST },
369 code => q{sub backwards { $b cmp $a }
370 @harry = qw(dog cat x Cain Abel);
371 @george = qw(gone chased yz Punished Axed);
372 print sort @harry; print sort backwards @harry;
373 print sort @george, 'to', @harry; },
374 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
375 # 1 <;> nextstate(main 602 (eval 32):2) v
377 # 3 <$> const[PV "dog"] s
378 # 4 <$> const[PV "cat"] s
379 # 5 <$> const[PV "x"] s
380 # 6 <$> const[PV "Cain"] s
381 # 7 <$> const[PV "Abel"] s
384 # a <1> rv2av[t2] lKRM*/1
385 # b <2> aassign[t3] vKS
386 # c <;> nextstate(main 602 (eval 32):3) v
388 # e <$> const[PV "gone"] s
389 # f <$> const[PV "chased"] s
390 # g <$> const[PV "yz"] s
391 # h <$> const[PV "Punished"] s
392 # i <$> const[PV "Axed"] s
394 # k <#> gv[*george] s
395 # l <1> rv2av[t5] lKRM*/1
396 # m <2> aassign[t6] vKS
397 # n <;> nextstate(main 602 (eval 32):4) v:{
401 # r <1> rv2av[t8] lK/1
404 # u <;> nextstate(main 602 (eval 32):4) v:{
407 # x <$> const[PV "backwards"] s/BARE
409 # z <1> rv2av[t10] lK/1 < 5.019002
410 # z <1> rv2av[t10] lKM/1 >=5.019002
413 # 12 <;> nextstate(main 602 (eval 32):5) v:{
416 # 15 <#> gv[*george] s
417 # 16 <1> rv2av[t12] lK/1
418 # 17 <$> const[PV "to"] s
419 # 18 <#> gv[*harry] s
420 # 19 <1> rv2av[t14] lK/1
423 # 1c <1> leavesub[1 ref] K/REFC,1
425 # 1 <;> nextstate(main 602 (eval 32):2) v
427 # 3 <$> const(PV "dog") s
428 # 4 <$> const(PV "cat") s
429 # 5 <$> const(PV "x") s
430 # 6 <$> const(PV "Cain") s
431 # 7 <$> const(PV "Abel") s
434 # a <1> rv2av[t1] lKRM*/1
435 # b <2> aassign[t2] vKS
436 # c <;> nextstate(main 602 (eval 32):3) v
438 # e <$> const(PV "gone") s
439 # f <$> const(PV "chased") s
440 # g <$> const(PV "yz") s
441 # h <$> const(PV "Punished") s
442 # i <$> const(PV "Axed") s
444 # k <$> gv(*george) s
445 # l <1> rv2av[t3] lKRM*/1
446 # m <2> aassign[t4] vKS
447 # n <;> nextstate(main 602 (eval 32):4) v:{
451 # r <1> rv2av[t5] lK/1
454 # u <;> nextstate(main 602 (eval 32):4) v:{
457 # x <$> const(PV "backwards") s/BARE
459 # z <1> rv2av[t6] lK/1 < 5.019002
460 # z <1> rv2av[t6] lKM/1 >=5.019002
463 # 12 <;> nextstate(main 602 (eval 32):5) v:{
466 # 15 <$> gv(*george) s
467 # 16 <1> rv2av[t7] lK/1
468 # 17 <$> const(PV "to") s
469 # 18 <$> gv(*harry) s
470 # 19 <1> rv2av[t8] lK/1
473 # 1c <1> leavesub[1 ref] K/REFC,1
479 # chunk: # inefficiently sort by descending numeric compare using
480 # the first integer after the first = sign, or the
481 # whole record case-insensitively otherwise
483 $nums[$b] <=> $nums[$a]
484 || $caps[$a] cmp $caps[$b]
490 # chunk: # same thing, but without any temps
491 @new = map { $_->[0] }
492 sort { $b->[1] <=> $a->[1]
493 || $a->[2] cmp $b->[2]
494 } map { [$_, /=(\d+)/, uc($_)] } @old;
498 checkOptree(name => q{Compound sort/map Expression },
500 code => q{ @new = map { $_->[0] }
501 sort { $b->[1] <=> $a->[1] || $a->[2] cmp $b->[2] }
502 map { [$_, /=(\d+)/, uc($_)] } @old; },
503 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
504 # 1 <;> nextstate(main 609 (eval 34):3) v:{
510 # 7 <1> rv2av[t19] lKM/1
511 # 8 <@> mapstart lK* < 5.017002
512 # 8 <@> mapstart lK >=5.017002
513 # 9 <|> mapwhile(other->a)[t20] lK < 5.019002
514 # 9 <|> mapwhile(other->a)[t20] lKM >=5.019002
516 # b <;> nextstate(main 608 (eval 34):2) v:{
519 # e </> match(/"=(\\d+)"/) l/RTIME
522 # h <@> anonlist sK*/1
526 # k <@> mapstart lK* < 5.017002
527 # k <@> mapstart lK >=5.017002
528 # l <|> mapwhile(other->m)[t26] lK
530 # n <1> rv2sv sKM/DREFAV,1
531 # o <1> rv2av[t4] sKR/1
532 # p <$> const[IV 0] s
534 # - <@> scope lK < 5.017002
538 # t <1> rv2av[t2] lKRM*/1
539 # u <2> aassign[t27] KS/COMMON
540 # v <1> leavesub[1 ref] K/REFC,1
542 # 1 <;> nextstate(main 609 (eval 34):3) v:{
548 # 7 <1> rv2av[t10] lKM/1
549 # 8 <@> mapstart lK* < 5.017002
550 # 8 <@> mapstart lK >=5.017002
551 # 9 <|> mapwhile(other->a)[t11] lK < 5.019002
552 # 9 <|> mapwhile(other->a)[t11] lKM >=5.019002
554 # b <;> nextstate(main 608 (eval 34):2) v:{
557 # e </> match(/"=(\\d+)"/) l/RTIME
560 # h <@> anonlist sK*/1
564 # k <@> mapstart lK* < 5.017002
565 # k <@> mapstart lK >=5.017002
566 # l <|> mapwhile(other->m)[t12] lK
568 # n <1> rv2sv sKM/DREFAV,1
569 # o <1> rv2av[t2] sKR/1
570 # p <$> const(IV 0) s
572 # - <@> scope lK < 5.017002
576 # t <1> rv2av[t1] lKRM*/1
577 # u <2> aassign[t13] KS/COMMON
578 # v <1> leavesub[1 ref] K/REFC,1
584 # chunk: # using a prototype allows you to use any comparison subroutine
585 # as a sort subroutine (including other package's subroutines)
587 sub backwards ($$) { $_[1] cmp $_[0]; } # $a and $b are not set here
589 @new = sort other::backwards @old;
593 checkOptree(name => q{sort other::sub LIST },
595 code => q{package other; sub backwards ($$) { $_[1] cmp $_[0]; }
596 package main; @new = sort other::backwards @old; },
597 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
598 # 1 <;> nextstate(main 614 (eval 36):2) v:{
601 # 4 <$> const[PV "other::backwards"] s/BARE
603 # 6 <1> rv2av[t4] lK/1 < 5.019002
604 # 6 <1> rv2av[t4] lKM/1 >=5.019002
608 # a <1> rv2av[t2] lKRM*/1
609 # b <2> aassign[t5] KS/COMMON
610 # c <1> leavesub[1 ref] K/REFC,1
612 # 1 <;> nextstate(main 614 (eval 36):2) v:{
615 # 4 <$> const(PV "other::backwards") s/BARE
617 # 6 <1> rv2av[t2] lK/1 < 5.019002
618 # 6 <1> rv2av[t2] lKM/1 >=5.019002
622 # a <1> rv2av[t1] lKRM*/1
623 # b <2> aassign[t3] KS/COMMON
624 # c <1> leavesub[1 ref] K/REFC,1
630 # chunk: # repeat, condensed. $main::a and $b are unaffected
631 sub other::backwards ($$) { $_[1] cmp $_[0]; }
632 @new = sort other::backwards @old;
636 checkOptree(note => q{},
638 code => q{sub other::backwards ($$) { $_[1] cmp $_[0]; } @new = sort other::backwards @old; },
639 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
640 # 1 <;> nextstate(main 619 (eval 38):1) v
643 # 4 <$> const[PV "other::backwards"] s/BARE
645 # 6 <1> rv2av[t4] lK/1 < 5.019002
646 # 6 <1> rv2av[t4] lKM/1 >=5.019002
650 # a <1> rv2av[t2] lKRM*/1
651 # b <2> aassign[t5] KS/COMMON
652 # c <1> leavesub[1 ref] K/REFC,1
654 # 1 <;> nextstate(main 546 (eval 15):1) v
657 # 4 <$> const(PV "other::backwards") s/BARE
659 # 6 <1> rv2av[t2] lK/1 < 5.019002
660 # 6 <1> rv2av[t2] lKM/1 >=5.019002
664 # a <1> rv2av[t1] lKRM*/1
665 # b <2> aassign[t3] KS/COMMON
666 # c <1> leavesub[1 ref] K/REFC,1
672 # chunk: # guarantee stability, regardless of algorithm
674 @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
678 my ($expect, $expect_nt) = (<<'EOT_EOT', <<'EONT_EONT');
679 # 1 <;> nextstate(main 656 (eval 40):1) v:%,{
683 # 5 <1> rv2av[t9] lK/1 < 5.019002
684 # 5 <1> rv2av[t9] lKM/1 >=5.019002
685 # 6 <@> sort lKS*/STABLE
688 # 9 <1> rv2av[t2] lKRM*/1
689 # a <2> aassign[t14] KS/COMMON
690 # b <1> leavesub[1 ref] K/REFC,1
692 # 1 <;> nextstate(main 578 (eval 15):1) v:%,{
696 # 5 <1> rv2av[t5] lK/1 < 5.019002
697 # 5 <1> rv2av[t5] lKM/1 >=5.019002
698 # 6 <@> sort lKS*/STABLE
701 # 9 <1> rv2av[t1] lKRM*/1
702 # a <2> aassign[t6] KS/COMMON
703 # b <1> leavesub[1 ref] K/REFC,1
707 checkOptree(note => q{},
709 code => q{use sort 'stable'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; },
710 expect => $expect, expect_nt => $expect_nt);
714 # chunk: # force use of mergesort (not portable outside Perl 5.8)
715 use sort '_mergesort';
716 @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
720 checkOptree(note => q{},
722 code => q{use sort '_mergesort'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; },
723 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
724 # 1 <;> nextstate(main 662 (eval 42):1) v:%,{
728 # 5 <1> rv2av[t9] lK/1 < 5.019002
729 # 5 <1> rv2av[t9] lKM/1 >=5.019002
733 # 9 <1> rv2av[t2] lKRM*/1
734 # a <2> aassign[t14] KS/COMMON
735 # b <1> leavesub[1 ref] K/REFC,1
737 # 1 <;> nextstate(main 578 (eval 15):1) v:%,{
741 # 5 <1> rv2av[t5] lK/1 < 5.019002
742 # 5 <1> rv2av[t5] lKM/1 >=5.019002
746 # 9 <1> rv2av[t1] lKRM*/1
747 # a <2> aassign[t6] KS/COMMON
748 # b <1> leavesub[1 ref] K/REFC,1
754 # chunk: # you should have a good reason to do this!
755 @articles = sort {$FooPack::b <=> $FooPack::a} @files;
759 checkOptree(note => q{},
761 code => q{@articles = sort {$FooPack::b <=> $FooPack::a} @files; },
762 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
763 # 1 <;> nextstate(main 667 (eval 44):1) v
767 # 5 <1> rv2av[t7] lK/1 < 5.019002
768 # 5 <1> rv2av[t7] lKM/1 >=5.019002
771 # 8 <#> gv[*articles] s
772 # 9 <1> rv2av[t2] lKRM*/1
773 # a <2> aassign[t8] KS/COMMON
774 # b <1> leavesub[1 ref] K/REFC,1
776 # 1 <;> nextstate(main 546 (eval 15):1) v
780 # 5 <1> rv2av[t3] lK/1 < 5.019002
781 # 5 <1> rv2av[t3] lKM/1 >=5.019002
784 # 8 <$> gv(*articles) s
785 # 9 <1> rv2av[t1] lKRM*/1
786 # a <2> aassign[t4] KS/COMMON
787 # b <1> leavesub[1 ref] K/REFC,1
794 @result = sort { $a <=> $b } grep { $_ == $_ } @input;
798 checkOptree(note => q{},
800 code => q{@result = sort { $a <=> $b } grep { $_ == $_ } @input; },
801 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
802 # 1 <;> nextstate(main 673 (eval 46):1) v
807 # 6 <1> rv2av[t9] lKM/1
808 # 7 <@> grepstart lK* < 5.017002
809 # 7 <@> grepstart lK >=5.017002
810 # 8 <|> grepwhile(other->9)[t10] lK
814 # - <@> scope sK < 5.017002
818 # e <#> gv[*result] s
819 # f <1> rv2av[t2] lKRM*/1
820 # g <2> aassign[t3] KS/COMMON
821 # h <1> leavesub[1 ref] K/REFC,1
823 # 1 <;> nextstate(main 547 (eval 15):1) v
828 # 6 <1> rv2av[t3] lKM/1
829 # 7 <@> grepstart lK* < 5.017002
830 # 7 <@> grepstart lK >=5.017002
831 # 8 <|> grepwhile(other->9)[t4] lK
835 # - <@> scope sK < 5.017002
839 # e <$> gv(*result) s
840 # f <1> rv2av[t1] lKRM*/1
841 # g <2> aassign[t2] KS/COMMON
842 # h <1> leavesub[1 ref] K/REFC,1
848 # chunk: # void return context sort
849 sort { $a <=> $b } @input;
853 checkOptree(note => q{},
855 code => q{sort { $a <=> $b } @input; },
856 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
857 # 1 <;> nextstate(main 678 (eval 48):1) v
860 # 4 <1> rv2av[t5] lK/1
862 # 6 <1> leavesub[1 ref] K/REFC,1
864 # 1 <;> nextstate(main 546 (eval 15):1) v
867 # 4 <1> rv2av[t2] lK/1
869 # 6 <1> leavesub[1 ref] K/REFC,1
875 # chunk: # more void context, propagating ?
876 sort { $a <=> $b } grep { $_ == $_ } @input;
880 checkOptree(note => q{},
882 code => q{sort { $a <=> $b } grep { $_ == $_ } @input; },
883 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
884 # 1 <;> nextstate(main 684 (eval 50):1) v
888 # 5 <1> rv2av[t7] lKM/1
889 # 6 <@> grepstart lK* < 5.017002
890 # 6 <@> grepstart lK >=5.017002
891 # 7 <|> grepwhile(other->8)[t8] lK
895 # - <@> scope sK < 5.017002
898 # c <1> leavesub[1 ref] K/REFC,1
900 # 1 <;> nextstate(main 547 (eval 15):1) v
904 # 5 <1> rv2av[t2] lKM/1
905 # 6 <@> grepstart lK* < 5.017002
906 # 6 <@> grepstart lK >=5.017002
907 # 7 <|> grepwhile(other->8)[t3] lK
911 # - <@> scope sK < 5.017002
914 # c <1> leavesub[1 ref] K/REFC,1
920 # chunk: # scalar return context sort
921 $s = sort { $a <=> $b } @input;
925 checkOptree(note => q{},
927 code => q{$s = sort { $a <=> $b } @input; },
928 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
929 # 1 <;> nextstate(main 689 (eval 52):1) v:{
932 # 4 <1> rv2av[t6] lK/1
935 # 7 <2> sassign sKS/2
936 # 8 <1> leavesub[1 ref] K/REFC,1
938 # 1 <;> nextstate(main 546 (eval 15):1) v:{
941 # 4 <1> rv2av[t2] lK/1
944 # 7 <2> sassign sKS/2
945 # 8 <1> leavesub[1 ref] K/REFC,1
951 # chunk: $s = sort { $a <=> $b } grep { $_ == $_ } @input;
955 checkOptree(note => q{},
957 code => q{$s = sort { $a <=> $b } grep { $_ == $_ } @input; },
958 expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
959 # 1 <;> nextstate(main 695 (eval 54):1) v:{
963 # 5 <1> rv2av[t8] lKM/1
964 # 6 <@> grepstart lK* < 5.017002
965 # 6 <@> grepstart lK >=5.017002
966 # 7 <|> grepwhile(other->8)[t9] lK
970 # - <@> scope sK < 5.017002
974 # d <2> sassign sKS/2
975 # e <1> leavesub[1 ref] K/REFC,1
977 # 1 <;> nextstate(main 547 (eval 15):1) v:{
981 # 5 <1> rv2av[t2] lKM/1
982 # 6 <@> grepstart lK* < 5.017002
983 # 6 <@> grepstart lK >=5.017002
984 # 7 <|> grepwhile(other->8)[t3] lK
988 # - <@> scope sK < 5.017002
992 # d <2> sassign sKS/2
993 # e <1> leavesub[1 ref] K/REFC,1