mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add TypeChecker::isInsideCompatibleUnavailableDeclaration(). Pass in the call site's AvailableAttr and compare its platform to those in the enclosing lexical scopes. Added some basic tests.
38 lines
1.1 KiB
Swift
38 lines
1.1 KiB
Swift
// RUN: %target-typecheck-verify-swift -application-extension
|
|
// REQUIRES: OS=macosx
|
|
|
|
// Allow referencing unavailable API in situations where the caller is marked unavailable in the same circumstances.
|
|
|
|
@available(OSX, unavailable)
|
|
func osx() {} // expected-note 2{{'osx()' has been explicitly marked unavailable here}}
|
|
|
|
@available(OSXApplicationExtension, unavailable)
|
|
func osx_extension() {} // expected-note 2{{'osx_extension()' has been explicitly marked unavailable here}}
|
|
|
|
func call_osx_extension() {
|
|
osx_extension() // expected-error {{'osx_extension()' is unavailable}}
|
|
}
|
|
func call_osx() {
|
|
osx() // expected-error {{'osx()' is unavailable}}
|
|
}
|
|
|
|
@available(OSX, unavailable)
|
|
func osx_call_osx_extension() {
|
|
osx_extension() // expected-error {{'osx_extension()' is unavailable}}
|
|
}
|
|
|
|
@available(OSX, unavailable)
|
|
func osx_call_osx() {
|
|
osx()
|
|
}
|
|
|
|
@available(OSXApplicationExtension, unavailable)
|
|
func osx_extension_call_osx_extension() {
|
|
osx_extension()
|
|
}
|
|
|
|
@available(OSXApplicationExtension, unavailable)
|
|
func osx_extension_call_osx() {
|
|
osx() // expected-error {{'osx()' is unavailable}}
|
|
}
|