On Mon, 20 Feb 2017 16:28:54 -0800, c...@zoffix.com wrote:
> 00:27   IOninja m: sub {CHECK return; class :: { 5000; 42 } }()
> 00:27   camelia rakudo-moar 80e0bc: OUTPUT: «===SORRY!===␤Attempt to
> return outside of any Routine␤»

This one has been corrected to report that the problem was in a CHECK block and 
to include a line number (same kind of reporting already in place for BEGIN 
blocks and other compile-time evaluations; CHECK somehow got left out).

$ ./perl6-m -e 'sub {CHECK return;}'===SORRY!=== Error while compiling -e
An exception occurred while evaluating a CHECK
at -e:1
Exception details:
  Attempt to return outside of any Routine
    in code  at -e line 1

> 00:27   IOninja m: sub {INIT return; class :: { 5000; 42 } }()
> 00:27   camelia rakudo-moar 80e0bc: OUTPUT: «(signal SEGV)WARNINGS for
> <tmp>:␤Useless use of constant integer 42 in sink context (line
> 1)␤Useless use of constant integer 5000 in sink context (line 1)␤»

This one no longer SEGVs, and instead complains about the return:

$ ./perl6-m -e 'sub {INIT return; class :: { 5000; 42 } }()'
WARNINGS for -e:
Useless use of constant integer 42 in sink context (line 1)
Useless use of constant integer 5000 in sink context (line 1)
Attempt to return outside of any Routine
  in block <unit> at -e line 1

Tests added to S04-statements/return.t.

Reply via email to