From 45cf39b3eed55dbb76fe298c533f8e26631660f3 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 22 Jul 2008 11:30:53 +0000 Subject: trying to fix build --- .../scala/tools/nsc/symtab/BaseTypeSeqs.scala | 30 +++++++++++++++++----- src/compiler/scala/tools/nsc/symtab/Types.scala | 2 +- 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala b/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala index 9947aa5209..e7d5a3daa2 100755 --- a/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala +++ b/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala @@ -32,7 +32,24 @@ trait BaseTypeSeqs { def length: Int = elems.length /** The type at i'th position in this sequence; lazy types are returned evaluated. */ - def apply(i: Int): Type = elems(i) + def apply(i: Int): Type = elems(i) /* +match { + case RefinedType(variants, decls) => + // can't assert decls.isEmpty; see t0764 + //if (!decls.isEmpty) assert(false, "computing closure of "+this+":"+this.isInstanceOf[RefinedType]+"/"+closureCache(j)) + //Console.println("compute closure of "+this+" => glb("+variants+")") + mergePrefixAndArgs(variants, -1, maxBaseTypeSeqDepth(variants) + LubGlbMargin) match { + case Some(tp0) => + elems(i) = tp0 + tp0 + case None => throw new TypeError( + "the type intersection "+(parents mkString " with ")+" is malformed"+ + "\n --- because ---"+ + "\n no common type instance of base types "+(variants mkString ", and ")+" exists.") + } + case tp => + tp + }*/ /** The type symbol of the type at i'th position in this sequence; * no evaluation needed. @@ -63,6 +80,7 @@ trait BaseTypeSeqs { // (0 until length) exists (i => p(this(i))) def normalize(parents: List[Type]) { +/* var j = 0 while (j < elems.length) { elems(j) match { @@ -81,6 +99,7 @@ trait BaseTypeSeqs { } j += 1 } +*/ } lazy val maxDepth: Int = { @@ -101,7 +120,9 @@ trait BaseTypeSeqs { def baseTypeSingletonSeq(tp: Type): BaseTypeSeq = new BaseTypeSeq(Array(tp)) /** Create the base type sequence of a compound type wuth given tp.parents */ - def compoundBaseTypeSeq(tsym: Symbol, parents: List[Type]): BaseTypeSeq = { + def compoundBaseTypeSeq(tp: CompoundType): BaseTypeSeq = { + val tsym = tp.typeSymbol + val parents = tp.parents // Console.println("computing baseTypeSeq of " + tsym.tpe + " " + parents)//DEBUG val buf = new ListBuffer[Type] buf += tsym.tpe @@ -149,9 +170,7 @@ trait BaseTypeSeqs { val elems = new Array[Type](btsSize) buf.copyToArray(elems, 0) // Console.println("computed baseTypeSeq of " + tsym.tpe + " " + parents + ": "+elems.toString)//DEBUG - new BaseTypeSeq(elems) - } -/* + tp.baseTypeSeqCache = new BaseTypeSeq(elems) var j = 0 while (j < btsSize) { elems(j) match { @@ -172,5 +191,4 @@ trait BaseTypeSeqs { } tp.baseTypeSeqCache } -*/ } diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 6584741fa1..0ddeb49996 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1035,7 +1035,7 @@ trait Types { if (util.Statistics.enabled) compoundBaseTypeSeqCount += 1 baseTypeSeqCache = undetBaseTypeSeq - baseTypeSeqCache = memo(compoundBaseTypeSeq(typeSymbol, parents))(_.baseTypeSeq updateHead typeSymbol.tpe) + baseTypeSeqCache = memo(compoundBaseTypeSeq(this/*typeSymbol, parents*/))(_.baseTypeSeq updateHead typeSymbol.tpe) // println("normalizing baseTypeSeq of "+typeSymbol+"/"+parents+": "+baseTypeSeqCache)//DEBUG baseTypeSeqCache.normalize(parents) // println("normalized baseTypeSeq of "+typeSymbol+"/"+parents+": "+baseTypeSeqCache)//DEBUG -- cgit v1.2.3