Skip to content

Commit 457c185

Browse files
committed
Sema: Protocols don't have implicit members
1 parent 36bcac0 commit 457c185

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
@@ -6366,6 +6366,9 @@ ConstructorDecl *NominalTypeDecl::getDefaultInitializer() const {
63666366
}
63676367

63686368
void NominalTypeDecl::synthesizeSemanticMembersIfNeeded(DeclName member) {
6369+
if (isa<ProtocolDecl>(this))
6370+
return;
6371+
63696372
// Silently break cycles here because we can't be sure when and where a
63706373
// request to synthesize will come from yet.
63716374
// 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
@@ -2932,7 +2932,7 @@ static ArrayRef<Decl *> evaluateMembersRequest(
29322932
}
29332933
}
29342934

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

0 commit comments

Comments
 (0)