We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 202445d commit fc20b42Copy full SHA for fc20b42
tests/neg-custom-args/captures/box-unsoundness.scala
@@ -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