From 60533e82c898d0ead48850fa877620202337c770 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 11 Aug 2009 07:22:25 +0000 Subject: Fix of #1722 --- .../scala/tools/nsc/symtab/classfile/UnPickler.scala | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala index f2aa736656..87bf879980 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala @@ -182,10 +182,19 @@ abstract class UnPickler { case EXTref | EXTMODCLASSref => val name = readNameRef() val owner = if (readIndex == end) definitions.RootClass else readSymbolRef() - sym = if (name.toTermName == nme.ROOT) definitions.RootClass - else if (name == nme.ROOTPKG) definitions.RootPackage - else if (tag == EXTref) owner.info.decl(name) - else owner.info.decl(name).moduleClass + def fromName(name: Name) = + if (name.toTermName == nme.ROOT) definitions.RootClass + else if (name == nme.ROOTPKG) definitions.RootPackage + else if (tag == EXTref) owner.info.decl(name) + else owner.info.decl(name).moduleClass + sym = fromName(name) + // If sym not found try with expanded name. + // This can happen if references to private symbols are + // read from outside; for instance when checking the children of a class + // (see t1722) + if (sym == NoSymbol) { + sym = fromName(owner.expandedName(name)) + } // If the owner is overloaded (i.e. a method), it's not possible to select the // right member => return NoSymbol. This can only happen when unpickling a tree. -- cgit v1.2.3