Skip to content

Commit

Permalink
Add more tests for escaping local roots
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed Nov 3, 2023
1 parent 1065bd1 commit 46c33a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/neg-custom-args/captures/escaping-local-roots.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import language.experimental.captureChecking

trait IO:
def use: Unit

object test1 {
def foo(c: IO^): IO^{cap[foo]} = c // error
}

def test2 = {
def foo(c: IO^) = // error
def bar: IO^{cap[foo]} = c
bar
}

object test3 {
def foo(c: IO^): IO^{cap[bar]} = ??? // error
def bar(c: IO^): IO^{cap[foo]} = ??? // error
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import language.experimental.captureChecking

class C[T]:
object inner:
val x: T^{cap[C]} = ??? // error

class C1[T]:
private object inner:
val x: T^{cap[C1]} = ??? // ok

0 comments on commit 46c33a8

Please sign in to comment.