Skip to content

Commit 91e548f

Browse files
Make normalizing superTypes valid nowhere
1 parent b9baa71 commit 91e548f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,18 +4105,20 @@ 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+
def reappliedSuper = tycon.superType.applyIfParameterized(args).normalized
4112+
cachedSuper = tycon match
41114113
case tycon: HKTypeLambda => defn.AnyType
4112-
case tycon: TypeRef if tycon.symbol.isClass => tycon
4113-
case tycon: TypeProxy => tycon.superType.applyIfParameterized(args).normalized
4114+
case tycon: TypeRef =>
4115+
if tycon.symbol.isClass then tycon
4116+
else
4117+
if tycon.info.isInstanceof[MatchAlias] then validSuper = Nowhere
4118+
reappliedSuper
4119+
case tycon: TypeProxy => reappliedSuper
41144120
case _ => defn.AnyType
4115-
}
4116-
validSuper = if (tycon.isProvisional) Nowhere else ctx.period
4117-
}
41184121
cachedSuper
4119-
}
41204122

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

0 commit comments

Comments
 (0)