We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39e63f3 commit 8fb3c38Copy full SHA for 8fb3c38
library/src/scala/util/boundary.scala
@@ -23,14 +23,14 @@ object boundary:
23
24
/** Labels are targets indicating which boundary will be exited by a `break`.
25
*/
26
- class Label[T]:
+ class Label[-T]:
27
def break(value: T): Nothing = throw Break(this, value)
28
29
/** Run `body` with freshly generated label as implicit argument. Catch any
30
* breaks associated with that label and return their results instead of
31
* `body`'s result.
32
33
- inline def apply[T <: R, R](inline body: Label[T] ?=> R): R =
+ inline def apply[T](inline body: Label[T] ?=> T): T =
34
val local = Label[T]()
35
try body(using local)
36
catch case ex: Break[T] @unchecked =>
0 commit comments