scala/scala — pull request #2292 by retronym (2013-03-23 11:55:25+00:00)
Title: SI-7285 Fix match analysis with nested objects

The fix for SI-6146 introduced `nestedMemberType` to
figure out set of the sealed subtypes based on the
(prefixed) type of the scrutinee and the symbols of its
sealed subclasses. That method needed to widen
`ThisType(modSym)`s to `ModuleTypeRef(modSym)` before
calling `asSeenFrom`.

However, this could lead to the sealed subtypes being
`ModuleTypeRef`s were not =:= to the singleton type on the module.
The pattern matcher analysis treated them as distinct, and spurious
warnings ensued.

This commit makes two changes:

- conditionally re-narrow the result of `asSeenFrom` in `nestedMemberType`.
- present `a.b.SomeModule.type` as `SomeModule` in warnings emitted
by the pattern matcher.

Review by @adriaanm