aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-15 14:04:23 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-15 14:04:23 +0200
commita77eb1592b5981419c99074caee876665bbf4daa (patch)
treecd3c8e3b64c1459d84d0ba0b941989de6a9ce036 /src/dotty/tools/dotc/core/Types.scala
parent74634c2a27539ade96d1e4dcab8f213a0bdbb465 (diff)
downloaddotty-a77eb1592b5981419c99074caee876665bbf4daa.tar.gz
dotty-a77eb1592b5981419c99074caee876665bbf4daa.tar.bz2
dotty-a77eb1592b5981419c99074caee876665bbf4daa.zip
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
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala6
1 files changed, 4 insertions, 2 deletions
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) {