Skip to content

Commit 2800464

Browse files
theblixguyAnthonyLatsis
authored andcommitted
[Typechecker] Drop the 'Self or associated type' diagnostic
1 parent bc8657b commit 2800464

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
@@ -3997,38 +3997,7 @@ class UnsupportedProtocolVisitor
39973997
}
39983998

39993999
void visitIdentTypeRepr(IdentTypeRepr *T) {
4000-
if (T->isInvalid())
4001-
return;
4002-
4003-
auto comp = T->getComponentRange().back();
4004-
if (auto *proto = dyn_cast_or_null<ProtocolDecl>(comp->getBoundDecl())) {
4005-
if (!proto->existentialTypeSupported()) {
4006-
Ctx.Diags.diagnose(comp->getNameLoc(),
4007-
diag::unsupported_existential_type,
4008-
proto->getName());
4009-
T->setInvalid();
4010-
}
4011-
} else if (auto *alias = dyn_cast_or_null<TypeAliasDecl>(comp->getBoundDecl())) {
4012-
auto type = Type(alias->getDeclaredInterfaceType()->getDesugaredType());
4013-
type.findIf([&](Type type) -> bool {
4014-
if (T->isInvalid())
4015-
return false;
4016-
if (type->isExistentialType()) {
4017-
auto layout = type->getExistentialLayout();
4018-
for (auto *proto : layout.getProtocols()) {
4019-
auto *protoDecl = proto->getDecl();
4020-
if (protoDecl->existentialTypeSupported())
4021-
continue;
4022-
4023-
Ctx.Diags.diagnose(comp->getNameLoc(),
4024-
diag::unsupported_existential_type,
4025-
protoDecl->getName());
4026-
T->setInvalid();
4027-
}
4028-
}
4029-
return false;
4030-
});
4031-
}
4000+
return;
40324001
}
40334002

40344003
void visitRequirements(ArrayRef<RequirementRepr> reqts) {

0 commit comments

Comments
 (0)