As a status update: All code snippet in this ticket die now with X::Syntax::Malformed and complain about 'Malformed my' during compilation (I think, it was fixed with rakudo commit e1e03e6ed5):
$ perl6-m -e 'my Str where "foo" $test' ===SORRY!=== Error while compiling -e Malformed my at -e:1 ------> my Str⏏ where "foo" $test $ perl6-m -e 'my str where "foo" $test' ===SORRY!=== Error while compiling -e Malformed my at -e:1 ------> my str⏏ where "foo" $test $ perl6-m -e 'my Int' ===SORRY!=== Error while compiling -e Malformed my at -e:1 ------> my Int⏏<EOL> A while ago I opened a PR (https://github.com/rakudo/rakudo/pull/565) related to this ticket. I added some code in order to detect misplaced where clauses, etc. But that PR was not merged (probably my patch was a bit over-engineered). It looks like my branch is not mergeable anymore -- maybe I should close it.