Skip to content

Commit 39a52aa

Browse files
Make normalizing superTypes valid nowhere
1 parent b9baa71 commit 39a52aa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,21 @@ object Types {
41054105

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

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
4113+
case tycon: HKTypeLambda => defn.AnyType
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
4120+
case _ => defn.AnyType
4121+
cachedSuper
4122+
41084123
override def superType(using Context): Type = {
41094124
if (ctx.period != validSuper) {
41104125
cachedSuper = tycon match {

0 commit comments

Comments
 (0)