Skip to content

Commit 6335372

Browse files
committedApr 4, 2025
Fixes and polishings
1 parent f23b9dc commit 6335372

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import language.experimental.captureChecking
2+
import language.experimental.modularity
3+
import caps.*
4+
5+
def test =
6+
val x: Any^ = ???
7+
val y: Any^ = ???
8+
val z: Any^ = ???
9+
def onlyWithZ[cap C](using c: Contains[C, z.type]) = ???
10+
11+
trait IncludesZ[cap C]:
12+
val c: Contains[C, z.type]
13+
14+
trait Foo:
15+
cap type C >: {x} <: {x,y,z} : IncludesZ
16+
17+
val foo: Foo = ???
18+
/* new Foo {
19+
override given IncludesZ[C]: // FIXME: doesn't work yet
20+
val c: Contains[C, z.type] = summon
21+
cap type C = {x,z}
22+
} */
23+
onlyWithZ(using foo.C.c)
24+
onlyWithZ[{z}]
25+
onlyWithZ[{x,z}]
26+
onlyWithZ[{x,y,z}]
27+
onlyWithZ[{x,y}] // error

0 commit comments

Comments
 (0)