Skip to content

Commit 4d9c8ee

Browse files
committed
[Sema] Generalize the downgraded warning for exportability check
This warning will be used more generally so let's make bring back the diagnostic in line with the error version.
1 parent 4c995a3 commit 4d9c8ee

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,8 +2906,8 @@ ERROR(decl_from_hidden_module,none,
29062906
"it is SPI}4",
29072907
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
29082908
WARNING(decl_from_hidden_module_warn,none,
2909-
"cannot use %0 %1 %select{in SPI|as property wrapper in SPI|"
2910-
"as result builder in SPI|"
2909+
"cannot use %0 %1 %select{here|as property wrapper here|"
2910+
"as result builder here|"
29112911
"in an extension with public or '@usableFromInline' members|"
29122912
"in an extension with conditional conformances}2; "
29132913
"%select{%3 has been imported as implementation-only}4",

test/SPI/implementation_only_spi_import_exposability.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public protocol IOIProtocol {}
2626

2727
@_spi(A) @_implementationOnly import Lib
2828

29-
@_spi(B) public func leakSPIStruct(_ a: SPIStruct) -> SPIStruct { fatalError() } // expected-warning 2 {{cannot use struct 'SPIStruct' in SPI; 'Lib' has been imported as implementation-only}}
30-
@_spi(B) public func leakIOIStruct(_ a: IOIStruct) -> IOIStruct { fatalError() } // expected-warning 2 {{cannot use struct 'IOIStruct' in SPI; 'Lib' has been imported as implementation-only}}
29+
@_spi(B) public func leakSPIStruct(_ a: SPIStruct) -> SPIStruct { fatalError() } // expected-warning 2 {{cannot use struct 'SPIStruct' here; 'Lib' has been imported as implementation-only}}
30+
@_spi(B) public func leakIOIStruct(_ a: IOIStruct) -> IOIStruct { fatalError() } // expected-warning 2 {{cannot use struct 'IOIStruct' here; 'Lib' has been imported as implementation-only}}
3131

3232
public struct PublicStruct : IOIProtocol, SPIProtocol { // expected-error {{cannot use protocol 'IOIProtocol' here; 'Lib' has been imported as implementation-only}}
3333
// expected-error @-1 {{cannot use protocol 'SPIProtocol' here; 'Lib' has been imported as implementation-only}}
@@ -46,8 +46,8 @@ public struct PublicStruct : IOIProtocol, SPIProtocol { // expected-error {{cann
4646
}
4747

4848
@_spi(B)
49-
public struct LocalSPIStruct : IOIProtocol, SPIProtocol { // expected-warning {{cannot use protocol 'IOIProtocol' in SPI; 'Lib' has been imported as implementation-only}}
50-
// expected-warning @-1 {{cannot use protocol 'SPIProtocol' in SPI; 'Lib' has been imported as implementation-only}}
49+
public struct LocalSPIStruct : IOIProtocol, SPIProtocol { // expected-warning {{cannot use protocol 'IOIProtocol' here; 'Lib' has been imported as implementation-only}}
50+
// expected-warning @-1 {{cannot use protocol 'SPIProtocol' here; 'Lib' has been imported as implementation-only}}
5151
}
5252

5353
#endif

0 commit comments

Comments
 (0)