Skip to content

Commit fc20b42

Browse files
committed
Failing test
1 parent 202445d commit fc20b42

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@annotation.capability
2+
class CanIO { def use(): Unit = () }
3+
def use[X](x: X): (op: X -> Unit) -> Unit = op => op(x)
4+
def test(io: CanIO^): Unit =
5+
val f: (CanIO^ => Unit) -> Unit = use[CanIO^](io) //
6+
val _: (CanIO^ => Unit) -> Unit = f // error
7+
8+
val g1 = () => f(x => x.use()) // error
9+
10+
val a1 = f(x => x.use())
11+
val a2 = () => f(x => x.use())
12+
val g2: () -> Unit = a2 // error
13+
// was UNSOUND: g uses the capability io but has an empty capture set

0 commit comments

Comments
 (0)