scala/scala — comment on commit c11ec6f532449f110c3b776b11f0b2c4398fe0f9
File:  line 0
By adriaanm:

interesting -- I was just working on adaptConstrPattern to get rid of the redundancy typing case class unapplies (unsoundly) and typedApply's (sound) treatment of non-case class extractors

the main role of adaptConstrPattern as I see it is now to resolve overloading (it hasn't happened yet in stabilize since we're in funMode)

{code}

def adaptConstrPattern(): Tree = { // (5)
// resolve overloaded symbol to one that has an unapply/unapplySeq member
val extractor = tree.symbol.filter(sym => reallyExists(unapplyMember(sym.tpe)))
if (extractor != NoSymbol) {
tree setSymbol extractor
tree.tpe match { // resolve overload on tree's type as well
case OverloadedType(pre, alts) if alts contains extractor =>
if (extractor.isModule) tree setType singleType(pre, extractor)
else tree setType pre.memberType(extractor) // is this ever reached?
case _ =>
tree
}
} else {
CaseClassConstructorError(tree)
}
}
{code}