File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// A module should be able to leak SPI types from an import through SPI decls
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: %target-swift-frontend -typecheck -verify -verify-ignore-unknown -DLIB_C %s -I %t
7
+
8
+ #if LIB_A
9
+
10
+ @_spi ( A) public struct SecretStruct {
11
+ @_spi ( A) public func bar( ) { }
12
+ }
13
+
14
+ #elseif LIB_B
15
+
16
+ @_spi ( A) import A
17
+
18
+ @_spi ( B) public func foo( ) -> SecretStruct { fatalError ( ) }
19
+
20
+ #elseif LIB_C
21
+
22
+ @_spi ( B) import B
23
+
24
+ var a = foo ( ) // OK
25
+ a. bar ( ) // expected-error{{'bar' is inaccessible due to '@_spi' protection level}}
26
+
27
+ var b = SecretStruct ( ) // expected-error{{use of unresolved identifier}}
28
+
29
+ #endif
You can’t perform that action at this time.
0 commit comments