From 2fb330d244ffcdfe7ee7115a544a0e4bcf5af97b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 1 Jun 2007 10:18:49 +0000 Subject: fixed bug1144 --- src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala | 2 +- src/compiler/scala/tools/nsc/symtab/Scopes.scala | 6 +++--- src/compiler/scala/tools/nsc/symtab/Types.scala | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala index e1d72105ca..8b36ad819f 100644 --- a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala +++ b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala @@ -41,7 +41,7 @@ trait AnnotationInfos { None } - private val symbolReifier = new SymbolReifier { + private object symbolReifier extends SymbolReifier { val symbols: AnnotationInfos.this.type = AnnotationInfos.this } diff --git a/src/compiler/scala/tools/nsc/symtab/Scopes.scala b/src/compiler/scala/tools/nsc/symtab/Scopes.scala index d63d51ac09..64f83ca75d 100644 --- a/src/compiler/scala/tools/nsc/symtab/Scopes.scala +++ b/src/compiler/scala/tools/nsc/symtab/Scopes.scala @@ -86,7 +86,7 @@ trait Scopes { */ private val MIN_HASH = 8 - if (size >= MIN_HASH) createHash + if (size >= MIN_HASH) createHash() def this() = this(null: ScopeEntry) @@ -138,7 +138,7 @@ trait Scopes { elems.tail = hashtable(i) hashtable(i) = elems } else if (size >= MIN_HASH) { - createHash + createHash() } } @@ -157,7 +157,7 @@ trait Scopes { enter(sym) } - private def createHash: unit = { + def createHash(): unit = { hashtable = new Array[ScopeEntry](HASHSIZE) enterInHash(elems) } diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 9cfec0d6e6..b26045f1d8 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2176,11 +2176,16 @@ A type's symbol should never be inspected directly. sym } else { var rebind0 = pre.findMember(sym.name, BRIDGE, 0, true) + if (rebind0 == NoSymbol && (sym hasFlag EXPANDEDNAME)) { + // problem is that symbols with expanded names might be in the wrong hash bucket + // in a previous scope. We account for that by re-creating the hash as a last attempt. + sym.owner.info.decls.createHash() + rebind0 = pre.findMember(sym.name, BRIDGE, 0, true) + } + if (rebind0 == NoSymbol) { assert(false, ""+pre+"."+sym+" does no longer exist, phase = "+phase) } /** The two symbols have the same fully qualified name */ def corresponds(sym1: Symbol, sym2: Symbol): boolean = sym1.name == sym2.name && (sym1.isPackageClass || corresponds(sym1.owner, sym2.owner)) - assert(sym != NoSymbol) - if (rebind0 == NoSymbol) assert(false, ""+pre+"."+sym+" does no longer exist, phase = "+phase) if (!corresponds(sym.owner, rebind0.owner)) { if (settings.debug.value) Console.println("ADAPT1 pre = "+pre+", sym = "+sym+sym.locationString+", rebind = "+rebind0+rebind0.locationString) val bcs = pre.baseClasses.dropWhile(bc => !corresponds(bc, sym.owner)); -- cgit v1.2.3