summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-07-07 05:45:08 -0700
committerPaul Phillips <paulp@improving.org>2012-07-07 05:45:08 -0700
commit946f51c8d8aefe23c939d3f46b97332a33e30c66 (patch)
treea3fb4cd3ec8fc7a997b8330444f42dfb6e3577b0 /src/reflect
parentf2dbe673756302d5f5824fd8d0e6e3b3eb45a57b (diff)
downloadscala-946f51c8d8aefe23c939d3f46b97332a33e30c66.tar.gz
scala-946f51c8d8aefe23c939d3f46b97332a33e30c66.tar.bz2
scala-946f51c8d8aefe23c939d3f46b97332a33e30c66.zip
Eliminated some code in asSeenFrom.
Paraphrasing martin, BaseTypeSeqs are now computed lazily so the cycle "asSeenFrom -> generates BaseTypeSeq -> generates Refinement of baseType -> needs asSeenFrom" no longer takes place. Review by @odersky.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 96a6d4bba0..56cc265e48 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -4293,18 +4293,6 @@ trait Types extends api.Types { self: SymbolTable =>
qvar
}).tpe
- /** Return `pre.baseType(clazz)`, or if that's `NoType` and `clazz` is a refinement, `pre` itself.
- * See bug397.scala for an example where the second alternative is needed.
- * The problem is that when forming the base type sequence of an abstract type,
- * any refinements in the base type list might be regenerated, and thus acquire
- * new class symbols. However, since refinements always have non-interesting prefixes
- * it looks OK to me to just take the prefix directly. */
- def base(pre: Type, clazz: Symbol) = {
- val b = pre.baseType(clazz)
- if (b == NoType && clazz.isRefinementClass) pre
- else b
- }
-
def apply(tp: Type): Type =
if ((pre eq NoType) || (pre eq NoPrefix) || !clazz.isClass) tp
else tp match {
@@ -4325,7 +4313,7 @@ trait Types extends api.Types { self: SymbolTable =>
pre1
}
} else {
- toPrefix(base(pre, clazz).prefix, clazz.owner)
+ toPrefix(pre.baseType(clazz).prefix, clazz.owner)
}
toPrefix(pre, clazz)
case SingleType(pre, sym) =>
@@ -4405,7 +4393,7 @@ trait Types extends api.Types { self: SymbolTable =>
case t =>
throwError
}
- } else toInstance(base(pre, clazz).prefix, clazz.owner)
+ } else toInstance(pre.baseType(clazz).prefix, clazz.owner)
}
toInstance(pre, clazz)
case _ =>