Files
swift-mirror/test/decl/ext/protocol_objc.swift
Doug Gregor 10934bb273 Start requiring 'final' on members of protocol extensions.
Part of rdar://problem/11735843.

Swift SVN r26941
2015-04-03 18:09:24 +00:00

24 lines
487 B
Swift

// RUN: %target-parse-verify-swift
// REQUIRES: objc_interop
@objc protocol OP1 {
func reqOP1a() -> Bool
}
extension OP1 {
final func extOP1a() -> Bool { return !reqOP1a() }
}
class OC1 : OP1 {
@objc func reqOP1a() -> Bool { return true }
}
func testOP1(oc1: OC1, ao: AnyObject) {
oc1.extOP1a()
ao.reqOP1a!() // okay
// Extension of @objc protocol does not have @objc members.
ao.extOP1a!() // expected-error{{'AnyObject' does not have a member named 'extOP1a()'}}
}