@@ -3927,15 +3927,15 @@ Type TypeChecker::substMemberTypeWithBase(ModuleDecl *module,
3927
3927
3928
3928
namespace {
3929
3929
3930
- class UnsupportedProtocolVisitor
3931
- : public TypeReprVisitor<UnsupportedProtocolVisitor >, public ASTWalker
3930
+ class ExistentialTypeVisitor
3931
+ : public TypeReprVisitor<ExistentialTypeVisitor >, public ASTWalker
3932
3932
{
3933
3933
ASTContext &Ctx;
3934
3934
bool checkStatements;
3935
3935
bool hitTopStmt;
3936
3936
3937
3937
public:
3938
- UnsupportedProtocolVisitor (ASTContext &ctx, bool checkStatements)
3938
+ ExistentialTypeVisitor (ASTContext &ctx, bool checkStatements)
3939
3939
: Ctx(ctx), checkStatements(checkStatements), hitTopStmt(false ) { }
3940
3940
3941
3941
bool walkToTypeReprPre (TypeRepr *T) override {
@@ -3990,60 +3990,60 @@ class UnsupportedProtocolVisitor
3990
3990
3991
3991
} // end anonymous namespace
3992
3992
3993
- void TypeChecker::checkUnsupportedProtocolType (Decl *decl) {
3993
+ void TypeChecker::checkExistentialTypes (Decl *decl) {
3994
3994
if (!decl || decl->isInvalid ())
3995
3995
return ;
3996
3996
3997
3997
auto &ctx = decl->getASTContext ();
3998
3998
if (auto *protocolDecl = dyn_cast<ProtocolDecl>(decl)) {
3999
- checkUnsupportedProtocolType (ctx, protocolDecl->getTrailingWhereClause ());
3999
+ checkExistentialTypes (ctx, protocolDecl->getTrailingWhereClause ());
4000
4000
} else if (auto *genericDecl = dyn_cast<GenericTypeDecl>(decl)) {
4001
- checkUnsupportedProtocolType (ctx, genericDecl->getGenericParams ());
4002
- checkUnsupportedProtocolType (ctx, genericDecl->getTrailingWhereClause ());
4001
+ checkExistentialTypes (ctx, genericDecl->getGenericParams ());
4002
+ checkExistentialTypes (ctx, genericDecl->getTrailingWhereClause ());
4003
4003
} else if (auto *assocType = dyn_cast<AssociatedTypeDecl>(decl)) {
4004
- checkUnsupportedProtocolType (ctx, assocType->getTrailingWhereClause ());
4004
+ checkExistentialTypes (ctx, assocType->getTrailingWhereClause ());
4005
4005
} else if (auto *extDecl = dyn_cast<ExtensionDecl>(decl)) {
4006
- checkUnsupportedProtocolType (ctx, extDecl->getTrailingWhereClause ());
4006
+ checkExistentialTypes (ctx, extDecl->getTrailingWhereClause ());
4007
4007
} else if (auto *subscriptDecl = dyn_cast<SubscriptDecl>(decl)) {
4008
- checkUnsupportedProtocolType (ctx, subscriptDecl->getGenericParams ());
4009
- checkUnsupportedProtocolType (ctx, subscriptDecl->getTrailingWhereClause ());
4008
+ checkExistentialTypes (ctx, subscriptDecl->getGenericParams ());
4009
+ checkExistentialTypes (ctx, subscriptDecl->getTrailingWhereClause ());
4010
4010
} else if (auto *funcDecl = dyn_cast<AbstractFunctionDecl>(decl)) {
4011
4011
if (!isa<AccessorDecl>(funcDecl)) {
4012
- checkUnsupportedProtocolType (ctx, funcDecl->getGenericParams ());
4013
- checkUnsupportedProtocolType (ctx, funcDecl->getTrailingWhereClause ());
4012
+ checkExistentialTypes (ctx, funcDecl->getGenericParams ());
4013
+ checkExistentialTypes (ctx, funcDecl->getTrailingWhereClause ());
4014
4014
}
4015
4015
}
4016
4016
4017
4017
if (isa<TypeDecl>(decl) || isa<ExtensionDecl>(decl))
4018
4018
return ;
4019
4019
4020
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ false );
4020
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ false );
4021
4021
decl->walk (visitor);
4022
4022
}
4023
4023
4024
- void TypeChecker::checkUnsupportedProtocolType (ASTContext &ctx, Stmt *stmt) {
4024
+ void TypeChecker::checkExistentialTypes (ASTContext &ctx, Stmt *stmt) {
4025
4025
if (!stmt)
4026
4026
return ;
4027
4027
4028
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ true );
4028
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ true );
4029
4029
stmt->walk (visitor);
4030
4030
}
4031
4031
4032
- void TypeChecker::checkUnsupportedProtocolType (
4032
+ void TypeChecker::checkExistentialTypes (
4033
4033
ASTContext &ctx, TrailingWhereClause *whereClause) {
4034
4034
if (whereClause == nullptr )
4035
4035
return ;
4036
4036
4037
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ false );
4037
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ false );
4038
4038
visitor.visitRequirements (whereClause->getRequirements ());
4039
4039
}
4040
4040
4041
- void TypeChecker::checkUnsupportedProtocolType (
4041
+ void TypeChecker::checkExistentialTypes (
4042
4042
ASTContext &ctx, GenericParamList *genericParams) {
4043
4043
if (genericParams == nullptr )
4044
4044
return ;
4045
4045
4046
- UnsupportedProtocolVisitor visitor (ctx, /* checkStatements=*/ false );
4046
+ ExistentialTypeVisitor visitor (ctx, /* checkStatements=*/ false );
4047
4047
visitor.visitRequirements (genericParams->getRequirements ());
4048
4048
}
4049
4049
0 commit comments