File tree Expand file tree Collapse file tree 4 files changed +7
-5
lines changed
compiler/src/dotty/tools/dotc/cc
tests/neg-custom-args/captures Expand file tree Collapse file tree 4 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,8 @@ extension (cls: ClassSymbol)
256
256
def pureBaseClass (using Context ): Option [Symbol ] =
257
257
cls.baseClasses.find: bc =>
258
258
defn.pureBaseClasses.contains(bc)
259
- || bc.givenSelfType.dealiasKeepAnnots.match
259
+ || bc.is(CaptureChecked )
260
+ && bc.givenSelfType.dealiasKeepAnnots.match
260
261
case CapturingType (_, refs) => refs.isAlwaysEmpty
261
262
case RetainingType (_, refs) => refs.isEmpty
262
263
case selfType => selfType.exists && selfType.captureSet.isAlwaysEmpty
Original file line number Diff line number Diff line change 1
- -- Error: tests/neg-custom-args/captures/leaked-curried.scala:13 :20 ----------------------------------------------------
2
- 13 | () => () => io // error
1
+ -- Error: tests/neg-custom-args/captures/leaked-curried.scala:14 :20 ----------------------------------------------------
2
+ 14 | () => () => io // error
3
3
| ^^
4
- |(io : Cap^) cannot be referenced here; it is not included in the allowed capture set {} of pure base class trait Pure
4
+ |(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 @@ -9,6 +9,7 @@ trait Box:
9
9
def main (): Unit =
10
10
val leaked = withCap : (io : Cap ^ ) =>
11
11
class Foo extends Box , Pure :
12
+ self =>
12
13
val get : () -> {} () -> {io} Cap ^ =
13
14
() => () => io // error
14
15
new Foo
Original file line number Diff line number Diff line change 36
36
16 | var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // error
37
37
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
38
| Found: scala.collection.mutable.ListBuffer[box () => Unit]
39
- | Required: scala.collection.mutable.ListBuffer[box () ->? Unit]
39
+ | Required: scala.collection.mutable.ListBuffer[box () ->? Unit]^?
40
40
|
41
41
| Note that the universal capability `cap`
42
42
| cannot be included in capture set ? of variable finalizeActions
You can’t perform that action at this time.
0 commit comments