3
3
4
4
/// Build lib defining SPIs
5
5
// RUN: %target-swift-frontend -emit-module %t/Exported.swift \
6
- // RUN: -module-name Exported -swift-version 5 \
6
+ // RUN: -module-name Exported -swift-version 5 -I %t \
7
7
// RUN: -enable-library-evolution \
8
8
// RUN: -emit-module-path %t/Exported.swiftmodule \
9
9
// RUN: -emit-module-interface-path %t/Exported.swiftinterface \
10
10
// RUN: -emit-private-module-interface-path %t/Exported.private.swiftinterface
11
- // RUN: %target-swift-typecheck-module-from-interface(%t/Exported.swiftinterface)
12
- // RUN: %target-swift-typecheck-module-from-interface(%t/Exported.private.swiftinterface) -module-name Exported
11
+ // RUN: %target-swift-typecheck-module-from-interface(%t/Exported.swiftinterface) -I %t
12
+ // RUN: %target-swift-typecheck-module-from-interface(%t/Exported.private.swiftinterface) -module-name Exported -I %t
13
13
14
14
/// Build lib reexporting SPIs
15
15
// RUN: %target-swift-frontend -emit-module %t/Exporter.swift \
21
21
// RUN: %target-swift-typecheck-module-from-interface(%t/Exporter.swiftinterface) -I %t
22
22
// RUN: %target-swift-typecheck-module-from-interface(%t/Exporter.private.swiftinterface) -module-name Exporter -I %t
23
23
24
+ // RUN: %target-swift-frontend -emit-module %t/NonExportedAs.swift \
25
+ // RUN: -module-name NonExportedAs -swift-version 5 -I %t \
26
+ // RUN: -enable-library-evolution \
27
+ // RUN: -emit-module-path %t/NonExportedAs.swiftmodule \
28
+ // RUN: -emit-module-interface-path %t/NonExportedAs.swiftinterface \
29
+ // RUN: -emit-private-module-interface-path %t/NonExportedAs.private.swiftinterface
30
+ // RUN: %target-swift-typecheck-module-from-interface(%t/NonExportedAs.swiftinterface) -I %t
31
+ // RUN: %target-swift-typecheck-module-from-interface(%t/NonExportedAs.private.swiftinterface) -module-name NonExportedAs -I %t
32
+
24
33
/// Build lib not reexporting SPIs (a normal import)
25
34
// RUN: %target-swift-frontend -emit-module %t/NonExporter.swift \
26
35
// RUN: -module-name NonExporter -swift-version 5 -I %t \
46
55
// RUN: %t/Client_FileA.swift %t/Client_FileB.swift\
47
56
// RUN: -swift-version 5 -I %t -verify
48
57
58
+ /// Test that SPIs aren't avaible from a reexport without export_as
59
+ // RUN: %target-swift-frontend -typecheck \
60
+ // RUN: %t/NonExportedAsClient.swift \
61
+ // RUN: -swift-version 5 -I %t -verify
62
+
49
63
/// Test that SPIs don't leak when not reexported
50
64
// RUN: %target-swift-frontend -typecheck \
51
65
// RUN: %t/NonExporterClient.swift \
63
77
// RUN: %t/PublicClient.swift \
64
78
// RUN: -swift-version 5 -I %t -verify
65
79
80
+ //--- module.modulemap
81
+ module Exported {
82
+ export_as Exporter
83
+ }
66
84
67
85
//--- Exported.swift
68
86
87
+ @_exported import Exported
88
+
69
89
public func exportedPublicFunc( ) { }
70
90
71
91
@_spi ( X) public func exportedSpiFunc( ) { }
@@ -78,6 +98,12 @@ public func exportedPublicFunc() {}
78
98
79
99
@_spi ( X) public func exporterSpiFunc( ) { }
80
100
101
+ //--- NonExportedAs.swift
102
+
103
+ @_exported import Exported
104
+
105
+ @_spi ( X) public func exporterSpiFunc( ) { }
106
+
81
107
//--- NonExporter.swift
82
108
83
109
@_spi ( X) import Exported
@@ -127,6 +153,16 @@ public func clientB() {
127
153
exporterSpiFunc ( ) // expected-error {{cannot find 'exporterSpiFunc' in scope}}
128
154
}
129
155
156
+ //--- NonExportedAsClient.swift
157
+
158
+ @_spi ( X) import NonExportedAs
159
+
160
+ public func client( ) {
161
+ exportedPublicFunc ( )
162
+ exportedSpiFunc ( ) // expected-error {{cannot find 'exportedSpiFunc' in scope}}
163
+ exporterSpiFunc ( )
164
+ }
165
+
130
166
//--- NonExporterClient.swift
131
167
132
168
@_spi ( X) import NonExporter
0 commit comments