This Null PMC Access error does not occur any longer. Also the SixModelObject
error is gone. (Output of following commands is identical for Moar, Parrot and
JVM.)
$ perl6 -e '$_ = 1; for ^2 -> $p { when $p { say "matched"; $_.say } }'
matched
1
$ perl6-m -e '$_ = 42; for 1 -> $p { if 1 { .say } }'
42
$ perl6 -e 'for 12 -> $a { if 1 { say $_.WHAT } }'
Nil
I extended the existing tests in S02-magicals/dollar-underscore.t a bit with
the following commit: https://github.com/perl6/roast/commit/0e579ae7c7
I'm closing this ticket now.