aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-27 10:48:16 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-27 10:55:47 +0200
commitbfb328ff64dcfa103c91dd0cd55a617e370d6ef3 (patch)
treeb7003776657a486c8fbfac43a7812b10555b0d5a /src/dotty/tools/dotc/core/TypeComparer.scala
parent292ce6844a212b47defc671c91396d7cec86833b (diff)
downloaddotty-bfb328ff64dcfa103c91dd0cd55a617e370d6ef3.tar.gz
dotty-bfb328ff64dcfa103c91dd0cd55a617e370d6ef3.tar.bz2
dotty-bfb328ff64dcfa103c91dd0cd55a617e370d6ef3.zip
Make ThisTypes take TypeRefs instead of ClassSymbols
This avoids stale symbol errors and does not need the somewhat unsystematic symbol rebinding of the last commit.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 29f6dda69..fda9667e9 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -323,7 +323,7 @@ class TypeComparer(initctx: Context) extends DotClass {
}
tp.prefix match {
case RefinedThis(rt) => rebaseFrom(rt)
- case ThisType(cls) => rebaseFrom(cls.info)
+ case pre: ThisType => rebaseFrom(pre.cls.info)
case _ => tp
}
}
@@ -443,11 +443,11 @@ class TypeComparer(initctx: Context) extends DotClass {
// We treat two prefixes A.this, B.this as equivalent if
// A's selftype derives from B and B's selftype derives from A.
def equivalentThisTypes(tp1: Type, tp2: Type) = tp1 match {
- case ThisType(cls1) =>
+ case tp1: ThisType =>
tp2 match {
- case ThisType(cls2) =>
- cls1.classInfo.selfType.derivesFrom(cls2) &&
- cls2.classInfo.selfType.derivesFrom(cls1)
+ case tp2: ThisType =>
+ tp1.cls.classInfo.selfType.derivesFrom(tp2.cls) &&
+ tp2.cls.classInfo.selfType.derivesFrom(tp1.cls)
case _ => false
}
case _ => false
@@ -483,8 +483,8 @@ class TypeComparer(initctx: Context) extends DotClass {
)
else (tp1.name eq tp2.name) && isSameType(tp1.prefix, tp2.prefix)
) || isHKSubType || secondTryNamed(tp1, tp2)
- case ThisType(cls) if cls eq tp2.symbol.moduleClass =>
- isSubType(cls.owner.thisType, tp2.prefix)
+ case tp1: ThisType if tp1.cls eq tp2.symbol.moduleClass =>
+ isSubType(tp1.cls.owner.thisType, tp2.prefix)
case _ =>
isHKSubType || secondTry(tp1, tp2)
}
@@ -529,8 +529,8 @@ class TypeComparer(initctx: Context) extends DotClass {
def secondTry(tp1: Type, tp2: Type): Boolean = tp1 match {
case tp1: NamedType =>
tp2 match {
- case ThisType(cls) if cls eq tp1.symbol.moduleClass =>
- isSubType(tp1.prefix, cls.owner.thisType)
+ case tp2: ThisType if tp2.cls eq tp1.symbol.moduleClass =>
+ isSubType(tp1.prefix, tp2.cls.owner.thisType)
case _ =>
secondTryNamed(tp1, tp2)
}