Skip to content

Commit 1fea98c

Browse files
committed
[Serialization] Allow conformances with no witness if allowing errors
Note that deserialization already handles this case when recovery is enabled.
1 parent 6d038c8 commit 1fea98c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,8 @@ void Serializer::writeASTBlockEntity(
14601460
data.push_back(addDeclRef(req));
14611461
data.push_back(addDeclRef(witness.getDecl()));
14621462
assert(witness.getDecl() || req->getAttrs().hasAttribute<OptionalAttr>()
1463-
|| req->getAttrs().isUnavailable(req->getASTContext()));
1463+
|| req->getAttrs().isUnavailable(req->getASTContext())
1464+
|| allowCompilerErrors());
14641465

14651466
// If there is no witness, we're done.
14661467
if (!witness.getDecl()) return;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend -module-name errors -emit-module -o %t/errors.swiftmodule -experimental-allow-module-with-compiler-errors %s
4+
5+
public protocol SomeProto {
6+
init(from: SomeProto)
7+
}
8+
9+
struct A {}
10+
struct B: SomeProto {
11+
let a: A
12+
}
13+
14+
let thing = B(a: A())

0 commit comments

Comments
 (0)