Skip to content

Commit ee22ebb

Browse files
committed
Test: Expect warning on deprecated @_implementationOnly in tests
1 parent da0dcc9 commit ee22ebb

15 files changed

+22
-1
lines changed

test/Concurrency/preconcurrency_implementationonly_override.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// REQUIRES: asserts
1212

1313
@_implementationOnly import ImplementationOnlyDefs
14+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
1415

1516
class D: C {
1617
@_implementationOnly

test/ModuleInterface/module_shadowing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import ShadowyHorror
3030
// OTHER-DAG: ShadowyHorror.module_shadowing:{{[0-9]+:[0-9]+}}: warning: public class 'ShadowyHorror.module_shadowing' shadows module 'module_shadowing', which may cause failures when importing 'module_shadowing' or its clients in some configurations; please rename either the class 'ShadowyHorror.module_shadowing' or the module 'module_shadowing', or see https://github.com/apple/swift/issues/56573 for workarounds{{$}}
3131

32-
@_implementationOnly import TestModule
32+
internal import TestModule
3333
#endif
3434

3535
public struct ShadowyHorror {

test/SPI/implementation_only_spi_import_exposability.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public protocol IOIProtocol {}
2727
#elseif CLIENT
2828

2929
@_spi(A) @_implementationOnly import Lib
30+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
3031

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

test/SPI/report-ioi-in-spi.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public struct IOIStruct {
2626
//--- ClientSPIOnlyMode.swift
2727

2828
@_implementationOnly import Lib
29+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
2930

3031
@_spi(X) public func spiClient(s: IOIStruct) -> IOIStruct { // expected-error 2 {{cannot use struct 'IOIStruct' here; 'Lib' has been imported as implementation-only}}
3132
return IOIStruct()
@@ -39,6 +40,7 @@ public struct IOIStruct {
3940
//--- ClientDefaultMode.swift
4041

4142
@_implementationOnly import Lib
43+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
4244

4345
@_spi(X) public func spiClient(s: IOIStruct) -> IOIStruct { // expected-warning 2 {{cannot use struct 'IOIStruct' here; 'Lib' has been imported as implementation-only}}
4446
return IOIStruct()

test/SPI/spi-only-import-conflicting.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ import Lib // expected-error {{'Lib' inconsistently imported for SPI only}}
6060
// expected-warning @-1 {{'Lib' inconsistently imported as implementation-only}}
6161
@_implementationOnly import Lib // expected-error {{'Lib' inconsistently imported for SPI only}}
6262
// expected-note @-1 {{imported as implementation-only here}}
63+
// expected-warning @-2 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
6364

6465
/// Many confliciting imports lead to many diagnostics.
6566
//--- SPIOnly_IOI_Exported_Default.swift
6667
@_spiOnly import Lib // expected-note 3 {{imported for SPI only here}}
6768
// expected-warning @-1 {{'Lib' inconsistently imported as implementation-only}}
6869
@_implementationOnly import Lib // expected-error {{'Lib' inconsistently imported for SPI only}}
6970
// expected-note @-1 3 {{imported as implementation-only here}}
71+
// expected-warning @-2 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
7072
@_exported import Lib // expected-error {{'Lib' inconsistently imported for SPI only}}
7173
// expected-warning @-1 {{'Lib' inconsistently imported as implementation-only}}
7274
import Lib // expected-error {{'Lib' inconsistently imported for SPI only}}
@@ -82,6 +84,7 @@ import Lib
8284
/// Different IOI in different files of the same module are still rejected.
8385
//--- IOI_Default_FileA.swift
8486
@_implementationOnly import Lib // expected-note {{imported as implementation-only here}}
87+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
8588

8689
//--- IOI_Default_FileB.swift
8790
import Lib // expected-warning {{'Lib' inconsistently imported as implementation-only}}

test/Sema/implementation-only-import-from-non-resilient.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import B
2727

2828
//--- client-resilient.swift
2929
@_implementationOnly import A
30+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
3031
import B
3132

3233
//--- Crypto.swift

test/Sema/implementation-only-import-in-decls.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import NormalLibrary
1111
@_implementationOnly import BADLibrary
12+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
1213

1314
public struct TestConformance: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
1415

test/Sema/implementation-only-import-inlinable-conformances.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-typecheck-verify-swift -I %t -enable-library-evolution -swift-version 5
88

99
@_implementationOnly import BADLibrary
10+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
1011
import NormalLibrary
1112

1213
@available(*, unavailable)

test/Sema/implementation-only-import-inlinable-indirect.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// RUN: -enable-library-evolution -swift-version 5
99

1010
@_implementationOnly import directs
11+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
1112

1213
// Types
1314

test/Sema/implementation-only-import-inlinable-multifile.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// RUN: -enable-library-evolution -swift-version 5
99

1010
@_implementationOnly import directs
11+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
1112
// 'indirects' is imported for re-export in a secondary file
1213

1314
// Types

0 commit comments

Comments
 (0)