|
21 | 21 | // RUN: %target-swift-frontend -emit-module %t/ImportNotUseFromAPI.swift -o %t -I %t
|
22 | 22 | // RUN: %target-swift-frontend -emit-module %t/ImportUsedInPackage.swift -o %t -I %t
|
23 | 23 | // RUN: %target-swift-frontend -emit-module %t/ExportedUnused.swift -o %t -I %t
|
| 24 | +// RUN: %target-swift-frontend -emit-module %t/SPIOnlyUsedInSPI.swift -o %t -I %t |
24 | 25 |
|
25 | 26 | /// Check diagnostics.
|
26 | 27 | // RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
|
27 |
| -// RUN: -package-name pkg -Rmodule-api-import -swift-version 6 -verify |
| 28 | +// RUN: -package-name pkg -Rmodule-api-import -swift-version 6 -verify \ |
| 29 | +// RUN: -experimental-spi-only-imports |
28 | 30 | // RUN: %target-swift-frontend -typecheck %t/ClientOfClangModules.swift -I %t \
|
29 | 31 | // RUN: -package-name pkg -Rmodule-api-import -swift-version 6 -verify
|
30 | 32 | // RUN: %target-swift-frontend -typecheck %t/Client_Swift5.swift -I %t \
|
@@ -105,6 +107,9 @@ public func packageFunc() -> PackageType { return PackageType() }
|
105 | 107 |
|
106 | 108 | //--- ExportedUnused.swift
|
107 | 109 |
|
| 110 | +//--- SPIOnlyUsedInSPI.swift |
| 111 | +public struct ToUseFromSPI {} |
| 112 | + |
108 | 113 | //--- Client_Swift5.swift
|
109 | 114 | /// No diagnostics should be raised on the implicit access level.
|
110 | 115 | import UnusedImport // expected-error {{ambiguous implicit access level for import of 'UnusedImport'; it is imported as 'public' elsewhere}}
|
@@ -137,6 +142,7 @@ public import ImportNotUseFromAPI // expected-warning {{public import of 'Import
|
137 | 142 | public import ImportUsedInPackage // expected-warning {{public import of 'ImportUsedInPackage' was not used in public declarations or inlinable code}} {{1-7=package}}
|
138 | 143 |
|
139 | 144 | @_exported public import ExportedUnused
|
| 145 | +@_spiOnly public import SPIOnlyUsedInSPI |
140 | 146 |
|
141 | 147 | public func useInSignature(_ a: TypeUsedInSignature) {} // expected-remark {{struct 'TypeUsedInSignature' is imported via 'DepUsedInSignature'}}
|
142 | 148 | public func exportedTypeUseInSignature(_ a: ExportedType) {} // expected-remark {{struct 'ExportedType' is imported via 'Exporter', which reexports definition from 'Exportee'}}
|
@@ -219,6 +225,9 @@ func implicitlyInternalFunc(a: NotAnAPIType = notAnAPIFunc()) {}
|
219 | 225 | // For package decls we only remark on types used in signatures, not for inlinable code.
|
220 | 226 | package func packageFunc(a: PackageType = packageFunc()) {} // expected-remark {{struct 'PackageType' is imported via 'ImportUsedInPackage'}}
|
221 | 227 |
|
| 228 | +@_spi(X) |
| 229 | +public func spiFunc(a: ToUseFromSPI) {} // expected-remark {{struct 'ToUseFromSPI' is imported via 'SPIOnlyUsedInSPI'}} |
| 230 | + |
222 | 231 | /// Tests for imports of clang modules.
|
223 | 232 | //--- module.modulemap
|
224 | 233 | module ClangSimpleUnused {
|
|
0 commit comments