From 9cd15421432871b920d377af86e1cd1b3edb270e Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 4 Apr 2013 09:57:15 +0200 Subject: Trying to get at the root of cyclic reference problems. Part 1: Enabling tracing and avoiding subtype computations in margeDenot. --- src/dotty/tools/dotc/core/TypeOps.scala | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/dotty/tools/dotc/core/TypeOps.scala') diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index f86cc5296..7b09df769 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -19,32 +19,32 @@ trait TypeOps { this: Context => else toPrefix(pre.baseType(cls).normalizedPrefix, cls.owner, thiscls) - /* !!! DEBUG ctx.traceIndented(s"$tp.asSeenFrom($pre, $cls)") */ { - tp match { - case tp: NamedType => - val sym = tp.symbol - if (sym.isStatic) tp - else { - val tp1 = tp.derivedNamedType(asSeenFrom(tp.prefix, pre, cls, theMap)) - // short-circuit instantiated type parameters - if ((tp1 ne tp) && (sym is (TypeParam, butNot = Deferred))) tp1.dealias - else tp1 - } - case ThisType(thiscls) => - toPrefix(pre, cls, thiscls) - case _: BoundType | NoPrefix => - tp - case tp: RefinedType => - tp.derivedRefinedType( + ctx.traceIndented(s"$tp.asSeenFrom($pre, $cls)") { + tp match { + case tp: NamedType => + val sym = tp.symbol + if (sym.isStatic) tp + else { + val tp1 = tp.derivedNamedType(asSeenFrom(tp.prefix, pre, cls, theMap)) + // short-circuit instantiated type parameters + if ((tp1 ne tp) && (sym is (TypeParam, butNot = Deferred))) tp1.dealias + else tp1 + } + case ThisType(thiscls) => + toPrefix(pre, cls, thiscls) + case _: BoundType | NoPrefix => + tp + case tp: RefinedType => + tp.derivedRefinedType( asSeenFrom(tp.parent, pre, cls, theMap), tp.refinedName, asSeenFrom(tp.refinedInfo, pre, cls, theMap)) - case _ => - (if (theMap != null) theMap else new AsSeenFromMap(pre, cls)) - .mapOver(tp) + case _ => + (if (theMap != null) theMap else new AsSeenFromMap(pre, cls)) + .mapOver(tp) + } } } - } class AsSeenFromMap(pre: Type, cls: Symbol) extends TypeMap { def apply(tp: Type) = asSeenFrom(tp, pre, cls, this) -- cgit v1.2.3