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:
1010 private val count : Ref ^ = Ref ()
1111 val incr = () =>
1212 count.put(count.get + 1 )
13- val decr = () =>
13+ val decr : () -> { this } Unit = () =>
1414 count.put(count.get - 1 )
1515
1616def par (p1 : () => Unit , p2 : () => Unit ) = ()
17+ def seq (p1 : () => Unit , p2 : () -> {cap, p1} Unit ) = ()
18+ def parCurried (p1 : () => Unit ) = (p2 : () => Unit ) => ()
1719
1820def test () =
1921 val c = Counter ()
2022 val i = c.incr
2123 val d = c.decr
2224 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 ))
2339
You can’t perform that action at this time.
0 commit comments