|
| 1 | +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -parse-as-library -verify %s |
| 2 | + |
| 3 | +// REQUIRES: OS=macosx |
| 4 | + |
| 5 | +import Foundation |
| 6 | + |
| 7 | +public class SwiftClass { |
| 8 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' instance method}} |
| 9 | + @objc final public func objCMethod() {} |
| 10 | +} |
| 11 | + |
| 12 | +public class ObjCClass: NSObject { |
| 13 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final instance method}} |
| 14 | + public func method() {} |
| 15 | + |
| 16 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' instance method}} |
| 17 | + @objc public func objcMethod() {} |
| 18 | + |
| 19 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' instance method}} |
| 20 | + @objc final public func finalObjcMethod() {} |
| 21 | + |
| 22 | + @backDeployed(before: macOS 12.0) |
| 23 | + final public func finalMethod() {} |
| 24 | + |
| 25 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final instance method}} |
| 26 | + @nonobjc public func nonObjCMethod() {} |
| 27 | + |
| 28 | + @backDeployed(before: macOS 12.0) |
| 29 | + @nonobjc final public func finalNonObjCMethod() {} |
| 30 | + |
| 31 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final property}} |
| 32 | + public var property: [Int] { [1] } |
| 33 | + |
| 34 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' property}} |
| 35 | + @objc public var objCProperty: [Int] { [1] } |
| 36 | + |
| 37 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' property}} |
| 38 | + @objc public final var finalObjCProperty: [Int] { [1] } |
| 39 | + |
| 40 | + @backDeployed(before: macOS 12.0) |
| 41 | + public final var finalProperty: [Int] { [1] } |
| 42 | + |
| 43 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final property}} |
| 44 | + @nonobjc public var nonObjCProperty: [Int] { [1] } |
| 45 | + |
| 46 | + @backDeployed(before: macOS 12.0) |
| 47 | + @nonobjc public final var finalNonObjCProperty: [Int] { [1] } |
| 48 | +} |
| 49 | + |
| 50 | +extension DummyClass { |
| 51 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final instance method}} |
| 52 | + public func method() {} |
| 53 | + |
| 54 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' instance method}} |
| 55 | + @objc public func objcMethod() {} |
| 56 | + |
| 57 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' instance method}} |
| 58 | + @objc final public func finalObjcMethod() {} |
| 59 | + |
| 60 | + @backDeployed(before: macOS 12.0) |
| 61 | + final public func finalMethod() {} |
| 62 | + |
| 63 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final instance method}} |
| 64 | + @nonobjc public func nonObjCMethod() {} |
| 65 | + |
| 66 | + @backDeployed(before: macOS 12.0) |
| 67 | + @nonobjc final public func finalNonObjCMethod() {} |
| 68 | + |
| 69 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final property}} |
| 70 | + public var property: [Int] { [1] } |
| 71 | + |
| 72 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' property}} |
| 73 | + @objc public var objCProperty: [Int] { [1] } |
| 74 | + |
| 75 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' property}} |
| 76 | + @objc public final var finalObjCProperty: [Int] { [1] } |
| 77 | + |
| 78 | + @backDeployed(before: macOS 12.0) |
| 79 | + public final var finalProperty: [Int] { [1] } |
| 80 | + |
| 81 | + @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final property}} |
| 82 | + @nonobjc public var nonObjCProperty: [Int] { [1] } |
| 83 | + |
| 84 | + @backDeployed(before: macOS 12.0) |
| 85 | + @nonobjc public final var finalNonObjCProperty: [Int] { [1] } |
| 86 | +} |
0 commit comments