Skip to content

Commit dcdae04

Browse files
committed
Fix rebase breakage
1 parent b293dca commit dcdae04

File tree

11 files changed

+55
-61
lines changed

11 files changed

+55
-61
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ class CheckCaptures extends Recheck, SymTransformer:
493493
case c1: CoreCapability =>
494494
CaptureSet.ofType(c1.widen, followResult = true)
495495
capt.println(i"Widen reach $c to $underlying in ${env.owner}")
496-
underlying.disallowRootCapability(NoSymbol): () =>
496+
underlying.disallowBadRoots(NoSymbol): () =>
497497
report.error(em"Local capability $c${env.owner.qualString("in")} cannot have `cap` as underlying capture set", tree.srcPos)
498498
recur(underlying, env, lastEnv)
499499

@@ -555,7 +555,7 @@ class CheckCaptures extends Recheck, SymTransformer:
555555
else if !ref.isType then i"\nYou could try to abstract the capabilities referred to by $c in a capset variable."
556556
else ""
557557
report.error(
558-
em"$what $c leaks into capture scope${owner.qualString("of")}.$mitigation",
558+
em"$what $c leaks into capture scope${ref.symbol.owner.qualString("of")}.$mitigation",
559559
pos)
560560
case _ =>
561561

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,6 @@ class Definitions {
21162116
Caps_Classifier, Caps_SharedCapability, Caps_Control, Caps_ExclusiveCapability, Caps_Mutable, Caps_Read,
21172117
RequiresCapabilityAnnot,
21182118
captureRoot, Caps_CapSet, Caps_ContainsTrait, Caps_ContainsModule, Caps_ContainsModule.moduleClass,
2119-
Caps_Mutable, Caps_Sharable, Caps_Control, Caps_Classifier,
21202119
ConsumeAnnot, UseAnnot, ReserveAnnot,
21212120
CapsUnsafeModule, CapsUnsafeModule.moduleClass,
21222121
CapsInternalModule, CapsInternalModule.moduleClass,

tests/neg-custom-args/captures/dcs-tvar.check

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
| ^^^^^^^^^^^^^^^^
44
| Found: () => Unit
55
| Required: () -> Unit
6-
| Note that capability xs* is not included in capture set {}.
76
|
87
| where: => refers to a fresh root capability in the type of type T
98
|
9+
| Note that capability cap is not included in capture set {}.
10+
|
1011
| longer explanation available when compiling with `-explain`
1112
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/dcs-tvar.scala:9:2 ---------------------------------------
1213
9 | () => runOps(xs) // error
1314
| ^^^^^^^^^^^^^^^^
1415
| Found: () => Unit
1516
| Required: () -> Unit
16-
| Note that capability xs* is not included in capture set {}.
1717
|
1818
| where: => refers to a fresh root capability in the type of type U
1919
|
20+
| Note that capability cap is not included in capture set {}.
21+
|
2022
| longer explanation available when compiling with `-explain`

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
| Found: () ->{ops*} Unit
55
| Required: () -> Unit
66
| Note that capability ops* is not included in capture set {}.
7-
16 | val ops1 = ops
8-
17 | runOps(ops1)
7+
15 | val ops1 = ops
8+
16 | runOps(ops1)
99
|
1010
| longer explanation available when compiling with `-explain`
1111
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/delayedRunops.scala:26:4 ---------------------------------
@@ -14,16 +14,16 @@
1414
| Found: () ->{ops*} Unit
1515
| Required: () -> Unit
1616
| Note that capability ops* is not included in capture set {}.
17-
28 | val ops1: List[() ->{ops*} Unit] = ops
18-
29 | runOps(ops1)
17+
27 | val ops1: List[() ->{ops*} Unit] = ops
18+
28 | runOps(ops1)
1919
|
2020
| longer explanation available when compiling with `-explain`
21-
-- Error: tests/neg-custom-args/captures/delayedRunops.scala:23:13 -----------------------------------------------------
22-
23 | runOps(ops1) // error
23-
| ^^^^
24-
| Local reach capability ops* leaks into capture scope of method delayedRunOps2.
25-
| To allow this, the parameter ops should be declared with a @use annotation
26-
-- Error: tests/neg-custom-args/captures/delayedRunops.scala:22:16 -----------------------------------------------------
27-
22 | val ops1: List[() => Unit] = ops // error
21+
-- Error: tests/neg-custom-args/captures/delayedRunops.scala:22:6 ------------------------------------------------------
22+
22 | runOps(ops1) // error
23+
| ^^^^^^
24+
| Local reach capability ops* leaks into capture scope of method delayedRunOps2.
25+
| You could try to abstract the capabilities referred to by ops* in a capset variable.
26+
-- Error: tests/neg-custom-args/captures/delayedRunops.scala:21:16 -----------------------------------------------------
27+
21 | val ops1: List[() => Unit] = ops // error
2828
| ^^^^^^^^^^^^^^^^
2929
| Separation failure: value ops1's type List[() => Unit] hides non-local parameter ops
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/gears-problem.scala:19:62 --------------------------------
2-
19 | val fut: Future[T]^{fs*} = collector.results.read().right.get // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| Found: Future[T]^{collector.futures*}
5-
| Required: Future[T]^{fs*}
6-
| Note that capability collector.futures* is not included in capture set {fs*}.
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/gears-problem.scala:19:60 --------------------------------
2+
19 | val fut: Future[T]^{C} = collector.results.read().right.get // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| Found: Future[T]^{collector.futures*}
5+
| Required: Future[T]^{C}
6+
| Note that capability collector.futures* is not included in capture set {C}.
77
|
88
| longer explanation available when compiling with `-explain`
9-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/gears-problem.scala:24:34 --------------------------------
10-
24 | val fut2: Future[T]^{fs*} = r.get // error
11-
| ^^^^^
12-
| Found: Future[T^{}]^{collector.futures*}
13-
| Required: Future[T]^{fs*}
14-
| Note that capability collector.futures* is not included in capture set {fs*}.
9+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/gears-problem.scala:24:32 --------------------------------
10+
24 | val fut2: Future[T]^{C} = r.get // error
11+
| ^^^^^
12+
| Found: Future[T^{}]^{collector.futures*}
13+
| Required: Future[T]^{C}
14+
| Note that capability collector.futures* is not included in capture set {C}.
1515
|
1616
| longer explanation available when compiling with `-explain`
1717
there were 4 deprecation warnings; re-run with -deprecation for details

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
| ^^^^^^^^^^^^^^^^^^^^^^
44
| Found: () ->{f} Unit
55
| Required: () -> Unit
6+
| Note that capability (f : () => Unit) is not included in capture set {}.
67
|
78
| longer explanation available when compiling with `-explain`
89
-- Error: tests/neg-custom-args/captures/i21347.scala:11:15 ------------------------------------------------------------

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21614.scala:15:12 ---------------------------------------
1313
15 | files.map(new Logger(_)) // error, Q: can we improve the error message?
1414
| ^^^^^^^^^^^^^
15-
|Found: (_$1: File^?) ->{files*} Logger{val f: File^{_$1}}^{cap.rd, _$1}
16-
|Required: File^{files*} => Logger{val f: File^?}^?
15+
|Found: (_$1: File^?) ->{C} Logger{val f: File^{_$1}}^{cap.rd, _$1}
16+
|Required: File^{C} => Logger{val f: File^?}^?
1717
|
1818
|where: => refers to a fresh root capability created in method mkLoggers2 when checking argument to parameter f of method map
1919
| cap is a root capability associated with the result type of (_$1: File^?): Logger{val f: File^{_$1}}^{cap.rd, _$1}
2020
|
21-
|Note that capability <cap of (_$1: File^{files*}): Logger{val f: File^?}^?>.rd
22-
|cannot be included in outer capture set ?.
21+
|Note that capability C is not classified as trait SharedCapability, therefore it
22+
|cannot be included in capture set ? of parameter _$1 of trait SharedCapability elements.
2323
|
2424
| longer explanation available when compiling with `-explain`

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|where: => refers to a fresh root capability created in method runAll0 when checking argument to parameter f of method usingFile
88
| ^ refers to the universal root capability
99
|
10-
|Note that capability cap is not included in capture set {xs*}.
10+
|Note that capability cap is not included in capture set {C}.
1111
23 | cur = (() => f.write()) :: Nil
1212
|
1313
| longer explanation available when compiling with `-explain`
@@ -20,7 +20,7 @@
2020
|where: => refers to a fresh root capability created in method runAll1 when checking argument to parameter f of method usingFile
2121
| ^ refers to the universal root capability
2222
|
23-
|Note that capability cap cannot be included in capture set {xs*} of value cur.
23+
|Note that capability cap cannot be included in capture set {C} of value cur.
2424
33 | cur.set:
2525
34 | (() => f.write()) :: Nil
2626
|
@@ -125,23 +125,19 @@
125125
|where: => refers to a fresh root capability created in method mapCompose2 when checking argument to parameter f of method map
126126
| ^ refers to the universal root capability
127127
|
128-
|Note that capability ps* cannot be included in capture set {} of value x.
128+
|Note that capability C cannot be included in capture set {} of value x.
129129
|
130130
| longer explanation available when compiling with `-explain`
131131
-- Error: tests/neg-custom-args/captures/reaches.scala:39:31 -----------------------------------------------------------
132132
39 | val next: () => Unit = cur.head // error
133133
| ^^^^^^^^
134134
| Local reach capability xs* leaks into capture scope of method runAll2.
135-
| To allow this, the parameter xs should be declared with a @use annotation
135+
| You could try to abstract the capabilities referred to by xs* in a capset variable.
136136
-- Error: tests/neg-custom-args/captures/reaches.scala:62:36 -----------------------------------------------------------
137137
62 | val leaked = usingFile[File^{id*}]: f => // error: separation
138138
| ^
139-
| Separation failure: Illegal access to cap of value id which is hidden by the previous definition
140-
| of value id with type File^ -> File^².
141-
| This type hides capabilities {cap}
139+
| Local cap created in type of parameter x leaks into capture scope of enclosing function
142140
|
143-
| where: ^ refers to the universal root capability
144-
| ^² refers to a fresh root capability in the type of value id
145-
| cap is a fresh root capability created in value id
141+
| where: cap is a fresh root capability created in value id of parameter parameter x of method $anonfun
146142
63 | val f1: File^{id*} = id(f)
147143
64 | f1
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/spread-problem.scala:8:6 ---------------------------------
1+
-- Error: tests/neg-custom-args/captures/spread-problem.scala:8:7 ------------------------------------------------------
22
8 | race(Seq(src1, src2)*) // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^
4-
| Found: Source[T^?]^{src1, src2}
5-
| Required: Source[T]
6-
| Note that capability (src1 : Source[T]^) is not included in capture set {}.
7-
|
8-
| longer explanation available when compiling with `-explain`
9-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/spread-problem.scala:11:6 --------------------------------
3+
| ^^^^^^^^^^^^^^^^
4+
| Sequence argument type annotation `*` cannot be used here:
5+
| the corresponding parameter has type Seq[Source[T]^{C}] which is not a repeated parameter type
6+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/spread-problem.scala:11:7 --------------------------------
107
11 | race(src1, src2) // error
11-
| ^^^^^^^^^^^^^^^^
12-
| Found: Source[T^?]^{src1, src2}
13-
| Required: Source[T]
14-
| Note that capability (src1 : Source[T]^) is not included in capture set {}.
8+
| ^^^^^^^^^^
9+
| Found: (Source[T]^, Source[T]^)
10+
| Required: Seq[Source[T]^]
1511
|
1612
| longer explanation available when compiling with `-explain`

tests/neg-custom-args/captures/use-capset.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
|
1616
| longer explanation available when compiling with `-explain`
1717
-- Error: tests/neg-custom-args/captures/use-capset.scala:5:49 ---------------------------------------------------------
18-
5 |private def g[C^] = (xs: List[Object^{C}]) => xs.head // error
18+
5 |private def g[C^] = (xs: List[Object^{C}]) => xs.head // error TODO: allow this
1919
| ^^^^^^^
2020
| Capture set parameter C leaks into capture scope of method g.

0 commit comments

Comments
 (0)