Skip to content

Commit 6e72320

Browse files
committed
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.
1 parent dfa3280 commit 6e72320

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,10 +2993,6 @@ object Types {
29932993
/** The class type with all type parameters */
29942994
def fullyAppliedRef(implicit ctx: Context): Type = fullyAppliedRef(cls.typeRef, cls.typeParams)
29952995

2996-
def rebase(tp: Type)(implicit ctx: Context): Type =
2997-
if ((prefix eq cls.owner.thisType) || !cls.owner.isClass || ctx.erasedTypes) tp
2998-
else tp.substThis(cls.owner.asClass, prefix)
2999-
30002996
private var typeRefCache: TypeRef = null
30012997

30022998
def typeRef(implicit ctx: Context): TypeRef = {
@@ -3016,7 +3012,7 @@ object Types {
30163012
/** The parent type refs as seen from the given prefix */
30173013
override def parents(implicit ctx: Context): List[TypeRef] = {
30183014
if (parentsCache == null)
3019-
parentsCache = cls.classParents.mapConserve(rebase(_).asInstanceOf[TypeRef])
3015+
parentsCache = cls.classParents.mapConserve(_.asSeenFrom(prefix, cls.owner).asInstanceOf[TypeRef])
30203016
parentsCache
30213017
}
30223018

0 commit comments

Comments
 (0)