Skip to content

Commit 480e893

Browse files
committed
[SPI Test] Test @_implementationOnly compatibility with @_spi imports
1 parent 4124693 commit 480e893

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// @_implementationOnly imports should be compatible with @_spi imports
2+
3+
// RUN: %empty-directory(%t)
4+
// RUN: %target-swift-frontend -emit-module -DLIB_A %s -module-name A -emit-module-path %t/A.swiftmodule
5+
// RUN: %target-swift-frontend -emit-module -DLIB_B %s -module-name B -emit-module-path %t/B.swiftmodule -I %t
6+
// RUN: rm %t/A.swiftmodule
7+
// RUN: %target-swift-frontend -typecheck -verify -DLIB_C %s -I %t
8+
9+
#if LIB_A
10+
11+
@_spi(A) public func foo() {}
12+
13+
#elseif LIB_B
14+
15+
@_spi(A) @_implementationOnly import A
16+
foo() // OK
17+
18+
#elseif LIB_C
19+
20+
import B
21+
foo() // expected-error{{use of unresolved identifier}}
22+
23+
#endif

0 commit comments

Comments
 (0)