Skip to content

Commit 4333d3e

Browse files
committed
Fix isAlwaysPure
The condition on capturing types did not make sense. In a type T^{} with an empty capture set `T` can still be a type variable that's instantiated to a type with a capture set. Instead, T^cs is always pure if T is always pure. For instance `List[T]^{p}` is always pure. That's important in the context of the standard library, where such a type usually results from an instantiation of a type variable such as `C[T]^{p}`.
1 parent 1640340 commit 4333d3e

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ extension (tp: Type)
282282
val sym = tp.typeSymbol
283283
if sym.isClass then sym.isPureClass
284284
else tp.superType.isAlwaysPure
285-
case CapturingType(parent, refs) =>
286-
parent.isAlwaysPure || refs.isAlwaysEmpty
287285
case tp: TypeProxy =>
288286
tp.superType.isAlwaysPure
289287
case tp: AndType =>

0 commit comments

Comments
 (0)