mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user