Files
swift-mirror/test/attr/attr_objc_any.swift
David Farler b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00

21 lines
774 B
Swift

// RUN: %target-swift-frontend -typecheck -verify %s
// REQUIRES: objc_interop
import Foundation
@objc var foo: Any // expected-error {{@objc can only be used with members of classes, @objc protocols, and concrete extensions of classes}}
class Foo: NSObject {
override init() {}
@objc var property: Any
@objc func method(x: Any) -> Any { return x }
@objc func indirectAny(x: UnsafePointer<Any>) {} // expected-error{{type of the parameter cannot be represented in Objective-C}}
@objc func throwingMethod(x: Any) throws -> Any { return x }
@objc func throwingMethod(x: Any) throws -> Any? { return x } // expected-error{{throwing method cannot be marked @objc because it returns a value of optional type 'Any?'; 'nil' indicates failure to Objective-C}}
}