File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
tests/neg-custom-args/captures Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,30 @@ class Counter:
10
10
private val count : Ref ^ = Ref ()
11
11
val incr = () =>
12
12
count.put(count.get + 1 )
13
- val decr = () =>
13
+ val decr : () -> { this } Unit = () =>
14
14
count.put(count.get - 1 )
15
15
16
16
def par (p1 : () => Unit , p2 : () => Unit ) = ()
17
+ def seq (p1 : () => Unit , p2 : () -> {cap, p1} Unit ) = ()
18
+ def parCurried (p1 : () => Unit ) = (p2 : () => Unit ) => ()
17
19
18
20
def test () =
19
21
val c = Counter ()
20
22
val i = c.incr
21
23
val d = c.decr
22
24
par(i, d) // error: separation failure
25
+ seq(i, d)
26
+ parCurried(i)(d) // OK, but should be error
27
+ val p : Proc = ???
28
+ parCurried(p)(p) // OK, but should be error
29
+
30
+ type Proc = () => Unit
31
+
32
+ class Pair (val a : Proc , val b : Proc )
33
+
34
+ def mkCounter (): Pair ^ =
35
+ val count = Ref ()
36
+ Pair (
37
+ () => count.put(count.get + 1 ), // error: separation failure
38
+ () => count.put(count.get - 1 ))
23
39
You can’t perform that action at this time.
0 commit comments