Skip to content

Commit 46c33a8

Browse files
committed
Add more tests for escaping local roots
1 parent 1065bd1 commit 46c33a8

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import language.experimental.captureChecking
2+
3+
trait IO:
4+
def use: Unit
5+
6+
object test1 {
7+
def foo(c: IO^): IO^{cap[foo]} = c // error
8+
}
9+
10+
def test2 = {
11+
def foo(c: IO^) = // error
12+
def bar: IO^{cap[foo]} = c
13+
bar
14+
}
15+
16+
object test3 {
17+
def foo(c: IO^): IO^{cap[bar]} = ??? // error
18+
def bar(c: IO^): IO^{cap[foo]} = ??? // error
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import language.experimental.captureChecking
2+
3+
class C[T]:
4+
object inner:
5+
val x: T^{cap[C]} = ??? // error
6+
7+
class C1[T]:
8+
private object inner:
9+
val x: T^{cap[C1]} = ??? // ok

0 commit comments

Comments
 (0)