Merge branch 'master' into remove-swift-3-in-expr-typechecking

This commit is contained in:
Mark Lacey
2018-07-11 20:55:32 -07:00
244 changed files with 9974 additions and 4467 deletions

View File

@@ -320,6 +320,9 @@ static bool isNonFinalClass(Type type) {
if (auto super = archetype->getSuperclass())
return isNonFinalClass(super);
if (type->isExistentialType())
return true;
return false;
}
@@ -5465,9 +5468,11 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
Type toInstanceType = toType;
// Look through metatypes
while (fromInstanceType->is<AnyMetatypeType>() &&
while ((fromInstanceType->is<UnresolvedType>() ||
fromInstanceType->is<AnyMetatypeType>()) &&
toInstanceType->is<ExistentialMetatypeType>()) {
fromInstanceType = fromInstanceType->castTo<AnyMetatypeType>()->getInstanceType();
if (!fromInstanceType->is<UnresolvedType>())
fromInstanceType = fromInstanceType->castTo<AnyMetatypeType>()->getInstanceType();
toInstanceType = toInstanceType->castTo<ExistentialMetatypeType>()->getInstanceType();
}