Files
swift-mirror/test/attr/attr_availability_transitive_nested.swift
Timothy J. Wood 3a301ae3cc Add nested availability check.
This helps ensure that a matching unavailability doesn't incorrectly allow
a reference to a completely unavailable declaration.
2017-10-24 10:52:36 -07:00

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()
}