aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-06 11:48:39 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-06 11:48:39 +0100
commit757bf2ecc0a5dc083f21f1dc6c9d22c3795f3790 (patch)
treed37b42c6e12f817c394b475f377ae6a8a8a31dab /src/dotty/tools/dotc/core/TypeOps.scala
parent1e70081069055630821bb6ca6c1e307e1ab074b4 (diff)
downloaddotty-757bf2ecc0a5dc083f21f1dc6c9d22c3795f3790.tar.gz
dotty-757bf2ecc0a5dc083f21f1dc6c9d22c3795f3790.tar.bz2
dotty-757bf2ecc0a5dc083f21f1dc6c9d22c3795f3790.zip
Streamlined implementation of asSeenFrom
The new implementation keeps symbolic references where possible
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index b81eb4a55..14872cf21 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -22,22 +22,15 @@ trait TypeOps { this: Context =>
val sym = tp.symbol
if (sym.isStatic) tp
else {
- val pre0 = tp.prefix
- val pre1 = asSeenFrom(pre0, pre, cls, theMap)
- if (pre1 eq pre0) tp
- else {
- val tp1 = NamedType(pre1, tp.name)
- if (sym is TypeParam) {
- // short-circuit instantiated type parameters
- // by replacing pre.tp with its alias, if it has one.
- tp1.info match {
- case TypeBounds(lo, hi) if lo eq hi =>
- return hi
- case _ =>
- }
+ val tp1 = tp.derivedNamedType(asSeenFrom(tp.prefix, pre, cls, theMap))
+ if ((tp1 ne tp) && (sym is TypeParam))
+ // short-circuit instantiated type parameters
+ // by replacing pre.tp with its alias, if it has one.
+ tp1.info match {
+ case TypeBounds(lo, hi) if lo eq hi => hi
+ case _ => tp1
}
- tp1
- }
+ else tp1
}
case ThisType(thiscls) =>
toPrefix(pre, cls, thiscls)