Skip to content

Commit c490f92

Browse files
committed
[Serialization] Serialize unresolved types as errors if allowing errors
1 parent 073a582 commit c490f92

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4168,6 +4168,13 @@ class Serializer::TypeSerializer : public TypeVisitor<TypeSerializer> {
41684168
}
41694169

41704170
void visitUnresolvedType(const UnresolvedType *) {
4171+
// If for some reason we have an unresolved type while compiling with
4172+
// errors, just serialize an ErrorType and continue.
4173+
if (S.getASTContext().LangOpts.AllowModuleWithCompilerErrors) {
4174+
visitErrorType(
4175+
cast<ErrorType>(ErrorType::get(S.getASTContext()).getPointer()));
4176+
return;
4177+
}
41714178
llvm_unreachable("should not serialize an UnresolvedType");
41724179
}
41734180

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
protocol SomeProto {}
6+
7+
extension SomeProto {
8+
func someFunc(arg:
9+
10+
enum SomeEnum {
11+
case a
12+
}

0 commit comments

Comments
 (0)