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 b1b1dfd commit 6b1eda3Copy full SHA for 6b1eda3
tests/neg/i16095.scala
@@ -0,0 +1,30 @@
1
+package x
2
+
3
+import scala.annotation.*
4
+import scala.concurrent.*
5
6
+@capability
7
+class CpsTransform[F[_]] {
8
+ def await[T](ft: F[T]): { this } T = ???
9
+}
10
11
+inline def cpsAsync[F[_]] =
12
+ Test.InfernAsyncArg
13
+object Test {
14
15
+ class InfernAsyncArg[F[_]] {
16
+ def apply[A](expr: CpsTransform[F] ?=> A): F[A] = ???
17
+ }
18
19
+ def asyncPlus[F[_]](a:Int, b:F[Int])(using cps: CpsTransform[F]): { cps } Int =
20
+ a + cps.await(b)
21
22
+ def testExample1Future(): Unit =
23
+ val fr = cpsAsync[Future] {
24
+ val y = asyncPlus(1,Future successful 2)
25
+ y+1
26
27
+ val r = Await.result(fr)
28
+ assert(r == Success(3))
29
30
0 commit comments