aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-14 17:15:32 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-14 17:15:32 +0100
commit86e35e48bb7916b6c2e35147973d2572a29b93c3 (patch)
tree7217d2c19a211f4c8852cd48ad5005105f2f562c /src/dotty/tools/dotc/core/Types.scala
parent8103c64854c8024927912fd27ce101e1fbc04470 (diff)
downloaddotty-86e35e48bb7916b6c2e35147973d2572a29b93c3.tar.gz
dotty-86e35e48bb7916b6c2e35147973d2572a29b93c3.tar.bz2
dotty-86e35e48bb7916b6c2e35147973d2572a29b93c3.zip
Use symbolic refs when testing whether a TypeBounds contains a ClassInfo
Without the fix and the later commit that checks types for overriding we get a Ycheck failure in t3452h.scala.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 0691d979a..21b74e07b 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2663,11 +2663,13 @@ object Types {
def clsDenot = if (prefix eq cls.owner.thisType) cls.denot else cls.denot.copySymDenotation(info = this)
if (typeRefCache == null)
typeRefCache =
- if ((cls is PackageClass) || cls.owner.isTerm) prefix select cls
- else prefix select (cls.name, clsDenot)
+ if ((cls is PackageClass) || cls.owner.isTerm) symbolicTypeRef
+ else TypeRef(prefix, cls.name, clsDenot)
typeRefCache
}
+ def symbolicTypeRef(implicit ctx: Context): Type = TypeRef(prefix, cls)
+
// cached because baseType needs parents
private var parentsCache: List[TypeRef] = null
@@ -2732,8 +2734,12 @@ object Types {
case _ => this
}
- def contains(tp: Type)(implicit ctx: Context) = tp match {
+ def contains(tp: Type)(implicit ctx: Context): Boolean = tp match {
case tp: TypeBounds => lo <:< tp.lo && tp.hi <:< hi
+ case tp: ClassInfo =>
+ // Note: Taking a normal typeRef does not work here. A normal ref might contain
+ // also other information about the named type (e.g. bounds).
+ contains(tp.symbolicTypeRef)
case _ => lo <:< tp && tp <:< hi
}