scala/scala — pull request #4099 by retronym (2014-11-06 08:19:17+00:00)
Title: SI-7596 Curtail overloaded symbols during unpickling

In code like:

object O { val x = A; def x(a: Any) = ... }
object P extends O.x.A

The unpickler was using an overloaded symbol for `x` in the
parent type of `P`. This led to compilation failures under
separate compilation.

The code that leads to this is in `Unpicklers`:

def fromName(name: Name) = name.toTermName match {
case nme.ROOT => loadingMirror.RootClass
case nme.ROOTPKG => loadingMirror.RootPackage
case _ => adjust(owner.info.decl(name))
}

This commit filters the overloaded symbol based its stability
unpickling a singleton type. That seemed a slightly safer place
than in `fromName`.

Resubmission of #2664 incorporating review from @gkossakowski.

Review by @gkossakowski :)