File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1053,6 +1053,9 @@ void NominalTypeDecl::prepareConformanceTable() const {
1053
1053
SmallPtrSet<ProtocolDecl *, 2 > protocols;
1054
1054
1055
1055
auto addSynthesized = [&](ProtocolDecl *proto) {
1056
+ if (!proto)
1057
+ return ;
1058
+
1056
1059
if (protocols.count (proto) == 0 ) {
1057
1060
ConformanceTable->addSynthesizedConformance (
1058
1061
mutableThis, proto, mutableThis);
Original file line number Diff line number Diff line change @@ -429,8 +429,13 @@ void ClangImporter::Implementation::addSynthesizedProtocolAttrs(
429
429
auto &ctx = nominal->getASTContext ();
430
430
431
431
for (auto kind : synthesizedProtocolAttrs) {
432
- nominal->getAttrs ().add (
433
- new (ctx) SynthesizedProtocolAttr (ctx.getProtocol (kind), this , isUnchecked));
432
+ // This is unfortunately not an error because some test use mock protocols.
433
+ // If those tests were updated, we could assert that
434
+ // ctx.getProtocol(kind) != nulltpr which would be nice.
435
+ if (auto proto = ctx.getProtocol (kind))
436
+ nominal->getAttrs ().add (
437
+ new (ctx) SynthesizedProtocolAttr (ctx.getProtocol (kind), this ,
438
+ isUnchecked));
434
439
}
435
440
}
436
441
You can’t perform that action at this time.
0 commit comments