3
3
// rdar://problem/52837313
4
4
5
5
// RUN: %empty-directory(%t)
6
+ // RUN: split-file %s %t --leading-lines
6
7
7
8
//// Build the private module, the public module and the client app normally.
8
9
//// 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
18
26
19
27
//// Printing the public module should not crash when checking for overrides of
20
28
//// 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] { }
22
34
23
- #if PRIVATE_LIB
35
+ //--- PrivateLib.swift
24
36
25
37
@propertyWrapper
26
38
public struct IoiPropertyWrapper < V> {
@@ -51,9 +63,10 @@ public protocol HiddenProtocolWithOverride {
51
63
52
64
public class HiddenClass { }
53
65
54
- #elseif PUBLIC_LIB
55
66
56
- @_implementationOnly import private_lib
67
+ //--- PublicLib.swift
68
+
69
+ @_implementationOnly import PrivateLib
57
70
58
71
struct LibProtocolConstraint { }
59
72
@@ -112,9 +125,10 @@ struct StructInheritingFromComposition : CompositionMemberInheriting & Compositi
112
125
class ClassInheritingFromComposition : CompositionMemberInheriting & CompositionMemberSimple { }
113
126
protocol InheritingFromCompositionDirect : CompositionMemberSimple & HiddenProtocol2 { }
114
127
115
- #elseif CLIENT_APP
116
128
117
- import public_lib
129
+ //--- Client.swift
130
+
131
+ import PublicLib
118
132
119
133
var s = PublicStruct ( )
120
134
print ( s. nonWrappedVar)
@@ -129,5 +143,3 @@ print(p)
129
143
var something = ClassUnrelatedToSomeClass ( ) as AnyObject
130
144
something. triggerTypoCorrection = 123 // expected-error {{value of type 'AnyObject' has no member 'triggerTypoCorrection'}}
131
145
#endif
132
-
133
- #endif
0 commit comments