File tree Expand file tree Collapse file tree 5 files changed +17
-15
lines changed
compiler/src/dotty/tools/dotc/cc
pos-special/stdlib/collection/mutable Expand file tree Collapse file tree 5 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,11 @@ extension (cls: ClassSymbol)
231
231
&& bc.givenSelfType.dealiasKeepAnnots.match
232
232
case CapturingType (_, refs) => refs.isAlwaysEmpty
233
233
case RetainingType (_, refs) => refs.isEmpty
234
- case selfType => selfType.exists && selfType.captureSet.isAlwaysEmpty
234
+ case selfType =>
235
+ isCaptureChecking // At Setup we have not processed self types yet, so
236
+ // unless a self type is explicitly given, we can't tell
237
+ // and err on the side of impure.
238
+ && selfType.exists && selfType.captureSet.isAlwaysEmpty
235
239
236
240
extension (sym : Symbol )
237
241
Original file line number Diff line number Diff line change 6
6
-- Error: tests/neg-custom-args/captures/exception-definitions.scala:7:12 ----------------------------------------------
7
7
7 | val x = c // error
8
8
| ^
9
- |(c : Any^) cannot be referenced here; it is not included in the allowed capture set {} of pure base class class Throwable
10
- -- Error: tests/neg-custom-args/captures/exception-definitions.scala:8:8 - ----------------------------------------------
9
+ |(c : Any^) cannot be referenced here; it is not included in the allowed capture set {} of the self type of class Err2
10
+ -- Error: tests/neg-custom-args/captures/exception-definitions.scala:8:13 ----------------------------------------------
11
11
8 | class Err3(c: Any^) extends Exception // error
12
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
13
- | reference (Err3.this.c : Any^) is not included in the allowed capture set {} of pure base class class Throwable
12
+ | ^
13
+ | reference (Err3.this.c : Any^) is not included in the allowed capture set {} of the self type of class Err3
Original file line number Diff line number Diff line change 2
2
14 | () => () => io // error
3
3
| ^^
4
4
|(io : Cap^) cannot be referenced here; it is not included in the allowed capture set {} of the self type of class Fuzz
5
- -- [E058] Type Mismatch Error: tests/neg-custom-args/captures/leaked-curried.scala:15:10 -------------------------------
6
- 15 | class Foo extends Box, Pure: // error
7
- | ^
8
- | illegal inheritance: self type Foo^{io} of class Foo does not conform to self type Pure
9
- | of parent trait Pure
10
- |
11
- | longer explanation available when compiling with `-explain`
5
+ -- Error: tests/neg-custom-args/captures/leaked-curried.scala:17:20 ----------------------------------------------------
6
+ 17 | () => () => io // error
7
+ | ^^
8
+ |(io : Cap^) cannot be referenced here; it is not included in the allowed capture set {} of the self type of class Foo
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ def main(): Unit =
12
12
self =>
13
13
val get : () -> {} () -> {io} Cap ^ =
14
14
() => () => io // error
15
- class Foo extends Box , Pure : // error
15
+ class Foo extends Box , Pure :
16
16
val get : () -> {} () -> {io} Cap ^ =
17
- () => () => io
17
+ () => () => io // error
18
18
new Foo
19
19
val bad = leaked.get()().use() // using a leaked capability
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ sealed abstract class ArraySeq[sealed T]
41
41
with IndexedSeq [T ]
42
42
with IndexedSeqOps [T , ArraySeq , ArraySeq [T ]]
43
43
with StrictOptimizedSeqOps [T , ArraySeq , ArraySeq [T ]]
44
- with Serializable {
44
+ with Serializable
45
+ with Pure {
45
46
46
47
override def iterableFactory : scala.collection.SeqFactory [ArraySeq ] = ArraySeq .untagged
47
48
You can’t perform that action at this time.
0 commit comments