Skip to content

Commit d98429a

Browse files
committed
test: add basic sema test
1 parent e7936ff commit d98429a

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

test/Sema/spi-available-local.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx11.9 -parse-as-library %s -typecheck -library-level=api >& %t/macos.txt
3+
// RUN: %FileCheck %s < %t/macos.txt
4+
5+
// RUN: %target-swift-frontend -target arm64-apple-ios13.0 -parse-as-library %s -typecheck -library-level=api
6+
7+
@_spi_available(macOS 10.10, *)
8+
@available(iOS 8.0, *)
9+
public class SPIClass {}
10+
11+
public func foo(_ c: SPIClass) {}
12+
13+
// CHECK: cannot use class 'SPIClass' here; it is SPI
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/macos)
3+
// RUN: %empty-directory(%t/ios)
4+
5+
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx11.9 -parse-as-library %s -emit-module -library-level=api -emit-module-path %t/macos/Foo.swiftmodule -module-name Foo -DFoo
6+
// RUN: %target-swift-frontend -target arm64-apple-ios13.0 -parse-as-library %s -emit-module -library-level=api -emit-module-path %t/ios/Foo.swiftmodule -module-name Foo -DFoo
7+
8+
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx11.9 -parse-as-library %s -typecheck -library-level=api -I %t/macos >& %t/macos.txt
9+
// RUN: %FileCheck %s < %t/macos.txt
10+
11+
// RUN: %target-swift-frontend -target arm64-apple-ios13.0 -parse-as-library %s -typecheck -library-level=api -I %t/ios
12+
13+
#if Foo
14+
15+
@_spi_available(macOS 10.10, *)
16+
@available(iOS 8.0, *)
17+
public class SPIClass {}
18+
19+
#else
20+
21+
import Foo
22+
public func foo(_ c: SPIClass) {}
23+
24+
#endif
25+
26+
// CHECK: cannot use class 'SPIClass' here; it is an SPI imported from 'Foo'

0 commit comments

Comments
 (0)