Skip to content

Commit 20d834c

Browse files
committed
ClangImporter: Fix conformsToProtocolInOriginalModule() to walk SynthesizedProtocolAttrs
1 parent c624ff5 commit 20d834c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4891,11 +4891,18 @@ static bool conformsToProtocolInOriginalModule(NominalTypeDecl *nominal,
48914891
const ProtocolDecl *proto,
48924892
ModuleDecl *foundationModule,
48934893
LazyResolver *resolver) {
4894+
auto &ctx = nominal->getASTContext();
4895+
48944896
if (resolver)
48954897
resolver->resolveInheritanceClause(nominal);
48964898
if (inheritanceListContainsProtocol(nominal->getInherited(), proto))
48974899
return true;
48984900

4901+
for (auto attr : nominal->getAttrs().getAttributes<SynthesizedProtocolAttr>())
4902+
if (auto *otherProto = ctx.getProtocol(attr->getProtocolKind()))
4903+
if (otherProto == proto)
4904+
return true;
4905+
48994906
// Only consider extensions from the original module...or from an overlay
49004907
// or the Swift half of a mixed-source framework.
49014908
const DeclContext *containingFile = nominal->getModuleScopeContext();

0 commit comments

Comments
 (0)