Skip to content

Commit f4af7a7

Browse files
theblixguyAnthonyLatsis
authored andcommitted
[Typechecker] Drop the 'Self or associated type' diagnostic
1 parent 392ba00 commit f4af7a7

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,6 @@ NOTE(object_literal_resolve_import,none,
920920

921921
ERROR(use_local_before_declaration,none,
922922
"use of local variable %0 before its declaration", (DeclNameRef))
923-
ERROR(unsupported_existential_type,none,
924-
"protocol %0 can only be used as a generic constraint because it has "
925-
"Self or associated type requirements", (Identifier))
926923

927924
ERROR(decl_does_not_exist_in_module,none,
928925
"%select{%error|type|struct|class|enum|protocol|variable|function}0 "

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4063,38 +4063,7 @@ class UnsupportedProtocolVisitor
40634063
}
40644064

40654065
void visitIdentTypeRepr(IdentTypeRepr *T) {
4066-
if (T->isInvalid())
4067-
return;
4068-
4069-
auto comp = T->getComponentRange().back();
4070-
if (auto *proto = dyn_cast_or_null<ProtocolDecl>(comp->getBoundDecl())) {
4071-
if (!proto->existentialTypeSupported()) {
4072-
Ctx.Diags.diagnose(comp->getNameLoc(),
4073-
diag::unsupported_existential_type,
4074-
proto->getName());
4075-
T->setInvalid();
4076-
}
4077-
} else if (auto *alias = dyn_cast_or_null<TypeAliasDecl>(comp->getBoundDecl())) {
4078-
auto type = Type(alias->getDeclaredInterfaceType()->getDesugaredType());
4079-
type.findIf([&](Type type) -> bool {
4080-
if (T->isInvalid())
4081-
return false;
4082-
if (type->isExistentialType()) {
4083-
auto layout = type->getExistentialLayout();
4084-
for (auto *proto : layout.getProtocols()) {
4085-
auto *protoDecl = proto->getDecl();
4086-
if (protoDecl->existentialTypeSupported())
4087-
continue;
4088-
4089-
Ctx.Diags.diagnose(comp->getNameLoc(),
4090-
diag::unsupported_existential_type,
4091-
protoDecl->getName());
4092-
T->setInvalid();
4093-
}
4094-
}
4095-
return false;
4096-
});
4097-
}
4066+
return;
40984067
}
40994068

41004069
void visitRequirements(ArrayRef<RequirementRepr> reqts) {

0 commit comments

Comments
 (0)