@@ -3945,15 +3945,15 @@ Type TypeChecker::substMemberTypeWithBase(ModuleDecl *module,
3945
3945
3946
3946
namespace {
3947
3947
3948
- class UnsupportedProtocolVisitor
3949
- : public TypeReprVisitor<UnsupportedProtocolVisitor >, public ASTWalker
3948
+ class ExistentialTypeVisitor
3949
+ : public TypeReprVisitor<ExistentialTypeVisitor >, public ASTWalker
3950
3950
{
3951
3951
ASTContext &Ctx;
3952
3952
bool checkStatements;
3953
3953
bool hitTopStmt;
3954
3954
3955
3955
public:
3956
- UnsupportedProtocolVisitor (ASTContext &ctx, bool checkStatements)
3956
+ ExistentialTypeVisitor (ASTContext &ctx, bool checkStatements)
3957
3957
: Ctx(ctx), checkStatements(checkStatements), hitTopStmt(false ) { }
3958
3958
3959
3959
bool walkToTypeReprPre (TypeRepr *T) override {
@@ -4008,60 +4008,60 @@ class UnsupportedProtocolVisitor
4008
4008
4009
4009
} // end anonymous namespace
4010
4010
4011
- void TypeChecker::checkUnsupportedProtocolType (Decl *decl) {
4011
+ void TypeChecker::checkExistentialTypes (Decl *decl) {
4012
4012
if (!decl || decl->isInvalid ())
4013
4013
return ;
4014
4014
4015
4015
auto &ctx = decl->getASTContext ();
4016
4016
if (auto *protocolDecl = dyn_cast<ProtocolDecl>(decl)) {
4017
- checkUnsupportedProtocolType (ctx, protocolDecl->getTrailingWhereClause ());
4017
+ checkExistentialTypes (ctx, protocolDecl->getTrailingWhereClause ());
4018
4018
} else if (auto *genericDecl = dyn_cast<GenericTypeDecl>(decl)) {
4019
- checkUnsupportedProtocolType (ctx, genericDecl->getGenericParams ());
4020
- checkUnsupportedProtocolType (ctx, genericDecl->getTrailingWhereClause ());
4019
+ checkExistentialTypes (ctx, genericDecl->getGenericParams ());
4020
+ checkExistentialTypes (ctx, genericDecl->getTrailingWhereClause ());
4021
4021
} else if (auto *assocType = dyn_cast<AssociatedTypeDecl>(decl)) {
4022
- checkUnsupportedProtocolType (ctx, assocType->getTrailingWhereClause ());
4022
+ checkExistentialTypes (ctx, assocType->getTrailingWhereClause ());
4023
4023
} else if (auto *extDecl = dyn_cast<ExtensionDecl>(decl)) {
4024
- checkUnsupportedProtocolType (ctx, extDecl->getTrailingWhereClause ());
4024
+ checkExistentialTypes (ctx, extDecl->getTrailingWhereClause ());
4025
4025
} else if (auto *subscriptDecl = dyn_cast<SubscriptDecl>(decl)) {
4026
- checkUnsupportedProtocolType (ctx, subscriptDecl->getGenericParams ());
4027
- checkUnsupportedProtocolType (ctx, subscriptDecl->getTrailingWhereClause ());
4026
+ checkExistentialTypes (ctx, subscriptDecl->getGenericParams ());
4027
+ checkExistentialTypes (ctx, subscriptDecl->getTrailingWhereClause ());
4028
4028
} else if (auto *funcDecl = dyn_cast<AbstractFunctionDecl>(decl)) {
4029
4029
if (!isa<AccessorDecl>(funcDecl)) {
4030
- checkUnsupportedProtocolType (ctx, funcDecl->getGenericParams ());
4031
- checkUnsupportedProtocolType (ctx, funcDecl->getTrailingWhereClause ());
4030
+ checkExistentialTypes (ctx, funcDecl->getGenericParams ());
4031
+ checkExistentialTypes (ctx, funcDecl->getTrailingWhereClause ());
4032
4032
}
4033
4033
}
4034
4034
4035
4035
if (isa<TypeDecl>(decl) || isa<ExtensionDecl>(decl))
4036
4036
return ;
4037
4037
4038
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ false );
4038
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ false );
4039
4039
decl->walk (visitor);
4040
4040
}
4041
4041
4042
- void TypeChecker::checkUnsupportedProtocolType (ASTContext &ctx, Stmt *stmt) {
4042
+ void TypeChecker::checkExistentialTypes (ASTContext &ctx, Stmt *stmt) {
4043
4043
if (!stmt)
4044
4044
return ;
4045
4045
4046
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ true );
4046
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ true );
4047
4047
stmt->walk (visitor);
4048
4048
}
4049
4049
4050
- void TypeChecker::checkUnsupportedProtocolType (
4050
+ void TypeChecker::checkExistentialTypes (
4051
4051
ASTContext &ctx, TrailingWhereClause *whereClause) {
4052
4052
if (whereClause == nullptr )
4053
4053
return ;
4054
4054
4055
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ false );
4055
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ false );
4056
4056
visitor.visitRequirements (whereClause->getRequirements ());
4057
4057
}
4058
4058
4059
- void TypeChecker::checkUnsupportedProtocolType (
4059
+ void TypeChecker::checkExistentialTypes (
4060
4060
ASTContext &ctx, GenericParamList *genericParams) {
4061
4061
if (genericParams == nullptr )
4062
4062
return ;
4063
4063
4064
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ false );
4064
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ false );
4065
4065
visitor.visitRequirements (genericParams->getRequirements ());
4066
4066
}
4067
4067
0 commit comments