mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This helps ensure that a matching unavailability doesn't incorrectly allow a reference to a completely unavailable declaration.
26 lines
844 B
Swift
26 lines
844 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
// REQUIRES: OS=macosx
|
|
|
|
// Make sure that a compatible unavailable wrapping doesn't allow referencing declarations that are completely unavailable.
|
|
|
|
@available(iOS, unavailable)
|
|
class Outer {
|
|
@available(*, unavailable)
|
|
func completelyBadMethod() {} // expected-note {{'completelyBadMethod()' has been explicitly marked unavailable here}}
|
|
}
|
|
|
|
@available(iOS, unavailable)
|
|
func test(outer: Outer) {
|
|
outer.completelyBadMethod() // expected-error {{'completelyBadMethod()' is unavailable}}
|
|
}
|
|
|
|
@available(*, unavailable)
|
|
class Outer2 { // expected-note {{'Outer2' has been explicitly marked unavailable here}}
|
|
@available(iOS, unavailable)
|
|
func innerUnavailable() {}
|
|
}
|
|
@available(iOS, unavailable)
|
|
func test2(outer: Outer2) { // expected-error {{'Outer2' is unavailable}}
|
|
outer.innerUnavailable()
|
|
}
|