scala/scala — pull request #2621 by retronym (2013-06-02 16:19:15+00:00)
Title: SI-7264 Initialize owner when searching for companion.

From ClassSymbol:

protected final def companionModule0: Symbol =
flatOwnerInfo.decl(name.toTermName).suchThat(sym => sym.isModuleNotMethod && (sym isCoDefinedWith this))

protected final def flatOwnerInfo: Type = {
if (needsFlatClasses)
info
owner.rawInfo
}

Note the call to `rawInfo`; in the enclosed test case, that gives
us back an uninitialized type for the module class of `Foo`, and
consequently we don't find the companion for `Foo.Values`.

This is another case of SI-6976. See the comments in the review of
that patch (https://github.com/scala/scala/pull/1910) for some
commit archaelology that shows why we're reluctant to force the owner
info more broadly than is done in this commit.

Review by @paulp / @lrytz

This PR is more a suggestion, rather than a final proposal. I lack confidence that the cycles we're afraid of are tested, and the intuition to craft said tests retrospectively.