Skip to content

Commit 32e550b

Browse files
committed
Add test cases for #22103
1 parent 001901d commit 32e550b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import language.experimental.captureChecking
2+
import caps.*
3+
4+
trait F[+Cap^]
5+
def expect[C^](x: F[C]): x.type = x
6+
7+
def test[C^](x: F[C], io: () => Unit): Unit =
8+
val t1 = expect[CapSet^{C^}](x)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import language.experimental.captureChecking
2+
import caps.*
3+
4+
abstract class Source[+T, Cap^]:
5+
def transformValuesWith[U](f: (T -> U)^{Cap^}): Source[U, Cap]^{this, f} = ???
6+
7+
def race[T, Cap^](sources: Source[T, Cap]^{Cap^}*): Source[T, Cap]^{Cap^} = ???
8+
9+
def either[T1, T2, Cap^](
10+
//io: () => Unit,
11+
src1: Source[T1, Cap]^{Cap^},
12+
src2: Source[T2, Cap]^{Cap^}): Source[Either[T1, T2], Cap]^{Cap^} =
13+
val left = src1.transformValuesWith(Left(_))
14+
val right = src2.transformValuesWith(Right(_))
15+
race[Either[T1, T2], CapSet^{Cap^}](left, right) // <- rejected

0 commit comments

Comments
 (0)