Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Dec 1, 2024
1 parent 092b358 commit acde5c0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/neg-custom-args/captures/capset-members.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class Concrete3 extends Abstract[CapSet^{}]:
type C = CapSet^{} | CapSet^{}
def boom() = ()

class Concrete4 extends Abstract[CapSet^]:
class Concrete4(a: AnyRef^) extends Abstract[CapSet^{a}]:
type C = CapSet // error
def boom() = ()

class Concrete5(a: AnyRef^) extends Abstract[CapSet^{a}]:
type C = CapSet^{} | CapSet^{a}
def boom() = ()
9 changes: 9 additions & 0 deletions tests/neg-custom-args/captures/capture-parameters.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import caps.*

class C

def test[X^, Y^, Z >: X <: Y](x: C^{X^}, y: C^{Y^}, z: C^{Z^}) =
val x2z: C^{Z^} = x
val z2y: C^{Y^} = z
val x2y: C^{Y^} = x // error

15 changes: 14 additions & 1 deletion tests/neg-custom-args/captures/i21868b.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import language.experimental.modularity
import caps.*

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

trait Abstract2(io: IO^):
trait Abstract2(tracked val io: IO^):
type C >: CapSet <: CapSet^{io}
def f(file: File^{C^}): Unit

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

class Concrete5(io1: IO^, io2: IO^) extends Abstract2(io1):
type C = CapSet^{io2} // error
def f(file: File^{io2}) = ()

trait Abstract3[X^]:
type C >: CapSet <: X
def f(file: File^{C^}): Unit

class Concrete6(io: IO^) extends Abstract3[CapSet^{io}]:
type C = CapSet
def f(file: File) = ()

class Concrete7(io1: IO^, io2: IO^) extends Abstract3[CapSet^{io1}]:
type C = CapSet^{io2} // error
def f(file: File^{io2}) = ()

0 comments on commit acde5c0

Please sign in to comment.