From 6e723202409d69cd6e6399d58a9d4fb7b2b337d4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 17 Jul 2016 14:16:19 +0200 Subject: Fix computation of parent types of a classinfo. The previously used `rebase` did not rewrire outer this references. The right thing to do here is an asSeenFrom. --- src/dotty/tools/dotc/core/Types.scala | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 11da27265..754757a7f 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2993,10 +2993,6 @@ object Types { /** The class type with all type parameters */ def fullyAppliedRef(implicit ctx: Context): Type = fullyAppliedRef(cls.typeRef, cls.typeParams) - def rebase(tp: Type)(implicit ctx: Context): Type = - if ((prefix eq cls.owner.thisType) || !cls.owner.isClass || ctx.erasedTypes) tp - else tp.substThis(cls.owner.asClass, prefix) - private var typeRefCache: TypeRef = null def typeRef(implicit ctx: Context): TypeRef = { @@ -3016,7 +3012,7 @@ object Types { /** The parent type refs as seen from the given prefix */ override def parents(implicit ctx: Context): List[TypeRef] = { if (parentsCache == null) - parentsCache = cls.classParents.mapConserve(rebase(_).asInstanceOf[TypeRef]) + parentsCache = cls.classParents.mapConserve(_.asSeenFrom(prefix, cls.owner).asInstanceOf[TypeRef]) parentsCache } -- cgit v1.2.3