mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge branch 'master' into remove-swift-3-in-expr-typechecking
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user