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

test/Sema/implementation-only-import-inlinable.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
import indirects
1213

1314
// Types

test/Sema/implementation-only-import-library-evolution.swift

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

77
@_implementationOnly import BADLibrary
8+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
89

910
public struct PublicStructStoredProperties {
1011
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}

test/Sema/missing-import-inlinable-code.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public import libA
7575
// BEGIN clientFileA-OldCheck.swift
7676
public import libA
7777
@_implementationOnly import empty
78+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
7879

7980
@inlinable public func bar() {
8081
let a = ImportedType()
@@ -102,6 +103,7 @@ public import libA
102103

103104
// BEGIN clientFileB.swift
104105
@_implementationOnly import libB
106+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
105107
public import libA
106108
extension ImportedType {
107109
public func localModuleMethod() {}

test/Sema/missing-import-typealias.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ extension StructAlias {
9797

9898
import Aliases
9999
@_implementationOnly import Original
100+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
100101

101102
@inlinable public func inlinableFunc() {
102103
// expected-warning@+1 {{'StructAlias' aliases 'Original.Struct' and cannot be used in an '@inlinable' function because 'Original' has been imported as implementation-only; this is an error in the Swift 6 language mode}}

test/Sema/restricted-imports-priorities.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,22 @@ public struct LibAStruct {}
4545

4646
//--- TwoIOI.swift
4747
@_implementationOnly import LibB
48+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
4849
@_implementationOnly import LibC
50+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
4951

5052
public func foo(a: LibAStruct) {} // expected-error {{cannot use struct 'LibAStruct' here; 'LibA' has been imported as implementation-only}}
5153

5254
//--- SPIOnlyAndIOI1.swift
5355
@_spiOnly import LibB
5456
@_implementationOnly import LibC
57+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
5558

5659
public func foo(a: LibAStruct) {} // expected-error {{cannot use struct 'LibAStruct' here; 'LibA' was imported for SPI only}}
5760

5861
//--- SPIOnlyAndIOI2.swift
5962
@_implementationOnly import LibB
63+
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}}
6064
@_spiOnly import LibC
6165

6266
public func foo(a: LibAStruct) {} // expected-error {{cannot use struct 'LibAStruct' here; 'LibA' was imported for SPI only}}

0 commit comments

Comments
 (0)