Skip to content

Commit c547c2a

Browse files
committed
Drop no universal in deep capture set test everywhere from source 3.5
1 parent dddd6bc commit c547c2a

File tree

4 files changed

+7
-27
lines changed

4 files changed

+7
-27
lines changed

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ object CheckCaptures:
170170
traverse(parent)
171171
case t =>
172172
traverseChildren(t)
173-
check.traverse(tp)
173+
if ccConfig.allowUniversalInBoxed then check.traverse(tp)
174174
end disallowRootCapabilitiesIn
175175

176176
/** Attachment key for bodies of closures, provided they are values */

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

Lines changed: 1 addition & 1 deletion
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^ = uninitialized // error
8+
var file: File^ = uninitialized // OK, was error under sealed
99
def log = file.write("log") // error, was OK under sealed
1010

1111
def withFile[T](op: (l: caps.Capability) ?-> (f: File^{l}) => T): T =

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

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,9 @@
2222
13 | y = (q: Proc) // error
2323
| ^^^^^^^
2424
| Found: Proc
25-
| Required: box () ->{p} Unit
25+
| Required: box () => Unit
2626
|
27-
| Note that the universal capability `cap`
28-
| cannot be included in capture set {p} of variable y
29-
|
30-
| longer explanation available when compiling with `-explain`
31-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:14:8 -------------------------------------
32-
14 | y = q // error
33-
| ^
34-
| Found: box () ->{q} Unit
35-
| Required: box () ->{p} Unit
36-
|
37-
| Note that reference (q : Proc), defined in method inner
38-
| cannot be included in outer capture set {p} of variable y
39-
|
40-
| longer explanation available when compiling with `-explain`
41-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:16:65 ------------------------------------
42-
16 | var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // error
43-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44-
| Found: scala.collection.mutable.ListBuffer[box () => Unit]
45-
| Required: box scala.collection.mutable.ListBuffer[box () ->? Unit]^?
46-
|
47-
| Note that the universal capability `cap`
48-
| cannot be included in capture set ? of variable finalizeActions
27+
| Note that () => Unit cannot be box-converted to box () => Unit
28+
| since at least one of their capture sets contains the root capability `cap`
4929
|
5030
| longer explanation available when compiling with `-explain`

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def test(p: Proc, q: () => Unit) =
1111
x = q // error
1212
x = (q: Proc) // error
1313
y = (q: Proc) // error
14-
y = q // error
14+
y = q // OK, was error under sealed
1515

16-
var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // error
16+
var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // OK, was error under sealed
1717

1818

0 commit comments

Comments
 (0)