scala/scala — pull request #1887 by retronym (2013-01-13 10:53:13+00:00)
Title: SI-6951 Refine ClassTag based unapply after inference.

Before, we were getting:

typed ClassTag.apply[T#Branch](classOf[Tree$Branch]).unapply() (Matcher.unapply[Oak.type]() ((branch @ _))): T#Branch

This is problematic for two reasons:

- We don't actually need to use a class tag in
pattern matching, because after inference the
substituted formal type of the unapply method
is a concrete type, Oak.Branch.
- The class tag check delivers a T#Branch, which
doesn't line up with the required Oak.Branch
required by unapply.

Now, we use the inferred type argument `Oak.type` to
double check whether the type is in fact uncheckable,
and retain the inferred type.

In addition, we only consider class tags available
through normal implcits, we disable materialization.
See the code comments for an example of an uncheckable
type that for which a classtag can be materialized.

Review by @adriaanm