From a77eb1592b5981419c99074caee876665bbf4daa Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 15 Apr 2016 14:04:23 +0200 Subject: Small improvements in Types 1) Print RefinedTypes with their hashCode so that we can correlated with RefinedThis types 2) Fast abort of instantiate in case we have determined that it is not safe anyway --- src/dotty/tools/dotc/core/Types.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index fa049815a..913339409 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -903,7 +903,9 @@ object Types { case pre: RefinedType => object instantiate extends TypeMap { var isSafe = true - def apply(tp: Type): Type = tp match { + def apply(tp: Type): Type = + if (!isSafe) tp + else tp match { case TypeRef(RefinedThis(`pre`), name) if name.isHkArgName => member(name).info match { case TypeAlias(alias) => alias @@ -2061,7 +2063,7 @@ object Types { false } override def computeHash = doHash(refinedName, refinedInfo, parent) - override def toString = s"RefinedType($parent, $refinedName, $refinedInfo)" + override def toString = s"RefinedType($parent, $refinedName, $refinedInfo | $hashCode)" } class CachedRefinedType(parent: Type, refinedName: Name, infoFn: RefinedType => Type) extends RefinedType(parent, refinedName) { -- cgit v1.2.3