Files
swift-mirror/test/decl/protocol/req/unavailable.swift
Ted Kremenek 62feb5c949 Change @availability to @available.
This came out of today's language review meeting.
The intent is to match #available with the attribute
that describes availability.

This is a divergence from Objective-C.

Swift SVN r28484
2015-05-12 20:06:13 +00:00

26 lines
717 B
Swift

// RUN: %target-parse-verify-swift
// An @objc protocol can have 'unavailable'
// methods. They are treated as if they
// were marked optional
@objc protocol Proto {
@available(*,unavailable) optional func bad()
func good()
}
class Foo : Proto {
@objc func good() {}
}
// Reject protocols with 'unavailable' requirements
// if a protocol is not marked @objc.
protocol NonObjCProto {
@available(*,unavailable) func bad() // expected-error {{protocol members can only be marked unavailable in an @objc protocol}} expected-note {{protocol requires function 'bad()'}}
func good()
}
class Bar : NonObjCProto { // expected-error {{type 'Bar' does not conform to protocol 'NonObjCProto'}}
func good() {}
}