aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-20 10:06:31 +0100
committerTobias Schlatter <tobias@meisch.ch>2014-03-21 11:28:30 +0100
commit7e1343e86a0d2575d596198d0f889b7d64cdb5a4 (patch)
tree20eec46b99b6f025d4644cbbb2422f361443e7fe /src/dotty/tools
parent0dda8a1858c162f74f76a1d4dae158e99a250267 (diff)
downloaddotty-7e1343e86a0d2575d596198d0f889b7d64cdb5a4.tar.gz
dotty-7e1343e86a0d2575d596198d0f889b7d64cdb5a4.tar.bz2
dotty-7e1343e86a0d2575d596198d0f889b7d64cdb5a4.zip
Refactored lookupRefined
Turned parameter into receiver (reciever was not used before at all).
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala4
-rw-r--r--src/dotty/tools/dotc/core/Types.scala16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 753a72dd0..d66d4069c 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -640,14 +640,14 @@ class TypeComparer(initctx: Context) extends DotClass {
* if it is not instantiated we compare type parameter bounds
* and also compare variances.
*/
- def isSubTypeHK(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubTypeHK(${tp1.show}, ${tp2.show}") {
+ def isSubTypeHK(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubTypeHK(${tp1.show}, ${tp2.show}", subtyping) {
val tparams = tp1.typeParams
val argInfos1 = tp1.argInfos
val args1 =
if (argInfos1.nonEmpty) argInfos1 // tp1 is instantiated, use the argument infos
else { // tp1 is uninstantiated, use the parameter bounds
val base = tp1.narrow
- tparams.map(base.memberInfo)
+ tparams.map(base.memberInfo)
}
val hkArgs = tp2.argInfos
hk.println(s"isSubTypeHK: args1 = $args1, hkargs = $hkArgs")
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 38c07d99a..e9c3c56b2 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -625,11 +625,11 @@ object Types {
*
* to just U
*/
- def lookupRefined(pre: Type, name: Name)(implicit ctx: Context): Type = pre.stripTypeVar match {
+ def lookupRefined(name: Name)(implicit ctx: Context): Type = stripTypeVar match {
case pre: RefinedType =>
- if (pre.refinedName ne name) lookupRefined(pre.parent, name)
+ if (pre.refinedName ne name) pre.parent.lookupRefined(name)
else pre.refinedInfo match {
- case TypeBounds(lo, hi) if lo eq hi => hi
+ case TypeBounds(lo, hi) /*if lo eq hi*/ => hi
case _ => NoType
}
case pre: WildcardType =>
@@ -643,7 +643,7 @@ object Types {
case name: TermName =>
TermRef(this, name)
case name: TypeName =>
- val res = lookupRefined(this, name)
+ val res = lookupRefined(name)
if (res.exists) res else TypeRef(this, name)
}
@@ -652,7 +652,7 @@ object Types {
case name: TermName =>
TermRef(this, name, denot)
case name: TypeName =>
- val res = lookupRefined(this, name)
+ val res = lookupRefined(name)
if (res.exists) res else TypeRef(this, name, denot)
}
@@ -660,7 +660,7 @@ object Types {
def select(sym: Symbol)(implicit ctx: Context): Type =
if (sym.isTerm) TermRef(this, sym.asTerm)
else {
- val res = lookupRefined(this, sym.name)
+ val res = lookupRefined(sym.name)
if (res.exists) res else TypeRef(this, sym.asType)
}
@@ -1114,7 +1114,7 @@ object Types {
def derivedSelect(prefix: Type)(implicit ctx: Context): Type =
if (prefix eq this.prefix) this
else {
- val res = lookupRefined(prefix, name)
+ val res = prefix.lookupRefined(name)
if (res.exists) res else newLikeThis(prefix)
}
@@ -2299,7 +2299,7 @@ object Types {
case tp: TypeRef =>
if (stopAtStatic && tp.symbol.isStatic) x
else {
- val tp1 = tp.lookupRefined(tp.prefix, tp.name)
+ val tp1 = tp.prefix.lookupRefined(tp.name)
this(x, if (tp1.exists) tp1 else tp.prefix)
}
case tp: TermRef =>