mirror of
https://github.com/apple/swift.git
synced 2026-10-28 21:15:56 +01:00
test/Inputs/clang-importer-sdk began its life as a mock-up of a Darwin SDK. When used with a non-Darwin target, code in `swift::getClangInvocationFileMapping()` that’s meant to load a platform-specific libc modulemap emits a warning which is now caught by the diagnostic verifier, causing failures. I would prefer to modify clang-importer-sdk to prevent this warning from being emitted, but I had trouble doing that. In lieu of a proper fix, make the affected tests expect this diagnostic.
62 lines
2.8 KiB
Swift
62 lines
2.8 KiB
Swift
// RUN: %target-typecheck-verify-swift -parse-stdlib -target aarch64-unknown-linux-android28 %s
|
|
|
|
// expected-warning@<unknown> * {{libc not found for 'aarch64-unknown-linux-android28'; C stdlib may be unavailable}}
|
|
|
|
@available(Android, introduced: 1.0, deprecated: 2.0, obsoleted: 28.0,
|
|
message: "you don't want to do that anyway")
|
|
func doSomething() { }
|
|
// expected-note @-3{{'doSomething()' was obsoleted in Android 28.0}}
|
|
|
|
doSomething() // expected-error{{'doSomething()' is unavailable in Android: you don't want to do that anyway}}
|
|
|
|
// Preservation of major.minor.micro
|
|
@available(Android, introduced: 1.0, deprecated: 2.0, obsoleted: 27.0)
|
|
func doSomethingElse() { }
|
|
// expected-note @-2{{'doSomethingElse()' was obsoleted in Android 27.0}}
|
|
|
|
doSomethingElse() // expected-error{{'doSomethingElse()' is unavailable in Android}}
|
|
|
|
// Test deprecations in 28.0 and later
|
|
|
|
@available(Android, introduced: 1.1, deprecated: 28.0,
|
|
message: "Use another function")
|
|
func deprecatedFunctionWithMessage() { }
|
|
|
|
deprecatedFunctionWithMessage() // expected-warning{{'deprecatedFunctionWithMessage()' was deprecated in Android 28.0: Use another function}}
|
|
|
|
|
|
@available(Android, introduced: 1.0, deprecated: 28.0)
|
|
func deprecatedFunctionWithoutMessage() { }
|
|
|
|
deprecatedFunctionWithoutMessage() // expected-warning{{'deprecatedFunctionWithoutMessage()' was deprecated in Android 28.0}}
|
|
|
|
@available(Android, introduced: 1.0, deprecated: 28.0,
|
|
message: "Use BetterClass instead")
|
|
class DeprecatedClass { }
|
|
|
|
func functionWithDeprecatedParameter(p: DeprecatedClass) { } // expected-warning{{'DeprecatedClass' was deprecated in Android 28.0: Use BetterClass instead}}
|
|
|
|
@available(Android, introduced: 7.0, deprecated: 29,
|
|
message: "Use BetterClass instead")
|
|
class DeprecatedClassIn29_0 { }
|
|
|
|
// Elements deprecated later than the minimum deployment target (which is 28.0, in this case) should not generate warnings
|
|
func functionWithDeprecatedLaterParameter(p: DeprecatedClassIn29_0) { }
|
|
|
|
@available(Android, introduced: 30)
|
|
func functionIntroducedOnAndroid30() { }
|
|
|
|
if #available(iOS 17.3, *) {
|
|
functionIntroducedOnAndroid30() // expected-error{{'functionIntroducedOnAndroid30()' is only available in Android 30 or newer}}
|
|
// expected-note @-1{{add 'if #available' version check}}{{3-34=if #available(Android 30, *) {\n functionIntroducedOnAndroid30()\n \} else {\n // Fallback on earlier versions\n \}}}
|
|
}
|
|
|
|
if #available(Android 28, *) {
|
|
functionIntroducedOnAndroid30() // expected-error{{'functionIntroducedOnAndroid30()' is only available in Android 30 or newer}}
|
|
// expected-note @-1{{add 'if #available' version check}}{{3-34=if #available(Android 30, *) {\n functionIntroducedOnAndroid30()\n \} else {\n // Fallback on earlier versions\n \}}}
|
|
}
|
|
|
|
if #available(Android 30, *) {
|
|
functionIntroducedOnAndroid30()
|
|
}
|