File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ object boundary:
38
38
/** Labels are targets indicating which boundary will be exited by a `break`.
39
39
*/
40
40
@ implicitNotFound(" explain=A Label is generated from an enclosing `scala.util.boundary` call.\n Maybe that boundary is missing?" )
41
- final class Label [- T ]
41
+ final class Label [- T ] extends caps. Control
42
42
43
43
/** Abort current computation and instead return `value` as the value of
44
44
* the enclosing `boundary` call that created `label`.
@@ -60,7 +60,7 @@ object boundary:
60
60
val local = Label [T ]()
61
61
try body(using local)
62
62
catch case ex : Break [T ] @ unchecked =>
63
- if ex.label eq local then ex.value
63
+ if ex.isSameLabelAs( local) then ex.value
64
64
else throw ex
65
65
66
66
end boundary
Original file line number Diff line number Diff line change 1
1
package scala .util .control
2
2
3
+ import language .experimental .captureChecking
4
+
3
5
import scala .compiletime .uninitialized
4
6
5
7
/** Library implementation of nonlocal return.
@@ -22,7 +24,7 @@ import scala.compiletime.uninitialized
22
24
@ deprecated(" Use scala.util.boundary instead" , " 3.3" )
23
25
object NonLocalReturns {
24
26
@ deprecated(" Use scala.util.boundary.Break instead" , " 3.3" )
25
- class ReturnThrowable [T ] extends ControlThrowable {
27
+ class ReturnThrowable [T ] extends ControlThrowable , caps. Control {
26
28
private var myResult : T = uninitialized
27
29
def throwReturn (result : T ): Nothing = {
28
30
myResult = result
You can’t perform that action at this time.
0 commit comments