From 604797b64518cbd75583e6ac14876552d6598c9d Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 15 Jan 2011 23:20:59 +0000 Subject: There were some shenanigans in normalize trying... There were some shenanigans in normalize trying to avoid cycles. Adriaan had recorded an idea about how to avoid them and I tried out my interpretation of it and it worked. He says it's good to go, so no review. --- src/compiler/scala/tools/nsc/symtab/Types.scala | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 03f4b088a5..a8f42cb552 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1762,7 +1762,9 @@ A type's typeSymbol should never be inspected directly. private def typeArgsOrDummies = if (!isHigherKinded) args else dummyArgs // @MAT was typeSymbol.unsafeTypeParams, but typeSymbol normalizes now - private def typeParamsDirect = sym.unsafeTypeParams + private def typeParamsDirect = + if (isDefinitionsInitialized) sym.typeParams + else sym.unsafeTypeParams // placeholders derived from type params private def dummyArgs = typeParamsDirect map (_.typeConstructor) //@M must be .typeConstructor @@ -1824,32 +1826,18 @@ A type's typeSymbol should never be inspected directly. betaReduce.normalize // beta-reduce, but don't do partial application -- cycles have been checked in typeRef else if (sym.isRefinementClass) sym.info.normalize // I think this is okay, but see #1241 (r12414), #2208, and typedTypeConstructor in Typers - // else if (args nonEmpty) { - // val argsNorm = args mapConserve (_.dealias) - // if(argsNorm ne args) TypeRef(pre, sym, argsNorm) - // else this - // } else { if(sym.isAliasType) ErrorType //println("!!error: "+(pre, sym, sym.info, sym.info.typeParams, args)) else super.normalize } - // track number of type parameters that we saw when caching normalization, - // so we can refresh our cache when the known list of type parameters changes (due to further class file loading) - // TODO: this would not be necessary if we could replace the call to sym.unsafeTypeParams in typeParamsDirect - // by a call to sym.typeParams, but need to verify that that does not lead to spurious "illegal cycle" errors - // the need for refreshing the cache is illustrated by #2278 // TODO: test case that is compiled in a specific order and in different runs - private var normalizeTyparCount = -1 - override def normalize: Type = { if (phase.erasedTypes) normalize0 else { - val len = typeParamsDirect.length - if (normalized == null || len != normalizeTyparCount) { - normalizeTyparCount = len + if (normalized == null) normalized = normalize0 - } + normalized } } -- cgit v1.2.3