Skip to content

Commit 1d5049d

Browse files
OlivierBlanvillainolsdavis
authored andcommitted
Make normalizing superTypes valid nowhere
1 parent b1f784e commit 1d5049d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4109,18 +4109,17 @@ object Types {
41094109

41104110
override def underlying(using Context): Type = tycon
41114111

4112-
override def superType(using Context): Type = {
4113-
if (ctx.period != validSuper) {
4114-
cachedSuper = tycon match {
4112+
override def superType(using Context): Type =
4113+
if ctx.period != validSuper then
4114+
validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4115+
cachedSuper = tycon match
41154116
case tycon: HKTypeLambda => defn.AnyType
41164117
case tycon: TypeRef if tycon.symbol.isClass => tycon
4117-
case tycon: TypeProxy => tycon.superType.applyIfParameterized(args).normalized
4118+
case tycon: TypeProxy =>
4119+
if isMatchAlias then validSuper = Nowhere
4120+
tycon.superType.applyIfParameterized(args).normalized
41184121
case _ => defn.AnyType
4119-
}
4120-
validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4121-
}
41224122
cachedSuper
4123-
}
41244123

41254124
override def translucentSuperType(using Context): Type = tycon match {
41264125
case tycon: TypeRef if tycon.symbol.isOpaqueAlias =>

0 commit comments

Comments
 (0)