Skip to content

Commit d3900df

Browse files
committed
Drop local roots in tests
1 parent cfe986e commit d3900df

28 files changed

+42
-343
lines changed

tests/neg-custom-args/captures/filevar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class File:
55
def write(x: String): Unit = ???
66

77
class Service:
8-
var file: File^{cap[Service]} = uninitialized // error
8+
var file: File^ = uninitialized // error
99
def log = file.write("log")
1010

1111
def withFile[T](op: (l: caps.Cap) ?-> (f: File^{l}) => T): T =
@@ -14,5 +14,5 @@ def withFile[T](op: (l: caps.Cap) ?-> (f: File^{l}) => T): T =
1414
def test =
1515
withFile: f =>
1616
val o = Service()
17-
o.file = f // error
17+
o.file = f
1818
o.log

tests/neg-custom-args/captures/localcaps.check

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/neg-custom-args/captures/localcaps.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/neg-custom-args/captures/nesting-inversion.scala

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/neg-custom-args/captures/outer-var.check

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
11 | x = q // error
33
| ^
44
| Found: () ->{q} Unit
5-
| Required: () ->{cap[test]} Unit
5+
| Required: () ->{p, q²} Unit
6+
|
7+
| where: q is a parameter in method inner
8+
| q² is a parameter in method test
69
|
710
| longer explanation available when compiling with `-explain`
811
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:12:9 -------------------------------------
912
12 | x = (q: Proc) // error
1013
| ^^^^^^^
11-
| Found: () ->{cap[inner]} Unit
12-
| Required: () ->{cap[test]} Unit
14+
| Found: Proc
15+
| Required: () ->{p, q} Unit
1316
|
1417
| longer explanation available when compiling with `-explain`
1518
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:13:9 -------------------------------------

tests/neg-custom-args/captures/outer-var.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type Cap = CC^
44
type Proc = () => Unit
55

66
def test(p: Proc, q: () => Unit) =
7-
var x: () ->{cap[test]} Unit = p
7+
var x: () ->{p, q} Unit = p
88
var y = p // OK, y has type () ->{p} Proc
99

1010
def inner(q: Proc) =

tests/neg-custom-args/captures/pairs.check

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/neg-custom-args/captures/pairs.scala

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/neg-custom-args/captures/recursive-leaking-local-cap.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ trait Cap:
55
def usingCap[sealed T](op: Cap^ => T): T = ???
66

77
def badTest(): Unit =
8-
def bad(b: Boolean)(c: Cap^): Cap^{cap[bad]} = // error
8+
def bad(b: Boolean)(c: Cap^): Cap^{c} =
99
if b then c
1010
else
11-
val leaked = usingCap[Cap^{cap[bad]}](bad(true))
11+
val leaked = usingCap(bad(true)) // error
1212
leaked.use // boom
1313
c
1414

1515
usingCap[Unit]: c0 =>
1616
bad(false)(c0)
1717

18-
class Bad:
19-
def foo: Cap^{cap[Bad]} = ??? // error
20-
private def bar: Cap^{cap[Bad]} = ??? // ok
2118

2219

tests/neg-custom-args/captures/sealed-leaks.check

Lines changed: 0 additions & 50 deletions
This file was deleted.

tests/neg-custom-args/captures/sealed-leaks.scala

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/neg-custom-args/captures/sealed-refs.scala

Lines changed: 0 additions & 42 deletions
This file was deleted.

tests/neg-custom-args/captures/simple-escapes.check

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/neg-custom-args/captures/simple-escapes.scala

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:32:37 ------------------------------------------------------
2-
32 | usingLogFile { f => later3 = () => f.write(0) } // error
3-
| ^
4-
|(f : java.io.FileOutputStream^) cannot be referenced here; it is not included in the allowed capture set {cap[<root>]}
5-
|of an enclosing function literal with expected type () ->{cap[<root>]} Unit
6-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/usingLogFile.scala:36:35 ---------------------------------
7-
36 | usingLogFile { f => later4 = Cell(() => f.write(0)) } // error
8-
| ^^^^^^^^^^^^^^^^^^^^^^
9-
| Found: Test2.Cell[box () ->{f} Unit]^?
10-
| Required: Test2.Cell[box () ->{cap[<root>]} Unit]
11-
|
12-
| longer explanation available when compiling with `-explain`
131
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:23:14 ------------------------------------------------------
142
23 | val later = usingLogFile { f => () => f.write(0) } // error
153
| ^^^^^^^^^^^^
@@ -18,11 +6,11 @@
186
28 | private val later2 = usingLogFile { f => Cell(() => f.write(0)) } // error
197
| ^^^^^^^^^^^^
208
| local reference f leaks into outer capture set of type parameter T of method usingLogFile
21-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:52:16 ------------------------------------------------------
22-
52 | val later = usingFile("out", f => (y: Int) => xs.foreach(x => f.write(x + y))) // error
9+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:44:16 ------------------------------------------------------
10+
44 | val later = usingFile("out", f => (y: Int) => xs.foreach(x => f.write(x + y))) // error
2311
| ^^^^^^^^^
2412
| local reference f leaks into outer capture set of type parameter T of method usingFile
25-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:60:16 ------------------------------------------------------
26-
60 | val later = usingFile("logfile", // error !!! but should be ok, since we can widen `l` to `file` instead of to `cap`
13+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:52:16 ------------------------------------------------------
14+
52 | val later = usingFile("logfile", // error !!! but should be ok, since we can widen `l` to `file` instead of to `cap`
2715
| ^^^^^^^^^
2816
| local reference l leaks into outer capture set of type parameter T of method usingFile

0 commit comments

Comments
 (0)