Skip to content

Commit 7def726

Browse files
committed
Update test
1 parent bad3a77 commit 7def726

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

tests/neg-custom-args/captures/capset-members.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class Concrete3 extends Abstract[CapSet^{}]:
1616
type C = CapSet^{} | CapSet^{}
1717
def boom() = ()
1818

19-
class Concrete4 extends Abstract[CapSet^]:
19+
class Concrete4(a: AnyRef^) extends Abstract[CapSet^{a}]:
2020
type C = CapSet // error
2121
def boom() = ()
22+
23+
class Concrete5(a: AnyRef^) extends Abstract[CapSet^{a}]:
24+
type C = CapSet^{} | CapSet^{a}
25+
def boom() = ()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import caps.*
2+
3+
class C
4+
5+
def test[X^, Y^, Z >: X <: Y](x: C^{X^}, y: C^{Y^}, z: C^{Z^}) =
6+
val x2z: C^{Z^} = x
7+
val z2y: C^{Y^} = z
8+
val x2y: C^{Y^} = x // error
9+

tests/neg-custom-args/captures/i21868b.scala

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.experimental.modularity
12
import caps.*
23

34
class IO
@@ -20,7 +21,7 @@ class Concrete3(io: IO^) extends Abstract:
2021
type C = CapSet^{io}
2122
def f(file: File) = () // error
2223

23-
trait Abstract2(io: IO^):
24+
trait Abstract2(tracked val io: IO^):
2425
type C >: CapSet <: CapSet^{io}
2526
def f(file: File^{C^}): Unit
2627

@@ -29,5 +30,17 @@ class Concrete4(io: IO^) extends Abstract2(io):
2930
def f(file: File) = ()
3031

3132
class Concrete5(io1: IO^, io2: IO^) extends Abstract2(io1):
33+
type C = CapSet^{io2} // error
34+
def f(file: File^{io2}) = ()
35+
36+
trait Abstract3[X^]:
37+
type C >: CapSet <: X
38+
def f(file: File^{C^}): Unit
39+
40+
class Concrete6(io: IO^) extends Abstract3[CapSet^{io}]:
41+
type C = CapSet
42+
def f(file: File) = ()
43+
44+
class Concrete7(io1: IO^, io2: IO^) extends Abstract3[CapSet^{io1}]:
3245
type C = CapSet^{io2} // error
3346
def f(file: File^{io2}) = ()

0 commit comments

Comments
 (0)