33// rdar://problem/52837313
44
55// RUN: %empty-directory(%t)
6+ // RUN: split-file %s %t --leading-lines
67
78//// Build the private module, the public module and the client app normally.
89//// Force the public module to be system with an underlying Clang module.
9- // RUN: %target-swift-frontend -emit-module -DPRIVATE_LIB %s -module-name private_lib -emit-module-path %t/private_lib.swiftmodule
10- // 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
11-
12- //// The client app should build OK without the private module. Removing the
13- //// private module is superfluous but makes sure that it's not somehow loaded.
14- // RUN: rm %t/private_lib.swiftmodule
15- // RUN: %target-swift-frontend -typecheck -DCLIENT_APP %s -I %t -index-system-modules -index-store-path %t
16- // RUN: %target-swift-frontend -typecheck -DCLIENT_APP %s -I %t -D FAIL_TYPECHECK -verify
17- // RUN: %target-swift-frontend -emit-sil -DCLIENT_APP %s -I %t -module-name client
10+ // RUN: %target-swift-frontend -emit-module %t/PrivateLib.swift \
11+ // RUN: -emit-module-path %t/PrivateLib.swiftmodule
12+ // RUN: %target-swift-frontend -emit-module %t/PublicLib.swift \
13+ // RUN: -emit-module-path %t/PublicLib.swiftmodule \
14+ // RUN: -I %t -import-underlying-module
15+
16+ //// Remove the private module make sure it's not somehow loaded.
17+ // RUN: rm %t/PrivateLib.swiftmodule
18+
19+ //// The client app should build and index OK without the private module.
20+ // RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
21+ // RUN: -index-system-modules -index-store-path %t
22+ // RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
23+ // RUN: -D FAIL_TYPECHECK -verify
24+ // RUN: %target-swift-frontend -emit-sil %t/Client.swift -I %t \
25+ // RUN: -module-name client
1826
1927//// Printing the public module should not crash when checking for overrides of
2028//// methods from the private module.
21- // RUN: %target-swift-ide-test -print-module -module-to-print=public_lib -source-filename=x -skip-overrides -I %t
29+ // RUN: %target-swift-ide-test -print-module -module-to-print=PublicLib \
30+ // RUN: -source-filename=x -skip-overrides -I %t
31+
32+ //--- module.modulemap
33+ module PublicLib [ system] { }
2234
23- #if PRIVATE_LIB
35+ //--- PrivateLib.swift
2436
2537@propertyWrapper
2638public struct IoiPropertyWrapper < V> {
@@ -51,9 +63,10 @@ public protocol HiddenProtocolWithOverride {
5163
5264public class HiddenClass { }
5365
54- #elseif PUBLIC_LIB
5566
56- @_implementationOnly import private_lib
67+ //--- PublicLib.swift
68+
69+ @_implementationOnly import PrivateLib
5770
5871struct LibProtocolConstraint { }
5972
@@ -112,9 +125,10 @@ struct StructInheritingFromComposition : CompositionMemberInheriting & Compositi
112125class ClassInheritingFromComposition : CompositionMemberInheriting & CompositionMemberSimple { }
113126protocol InheritingFromCompositionDirect : CompositionMemberSimple & HiddenProtocol2 { }
114127
115- #elseif CLIENT_APP
116128
117- import public_lib
129+ //--- Client.swift
130+
131+ import PublicLib
118132
119133var s = PublicStruct ( )
120134print ( s. nonWrappedVar)
@@ -129,5 +143,3 @@ print(p)
129143 var something = ClassUnrelatedToSomeClass ( ) as AnyObject
130144 something. triggerTypoCorrection = 123 // expected-error {{value of type 'AnyObject' has no member 'triggerTypoCorrection'}}
131145#endif
132-
133- #endif
0 commit comments