mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Push ArchetypeType's API down to subclasses.
And clean up code that conditionally works only with certain kinds of archetype along the way.
This commit is contained in:
@@ -370,7 +370,7 @@ FOR_KNOWN_FOUNDATION_TYPES(CACHE_FOUNDATION_DECL)
|
||||
llvm::FoldingSet<BuiltinVectorType> BuiltinVectorTypes;
|
||||
llvm::FoldingSet<GenericSignature> GenericSignatures;
|
||||
llvm::FoldingSet<DeclName::CompoundDeclName> CompoundNames;
|
||||
llvm::DenseMap<UUID, ArchetypeType *> OpenedExistentialArchetypes;
|
||||
llvm::DenseMap<UUID, OpenedArchetypeType *> OpenedExistentialArchetypes;
|
||||
|
||||
/// List of Objective-C member conflicts we have found during type checking.
|
||||
std::vector<ObjCMethodConflict> ObjCMethodConflicts;
|
||||
@@ -4270,8 +4270,8 @@ DependentMemberType *DependentMemberType::get(Type base,
|
||||
return known;
|
||||
}
|
||||
|
||||
CanArchetypeType ArchetypeType::getOpened(Type existential,
|
||||
Optional<UUID> knownID) {
|
||||
CanOpenedArchetypeType OpenedArchetypeType::get(Type existential,
|
||||
Optional<UUID> knownID) {
|
||||
auto &ctx = existential->getASTContext();
|
||||
auto &openedExistentialArchetypes = ctx.getImpl().OpenedExistentialArchetypes;
|
||||
// If we know the ID already...
|
||||
@@ -4283,7 +4283,7 @@ CanArchetypeType ArchetypeType::getOpened(Type existential,
|
||||
auto result = found->second;
|
||||
assert(result->getOpenedExistentialType()->isEqual(existential) &&
|
||||
"Retrieved the wrong opened existential type?");
|
||||
return CanArchetypeType(result);
|
||||
return CanOpenedArchetypeType(result);
|
||||
}
|
||||
} else {
|
||||
// Create a new ID.
|
||||
@@ -4313,16 +4313,16 @@ CanArchetypeType ArchetypeType::getOpened(Type existential,
|
||||
layoutConstraint, *knownID);
|
||||
openedExistentialArchetypes[*knownID] = result;
|
||||
|
||||
return CanArchetypeType(result);
|
||||
return CanOpenedArchetypeType(result);
|
||||
}
|
||||
|
||||
CanType ArchetypeType::getAnyOpened(Type existential) {
|
||||
CanType OpenedArchetypeType::getAny(Type existential) {
|
||||
if (auto metatypeTy = existential->getAs<ExistentialMetatypeType>()) {
|
||||
auto instanceTy = metatypeTy->getInstanceType();
|
||||
return CanMetatypeType::get(ArchetypeType::getAnyOpened(instanceTy));
|
||||
return CanMetatypeType::get(OpenedArchetypeType::getAny(instanceTy));
|
||||
}
|
||||
assert(existential->isExistentialType());
|
||||
return ArchetypeType::getOpened(existential);
|
||||
return OpenedArchetypeType::get(existential);
|
||||
}
|
||||
|
||||
void TypeLoc::setInvalidType(ASTContext &C) {
|
||||
|
||||
Reference in New Issue
Block a user