|
1 | 1 | // RUN: %empty-directory(%t)
|
2 | 2 | // RUN: split-file %s %t
|
3 | 3 | // REQUIRES: VENDOR=apple
|
4 |
| -// REQUIRES: asserts |
5 | 4 |
|
6 | 5 | /// Prepare the SDK.
|
7 | 6 | // RUN: cp -r %S/Inputs/public-private-sdk %t/sdk
|
|
42 | 41 | // RUN: -library-level ipi -module-name MainLib
|
43 | 42 | //--- PublicImports.swift
|
44 | 43 | import PublicSwift
|
45 |
| -import PrivateSwift // expected-error{{private module 'PrivateSwift' is imported publicly from the public module 'MainLib'}} |
| 44 | +import PrivateSwift // expected-error{{private module 'PrivateSwift' is imported publicly from the public module 'MainLib'}}{{1-1=internal }} |
46 | 45 |
|
47 | 46 | import PublicClang
|
48 |
| -import PublicClang_Private // expected-error{{private module 'PublicClang_Private' is imported publicly from the public module 'MainLib'}} |
49 |
| -import FullyPrivateClang // expected-error{{private module 'FullyPrivateClang' is imported publicly from the public module 'MainLib'}} |
50 |
| -import LocalClang // expected-error{{private module 'LocalClang' is imported publicly from the public module 'MainLib'}} |
| 47 | +import PublicClang_Private // expected-error{{private module 'PublicClang_Private' is imported publicly from the public module 'MainLib'}}{{1-1=internal }} |
| 48 | +import FullyPrivateClang // expected-error{{private module 'FullyPrivateClang' is imported publicly from the public module 'MainLib'}}{{1-1=internal }} |
| 49 | +import LocalClang // expected-error{{private module 'LocalClang' is imported publicly from the public module 'MainLib'}}{{1-1=internal }} |
51 | 50 | @_exported import MainLib // expected-warning{{private module 'MainLib' is imported publicly from the public module 'MainLib'}}
|
52 | 51 |
|
53 | 52 | /// Expect no errors with implementation-only imports.
|
@@ -146,16 +145,27 @@ private import LocalClang
|
146 | 145 | // RUN: -library-level api -verify
|
147 | 146 | //--- ExplicitlyPublicImports.swift
|
148 | 147 | public import PublicSwift
|
149 |
| -// expected-warning @-1 {{public import of 'PublicSwift' was not used in public declarations or inlinable code}} |
150 |
| -public import PrivateSwift // expected-error{{private module 'PrivateSwift' is imported publicly from the public module 'MainLib'}} |
151 |
| -// expected-warning @-1 {{public import of 'PrivateSwift' was not used in public declarations or inlinable code}} |
| 148 | +// expected-warning @-1 {{public import of 'PublicSwift' was not used in public declarations or inlinable code}}{{1-7=internal}} |
| 149 | +public import PrivateSwift // expected-error{{private module 'PrivateSwift' is imported publicly from the public module 'MainLib'}}{{1-7=internal}} |
| 150 | +// expected-warning @-1 {{public import of 'PrivateSwift' was not used in public declarations or inlinable code}}{{1-7=internal}} |
152 | 151 |
|
153 | 152 | public import PublicClang
|
154 |
| -// expected-warning @-1 {{public import of 'PublicClang' was not used in public declarations or inlinable code}} |
155 |
| -public import PublicClang_Private // expected-error{{private module 'PublicClang_Private' is imported publicly from the public module 'MainLib'}} |
156 |
| -// expected-warning @-1 {{public import of 'PublicClang_Private' was not used in public declarations or inlinable code}} |
157 |
| -public import FullyPrivateClang // expected-error{{private module 'FullyPrivateClang' is imported publicly from the public module 'MainLib'}} |
158 |
| -// expected-warning @-1 {{public import of 'FullyPrivateClang' was not used in public declarations or inlinable code}} |
159 |
| -public import LocalClang // expected-error{{private module 'LocalClang' is imported publicly from the public module 'MainLib'}} |
160 |
| -// expected-warning @-1 {{public import of 'LocalClang' was not used in public declarations or inlinable code}} |
161 |
| -@_exported public import MainLib // expected-warning{{private module 'MainLib' is imported publicly from the public module 'MainLib'}} |
| 153 | +// expected-warning @-1 {{public import of 'PublicClang' was not used in public declarations or inlinable code}}{{1-7=internal}} |
| 154 | +public import PublicClang_Private // expected-error{{private module 'PublicClang_Private' is imported publicly from the public module 'MainLib'}}{{1-7=internal}} |
| 155 | +// expected-warning @-1 {{public import of 'PublicClang_Private' was not used in public declarations or inlinable code}}{{1-7=internal}} |
| 156 | +public import FullyPrivateClang // expected-error{{private module 'FullyPrivateClang' is imported publicly from the public module 'MainLib'}}{{1-7=internal}} |
| 157 | +// expected-warning @-1 {{public import of 'FullyPrivateClang' was not used in public declarations or inlinable code}}{{1-7=internal}} |
| 158 | +public import LocalClang // expected-error{{private module 'LocalClang' is imported publicly from the public module 'MainLib'}}{{1-7=internal}} |
| 159 | +// expected-warning @-1 {{public import of 'LocalClang' was not used in public declarations or inlinable code}}{{1-7=internal}} |
| 160 | +@_exported public import MainLib // expected-warning{{private module 'MainLib' is imported publicly from the public module 'MainLib'}}{{12-18=internal}} |
| 161 | + |
| 162 | +// RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/ImplictlyInternalImports.swift \ |
| 163 | +// RUN: -module-name MainLib -module-cache-path %t \ |
| 164 | +// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \ |
| 165 | +// RUN: -enable-upcoming-feature InternalImportsByDefault \ |
| 166 | +// RUN: -library-level api -verify |
| 167 | +//--- ImplictlyInternalImports.swift |
| 168 | +public import PublicSwift |
| 169 | +// expected-warning @-1 {{public import of 'PublicSwift' was not used in public declarations or inlinable code}}{{1-8=}} |
| 170 | +public import PrivateSwift // expected-error{{private module 'PrivateSwift' is imported publicly from the public module 'MainLib'}}{{1-8=}} |
| 171 | +// expected-warning @-1 {{public import of 'PrivateSwift' was not used in public declarations or inlinable code}}{{1-8=}} |
0 commit comments