aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-17 14:16:19 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-17 14:16:19 +0200
commit6e723202409d69cd6e6399d58a9d4fb7b2b337d4 (patch)
treed279b6efd0d4e08555a5289fb8e0753160662e13 /src/dotty/tools/dotc/core/Types.scala
parentdfa32801f5b2c774a8c792353c1bf1d1781a4a0e (diff)
downloaddotty-6e723202409d69cd6e6399d58a9d4fb7b2b337d4.tar.gz
dotty-6e723202409d69cd6e6399d58a9d4fb7b2b337d4.tar.bz2
dotty-6e723202409d69cd6e6399d58a9d4fb7b2b337d4.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala6
1 files changed, 1 insertions, 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
}