Skip to content

Commit e859679

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 1e24c00 commit e859679

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
@@ -1440,7 +1440,8 @@ void Serializer::writeASTBlockEntity(
14401440
data.push_back(addDeclRef(req));
14411441
data.push_back(addDeclRef(witness.getDecl()));
14421442
assert(witness.getDecl() || req->getAttrs().hasAttribute<OptionalAttr>()
1443-
|| req->getAttrs().isUnavailable(req->getASTContext()));
1443+
|| req->getAttrs().isUnavailable(req->getASTContext())
1444+
|| allowCompilerErrors());
14441445

14451446
// If there is no witness, we're done.
14461447
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)