mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Fix yet another crash when accessing nested types of an existential
We diagnose usage of invalid existential types but we might still try to compute substitutions. Just whip up an ErrorType instead. Fixes <rdar://problem/16803384>. Swift SVN r29567
This commit is contained in:
@@ -1082,6 +1082,13 @@ ConstraintSystem::getTypeOfMemberReference(Type baseTy, ValueDecl *value,
|
||||
// Handle associated type lookup as a special case, horribly.
|
||||
// FIXME: This is an awful hack.
|
||||
if (auto assocType = dyn_cast<AssociatedTypeDecl>(value)) {
|
||||
// Error recovery path.
|
||||
if (baseObjTy->isOpenedExistential()) {
|
||||
Type memberTy = ErrorType::get(TC.Context);
|
||||
auto openedType = FunctionType::get(baseObjTy, memberTy);
|
||||
return { openedType, memberTy };
|
||||
}
|
||||
|
||||
// Refer to a member of the archetype directly.
|
||||
if (auto archetype = baseObjTy->getAs<ArchetypeType>()) {
|
||||
Type memberTy = archetype->getNestedTypeValue(value->getName());
|
||||
|
||||
Reference in New Issue
Block a user