Sema: Correctly resolve the metatype of '.member's found by optional unwrapping.

If the lookup was resolved by optional unwrapping, unwrap the metatype when we apply the solution so we don't try to create an invalid metatype conversion from T?.Type to T.Type. Fixes <rdar://problem/17542185>.

Swift SVN r19500
This commit is contained in:
Joe Groff
2014-07-03 03:00:46 +00:00
parent 37d69a4207
commit f9440d0cb7
4 changed files with 39 additions and 3 deletions

View File

@@ -2831,10 +2831,12 @@ ConstraintSystem::simplifyMemberConstraint(const Constraint &constraint) {
ovlBaseTy = MetatypeType::get(baseTy->castTo<MetatypeType>()
->getInstanceType()
->getAnyOptionalObjectType());
choices.push_back(OverloadChoice::getDeclViaUnwrappedOptional(ovlBaseTy,
result));
} else {
choices.push_back(OverloadChoice(ovlBaseTy, result,
/*isSpecialized=*/false));
}
choices.push_back(OverloadChoice(ovlBaseTy, result,
/*isSpecialized=*/false));
};
// Add all results from this lookup.