Skip to content

Commit 6b1eda3

Browse files
committed
Test case
1 parent b1b1dfd commit 6b1eda3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/neg/i16095.scala

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)