Skip to content

Commit aab2aa2

Browse files
committed
Fix test
1 parent 48e87da commit aab2aa2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/neg-custom-args/captures/lexical-control.scala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ trait Label extends Capability:
55
cap type Fv // the capability set occurring freely in the `block` passed to `boundary` below.
66

77
def boundary[T, cap C](block: Label{cap type Fv = {C} } ->{C} T): T = ??? // link label and block capture set
8-
def suspend[U](label: Label)(handler: () ->{label.Fv} U): U = ??? // note the path
8+
def suspend[U](label: Label)[cap D <: {label.Fv}](handler: () ->{D} U): U = ??? // note the path
99

1010
def test =
1111
val x = 1
1212
boundary: outer =>
1313
val y = 2
1414
boundary: inner =>
1515
val z = 3
16-
suspend(outer): () =>
17-
println(inner) // error (leaks the inner label)
16+
val w = suspend(outer) {() => z} // ok
17+
val v = suspend(inner) {() => y} // ok
18+
val u = suspend(inner): () =>
19+
suspend(outer) {() => y} // ok
20+
suspend(outer) {() => y} // ok
21+
y
22+
suspend(outer) { () => // error
23+
suspend(outer) {() => y }
24+
}
25+
suspend(outer): () => // error (leaks the inner label)
26+
println(inner)
1827
x + y + z

0 commit comments

Comments
 (0)