Skip to content

Commit 84997b4

Browse files
committed
Sema: Protocols don't have implicit members
1 parent 00afb8b commit 84997b4

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6363,6 +6363,9 @@ ConstructorDecl *NominalTypeDecl::getDefaultInitializer() const {
63636363
}
63646364

63656365
void NominalTypeDecl::synthesizeSemanticMembersIfNeeded(DeclName member) {
6366+
if (isa<ProtocolDecl>(this))
6367+
return;
6368+
63666369
// Silently break cycles here because we can't be sure when and where a
63676370
// request to synthesize will come from yet.
63686371
// FIXME: rdar://56844567

lib/Sema/CodeSynthesis.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,8 @@ evaluator::SideEffect
13641364
ResolveImplicitMemberRequest::evaluate(Evaluator &evaluator,
13651365
NominalTypeDecl *target,
13661366
ImplicitMemberAction action) const {
1367+
ASSERT(!isa<ProtocolDecl>(target));
1368+
13671369
// FIXME: This entire request is a layering violation made of smaller,
13681370
// finickier layering violations. See rdar://56844567
13691371

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2941,7 +2941,7 @@ static ArrayRef<Decl *> evaluateMembersRequest(
29412941
}
29422942
}
29432943

2944-
if (nominal) {
2944+
if (nominal && !isa<ProtocolDecl>(nominal)) {
29452945
// If the type conforms to Encodable or Decodable, even via an extension,
29462946
// the CodingKeys enum is synthesized as a member of the type itself.
29472947
// Force it into existence.

0 commit comments

Comments
 (0)