Skip to content

Commit

Permalink
Fix isAlwaysPure
Browse files Browse the repository at this point in the history
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}`.
  • Loading branch information
odersky committed Jul 10, 2024
1 parent 8a504aa commit fb54ee1
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions compiler/src/dotty/tools/dotc/cc/CaptureOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ extension (tp: Type)
val sym = tp.typeSymbol
if sym.isClass then sym.isPureClass
else tp.superType.isAlwaysPure
case CapturingType(parent, refs) =>
parent.isAlwaysPure || refs.isAlwaysEmpty
case tp: TypeProxy =>
tp.superType.isAlwaysPure
case tp: AndType =>
Expand Down

0 comments on commit fb54ee1

Please sign in to comment.