Skip to content

Commit 16a84fc

Browse files
committed
AST: Rename ProtocolDecl::getExistentialType() to getDeclaredExistentialType()
1 parent d88e701 commit 16a84fc

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4721,7 +4721,7 @@ class ProtocolDecl final : public NominalTypeDecl {
47214721
AssociatedTypeDecl *getAssociatedType(Identifier name) const;
47224722

47234723
/// Returns the existential type for this protocol.
4724-
Type getExistentialType() const {
4724+
Type getDeclaredExistentialType() const {
47254725
return ExistentialType::get(getDeclaredInterfaceType());
47264726
}
47274727

lib/AST/ASTContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ Type ASTContext::get##NAME##Type() const { \
930930
#include "swift/AST/KnownStdlibTypes.def"
931931

932932
CanType ASTContext::getErrorExistentialType() const {
933-
if (auto exn = getErrorDecl()) {
934-
return exn->getExistentialType()->getCanonicalType();
933+
if (auto *errorProto = getErrorDecl()) {
934+
return errorProto->getDeclaredExistentialType()->getCanonicalType();
935935
} else {
936936
// Use Builtin.NativeObject just as a stand-in.
937937
return TheNativeObjectType;
@@ -2605,7 +2605,7 @@ ASTContext::getSelfConformance(ProtocolDecl *protocol) {
26052605
auto &entry = selfConformances[protocol];
26062606
if (!entry) {
26072607
entry = new (*this, AllocationArena::Permanent)
2608-
SelfProtocolConformance(protocol->getExistentialType());
2608+
SelfProtocolConformance(protocol->getDeclaredExistentialType());
26092609
}
26102610
return entry;
26112611
}

lib/SILGen/SILGenType.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ static SILFunction *emitSelfConformanceWitness(SILGenModule &SGM,
866866

867867
// Open the protocol type.
868868
auto openedType = OpenedArchetypeType::get(
869-
protocol->getExistentialType()->getCanonicalType(), GenericSignature());
869+
protocol->getDeclaredExistentialType()->getCanonicalType(),
870+
GenericSignature());
870871

871872
// Form the substitutions for calling the witness.
872873
auto witnessSubs = SubstitutionMap::getProtocolSubstitutions(protocol,

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8118,7 +8118,7 @@ static bool isCastToExpressibleByNilLiteral(ConstraintSystem &cs, Type fromType,
81188118
if (!nilLiteral)
81198119
return false;
81208120

8121-
return toType->isEqual(nilLiteral->getExistentialType()) &&
8121+
return toType->isEqual(nilLiteral->getDeclaredExistentialType()) &&
81228122
fromType->getOptionalObjectType();
81238123
}
81248124

lib/Sema/TypeCheckType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static Type applyGenericArguments(Type type, TypeResolution resolution,
759759
if (resolution.getOptions().isConstraintImplicitExistential() && !ctx.LangOpts.hasFeature(Feature::ImplicitSome)) {
760760
diags.diagnose(loc, diag::existential_requires_any,
761761
protoDecl->getDeclaredInterfaceType(),
762-
protoDecl->getExistentialType(),
762+
protoDecl->getDeclaredExistentialType(),
763763
/*isAlias=*/isa<TypeAliasType>(type.getPointer()));
764764

765765
return ErrorType::get(ctx);
@@ -4790,7 +4790,7 @@ class ExistentialTypeVisitor
47904790
Ctx.Diags.diagnose(comp->getNameLoc(),
47914791
diag::existential_requires_any,
47924792
proto->getDeclaredInterfaceType(),
4793-
proto->getExistentialType(),
4793+
proto->getDeclaredExistentialType(),
47944794
/*isAlias=*/false)
47954795
.fixItReplace(replaceRepr->getSourceRange(), fix);
47964796
}

0 commit comments

Comments
 (0)