-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more tests for escaping local roots
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/neg-custom-args/captures/local-roots-inner-classes.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |