@@ -4,7 +4,7 @@ use lib $?FILE.IO.parent(2).add("packages");
4
4
use Test ;
5
5
use Test ::Util;
6
6
7
- plan 24 ;
7
+ plan 26 ;
8
8
9
9
# Is there a better reference for the spec for how return return works?
10
10
# There is "return function" but that's a more advanced feature.
@@ -104,11 +104,20 @@ throws-like Q[sub {CHECK return;}],
104
104
' CHECK return handled correctly' ;
105
105
106
106
# https://github.com/rakudo/rakudo/issues/1216
107
- # ?rakudo.jvm skip 'UnwindException'
107
+ # ?rakudo.jvm 3 skip 'UnwindException'
108
108
throws-like 「 sub { eager sub { ^1 .map: { return } }() }()」 ,
109
109
X::ControlFlow::Return , : out-of-dynamic-scope{. so },
110
110
' X::ControlFlow::Return tells when return is outside of dyn scope' ;
111
+ # RT #114042
112
+ throws-like 「 sub a1 { my &x = { return }; &x }; my &y = a1; &y()」 ,
113
+ X::ControlFlow::Return , : out-of-dynamic-scope{. so },
114
+ ' X::ControlFlow::Return tells when return is outside of dyn scope' ;
115
+ throws-like 「 sub a2 { my &x = { return }; &x }; sub b1(&x) { &x() }; b1(a2)」 ,
116
+ X::ControlFlow::Return , : out-of-dynamic-scope{. so },
117
+ ' X::ControlFlow::Return tells when return is outside of dyn scope' ;
111
118
throws-like 「 return」 , X::ControlFlow::Return , : out-of-dynamic-scope{. not },
112
119
' bare return does not set $.out-of-dynamic-scope' ;
113
120
121
+
122
+
114
123
# vim: ft=perl6
0 commit comments