File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
test/Serialization/AllowErrors Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -1631,6 +1631,8 @@ static bool shouldSerializeMember(Decl *D) {
16311631 llvm_unreachable (" decl should never be a member" );
16321632
16331633 case DeclKind::MissingMember:
1634+ if (D->getASTContext ().LangOpts .AllowModuleWithCompilerErrors )
1635+ return false ;
16341636 llvm_unreachable (" should never need to reserialize a member placeholder" );
16351637
16361638 case DeclKind::IfConfig:
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %empty-directory(%t/mods)
3+
4+ // RUN: touch %t/empty.swift
5+ // RUN: %{python} %utils/split_file.py -o %t %s
6+
7+ // We're going to swap A and B around to cause an invalid xref
8+ // RUN: %target-swift-frontend -emit-module -o %t/mods/A.swiftmodule -module-name A %t/lib.swift
9+ // RUN: %target-swift-frontend -emit-module -o %t/mods/B.swiftmodule -module-name B %t/empty.swift
10+
11+ // Compile using SomeType from A
12+ // RUN: %target-swift-frontend -module-name errors -emit-module -o %t/mods/errorsmain.partial.swiftmodule -I %t/mods %t/errors.swift
13+ // Empty module so we can do a merge modules step
14+ // RUN: %target-swift-frontend -module-name errors -emit-module -o %t/mods/errorsempty.partial.swiftmodule %t/empty.swift
15+
16+ // Swap A and B
17+ // RUN: %target-swift-frontend -emit-module -o %t/mods/A.swiftmodule -module-name A %t/empty.swift
18+ // RUN: %target-swift-frontend -emit-module -o %t/mods/B.swiftmodule -module-name B %t/lib.swift
19+
20+ // RUN: %target-swift-frontend -module-name errors -emit-module -o %t/mods/errors.swiftmodule -experimental-allow-module-with-compiler-errors %t/mods/errorsmain.partial.swiftmodule %t/mods/errorsempty.partial.swiftmodule
21+
22+ // Expect this to crash without allowing errors (we should never get into a
23+ // situation where merge modules is run with MissingMemberDecls)
24+ // RUN: not --crash %target-swift-frontend -module-name errors -emit-module -o %t/mods/errors.swiftmodule %t/mods/errorsmain.partial.swiftmodule %t/mods/errorsempty.partial.swiftmodule
25+
26+ // BEGIN lib.swift
27+ public struct SomeType {
28+ public init ( ) { }
29+ }
30+
31+
32+ // BEGIN errors.swift
33+ import A
34+ import B
35+
36+ public class SomeClass {
37+ public let member : SomeType
38+ public init ( member: SomeType ) {
39+ self . member = member
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments