Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Nov 19, 2024
1 parent 13e4439 commit 20917c7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/neg-custom-args/captures/capset-bound.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import caps.*

class IO

case class File(io: IO^)

def test(io1: IO^, io2: IO^) =
def f[C >: CapSet^{io1} <: CapSet^](file: File^{C^}) = ???
val f1: File^{io1} = ???
val f2: File^{io2} = ???
val f3: File^{io1, io2} = ???
f[CapSet^{io1}](f1)
f[CapSet^{io1}](f2) // error
f[CapSet^{io1}](f3) // error
f[CapSet^{io2}](f2) // error
f[CapSet^{io1, io2}](f1)
f[CapSet^{io1, io2}](f2)
f[CapSet^{io1, io2}](f3)
14 changes: 14 additions & 0 deletions tests/neg-custom-args/captures/i21868.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import caps.

trait AbstractWrong:
type C <: CapSet
def boom(): Unit^{C^} // error

trait Abstract:
type C <: CapSet^
def boom(): Unit^{C^}

class Concrete extends Abstract:
type C = Nothing
def boom() = () // error

0 comments on commit 20917c7

Please sign in to comment.