forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swiftlang#27074 from xymus/fix-index-deser
serialization: recover from missing modules when reading SubstitutionMaps
- Loading branch information
Showing
4 changed files
with
184 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/Serialization/Recovery/Inputs/implementation-only-missing/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module public_lib [system] {} |
59 changes: 59 additions & 0 deletions
59
test/Serialization/Recovery/implementation-only-missing.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Recover from missing types hidden behind an importation-only when indexing | ||
// a system module. | ||
// rdar://problem/52837313 | ||
|
||
// RUN: %empty-directory(%t) | ||
|
||
//// Build the private module, the public module and the client app normally. | ||
//// Force the public module to be system with an underlying Clang module. | ||
// RUN: %target-swift-frontend -emit-module -DPRIVATE_LIB %s -module-name private_lib -emit-module-path %t/private_lib.swiftmodule | ||
// RUN: %target-swift-frontend -emit-module -DPUBLIC_LIB %s -module-name public_lib -emit-module-path %t/public_lib.swiftmodule -I %t -I %S/Inputs/implementation-only-missing -import-underlying-module | ||
|
||
//// The client app should build OK without the private module. Removing the | ||
//// private module is superfluous but makes sure that it's not somehow loaded. | ||
// RUN: rm %t/private_lib.swiftmodule | ||
// RUN: %target-swift-frontend -typecheck -DCLIENT_APP -primary-file %s -I %t -index-system-modules -index-store-path %t | ||
|
||
#if PRIVATE_LIB | ||
|
||
public struct HiddenGenStruct<A: HiddenProtocol> { | ||
public init() {} | ||
} | ||
|
||
public protocol HiddenProtocol { | ||
associatedtype Value | ||
} | ||
|
||
#elseif PUBLIC_LIB | ||
|
||
@_implementationOnly import private_lib | ||
|
||
struct LibProtocolContraint { } | ||
|
||
protocol LibProtocolTABound { } | ||
struct LibProtocolTA: LibProtocolTABound { } | ||
|
||
protocol LibProtocol { | ||
associatedtype TA: LibProtocolTABound = LibProtocolTA | ||
|
||
func hiddenRequirement<A>( | ||
param: HiddenGenStruct<A> | ||
) where A.Value == LibProtocolContraint | ||
} | ||
|
||
extension LibProtocol where TA == LibProtocolTA { | ||
func hiddenRequirement<A>( | ||
param: HiddenGenStruct<A> | ||
) where A.Value == LibProtocolContraint { } | ||
} | ||
|
||
public struct PublicStruct: LibProtocol { | ||
typealias TA = LibProtocolTA | ||
public init() { } | ||
} | ||
|
||
#elseif CLIENT_APP | ||
|
||
import public_lib | ||
|
||
#endif |