File tree Expand file tree Collapse file tree 4 files changed +7
-27
lines changed
compiler/src/dotty/tools/dotc/cc
tests/neg-custom-args/captures Expand file tree Collapse file tree 4 files changed +7
-27
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ object CheckCaptures:
170
170
traverse(parent)
171
171
case t =>
172
172
traverseChildren(t)
173
- check.traverse(tp)
173
+ if ccConfig.allowUniversalInBoxed then check.traverse(tp)
174
174
end disallowRootCapabilitiesIn
175
175
176
176
/** Attachment key for bodies of closures, provided they are values */
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class File:
5
5
def write (x : String ): Unit = ???
6
6
7
7
class Service :
8
- var file : File ^ = uninitialized // error
8
+ var file : File ^ = uninitialized // OK, was error under sealed
9
9
def log = file.write(" log" ) // error, was OK under sealed
10
10
11
11
def withFile [T ](op : (l : caps.Capability ) ?-> (f : File ^ {l}) => T ): T =
Original file line number Diff line number Diff line change 22
22
13 | y = (q: Proc) // error
23
23
| ^^^^^^^
24
24
| Found: Proc
25
- | Required: box () ->{p} Unit
25
+ | Required: box () => Unit
26
26
|
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`
49
29
|
50
30
| longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ def test(p: Proc, q: () => Unit) =
11
11
x = q // error
12
12
x = (q : Proc ) // error
13
13
y = (q : Proc ) // error
14
- y = q // error
14
+ y = q // OK, was error under sealed
15
15
16
- var finalizeActions = collection.mutable.ListBuffer [() => Unit ]() // error
16
+ var finalizeActions = collection.mutable.ListBuffer [() => Unit ]() // OK, was error under sealed
17
17
18
18
You can’t perform that action at this time.
0 commit comments