Skip to content

Commit a4fb041

Browse files
Make normalizing superTypes valid nowhere
1 parent b9baa71 commit a4fb041

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
@@ -4105,18 +4105,17 @@ object Types {
41054105

41064106
override def underlying(using Context): Type = tycon
41074107

4108-
override def superType(using Context): Type = {
4109-
if (ctx.period != validSuper) {
4110-
cachedSuper = tycon match {
4108+
override def superType(using Context): Type =
4109+
if ctx.period != validSuper then
4110+
validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4111+
cachedSuper = tycon match
41114112
case tycon: HKTypeLambda => defn.AnyType
41124113
case tycon: TypeRef if tycon.symbol.isClass => tycon
4113-
case tycon: TypeProxy => tycon.superType.applyIfParameterized(args).normalized
4114+
case tycon: TypeProxy =>
4115+
if isMatchAlias then validSuper = Nowhere
4116+
tycon.superType.applyIfParameterized(args).normalized
41144117
case _ => defn.AnyType
4115-
}
4116-
validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4117-
}
41184118
cachedSuper
4119-
}
41204119

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

0 commit comments

Comments
 (0)