Implicitly look through UncheckedOptional<T> when it's the

base of a member access or subscript.

Swift SVN r12345
This commit is contained in:
John McCall
2014-01-15 21:00:59 +00:00
parent 1ccf23487e
commit 7be7c20a27
5 changed files with 190 additions and 25 deletions

View File

@@ -1328,6 +1328,11 @@ ConstraintSystem::simplifyMemberConstraint(const Constraint &constraint) {
Type baseTy = simplifyType(constraint.getFirstType());
Type baseObjTy = baseTy->getRValueType();
// Try to look through UncheckedOptional<T>; the result is always an r-value.
if (auto objTy = lookThroughUncheckedOptionalType(baseObjTy)) {
baseTy = baseObjTy = objTy;
}
// Dig out the instance type.
bool isMetatype = false;
Type instanceTy = baseObjTy;