File tree 1 file changed +12
-3
lines changed
tests/neg-custom-args/captures
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,23 @@ trait Label extends Capability:
5
5
cap type Fv // the capability set occurring freely in the `block` passed to `boundary` below.
6
6
7
7
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
9
9
10
10
def test =
11
11
val x = 1
12
12
boundary : outer =>
13
13
val y = 2
14
14
boundary : inner =>
15
15
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)
18
27
x + y + z
You can’t perform that action at this time.
0 commit comments