aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-14 18:27:17 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-14 18:27:17 +0100
commit7ca40215f51a7a008dd1856b9813eabfd8121d8d (patch)
tree59150b0c23ed3ca2c3f170bf43f4c3973011da39 /src/dotty/tools/dotc/core/TypeOps.scala
parentffe9e2237956d167b51c9ab1e571a04163b525f7 (diff)
downloaddotty-7ca40215f51a7a008dd1856b9813eabfd8121d8d.tar.gz
dotty-7ca40215f51a7a008dd1856b9813eabfd8121d8d.tar.bz2
dotty-7ca40215f51a7a008dd1856b9813eabfd8121d8d.zip
Making as seenfrom reduce types.
Adding operattions select, derivedSelect which reduce combinations of typerefs over refinement types.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index 8d05a4324..c48a8e715 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -20,26 +20,12 @@ trait TypeOps { this: Context =>
toPrefix(pre.baseType(cls).normalizedPrefix, cls.owner, thiscls)
}
- ctx.debugTraceIndented(s"$tp.asSeenFrom($pre, $cls)") { // !!! DEBUG
+ ctx.conditionalTraceIndented(TypeOps.track , s"asSeen ${tp.show} from (${pre.show}, ${cls.show})", show = true) { // !!! DEBUG
tp match {
case tp: NamedType =>
val sym = tp.symbol
if (sym.isStatic) tp
- else {
- val tp1 = tp.derivedNamedType(asSeenFrom(tp.prefix, pre, cls, theMap))
- // Here's an explanation why we short-circuit instantiated type parameters.
- // Say you have This is translated to:
- //
- // class List[type T] ==> class List { type T; val hd: T }
- // xs: List[Int] ==> List { type T = Int }
- //
- // Then with the line above, xs.hd would have type xs.T
- //
- // But in Scala 2.x, its type is Int, which is the dealiased version
- // of xs.T. With the logic below, we get the same outcome as for 2.x.
- if ((tp1 ne tp) && (sym is (TypeParam, butNot = Deferred))) tp1.dealias // todo: why not TypeArgument?
- else tp1
- }
+ else tp.derivedSelect(asSeenFrom(tp.prefix, pre, cls, theMap))
case ThisType(thiscls) =>
toPrefix(pre, cls, thiscls)
case _: BoundType | NoPrefix =>
@@ -179,3 +165,7 @@ trait TypeOps { this: Context =>
}
}
+object TypeOps {
+
+ var track = false // !!!DEBUG
+}