|
Companion detection consults the scopes of enclosing Contexts during
typechecking to avoid the cycles that would ensue if we had to look
at into the info of enclosing class symbols. For example, this used
to typecheck:
object CC { val outer = 42 }
if ("".isEmpty) {
case class CC(c: Int)
CC.outer
}
This logic was not suitably hardened to find companions in exactly
the same nesting level.
After fixing this problem, a similar problem in `Namer::inCurrentScope`
could be solved to be more selective about synthesizing a companion
object. In particular, if a manually defined companion trails after
the case class, don't create an addiotional synthetic comanpanion object.
|