|
1 | 1 | // RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -typecheck -verify %s -swift-version 4 -enable-source-import -I %S/Inputs
|
| 2 | +// RUN: %target-swift-ide-test -skip-deinit=false -print-ast-typechecked -source-filename %s -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true -disable-objc-attr-requires-foundation-module -swift-version 4 -enable-source-import -I %S/Inputs | %FileCheck %s |
2 | 3 | // REQUIRES: objc_interop
|
3 | 4 |
|
4 | 5 | import Foundation
|
@@ -30,3 +31,42 @@ class BadInSwift4 {
|
30 | 31 | @GKInspectable var badGKInspectable: PlainStruct?
|
31 | 32 | // expected-error@-1{{property cannot be marked @GKInspectable because its type cannot be represented in Objective-C}}
|
32 | 33 | }
|
| 34 | + |
| 35 | +// CHECK-LABEL: class InitsInheritObjCAttrBase |
| 36 | +class InitsInheritObjCAttrBase: NSObject { |
| 37 | + override init() {} |
| 38 | + // CHECK: {{^}} @objc convenience init(foo: Int) |
| 39 | + @objc convenience init(foo: Int) { self.init() } |
| 40 | +} // CHECK: {{^[}]$}} |
| 41 | + |
| 42 | +// CHECK-LABEL: extension InitsInheritObjCAttrBase |
| 43 | +extension InitsInheritObjCAttrBase { |
| 44 | + // CHECK: {{^}} @objc convenience dynamic init(bar: Int) |
| 45 | + @objc convenience init(bar: Int) { self.init() } |
| 46 | +} // CHECK: {{^[}]$}} |
| 47 | + |
| 48 | +// CHECK-LABEL: class ConvenienceInitsInheritObjCAttrSub |
| 49 | +class ConvenienceInitsInheritObjCAttrSub: InitsInheritObjCAttrBase { |
| 50 | + init(somethingElse: ()) { super.init() } |
| 51 | + |
| 52 | + // CHECK: {{^}} @objc convenience init(foo: Int) |
| 53 | + convenience init(foo: Int) { self.init(somethingElse: ()) } |
| 54 | + // FIXME: The '@objc' is relied upon, but the 'dynamic' probably shouldn't be! |
| 55 | + // CHECK: {{^}} @objc convenience dynamic init(bar: Int) |
| 56 | + convenience init(bar: Int) { self.init(somethingElse: ()) } |
| 57 | + |
| 58 | + // CHECK: {{^}} convenience init(unrelated: Int) |
| 59 | + convenience init(unrelated: Int) { self.init(somethingElse: ()) } |
| 60 | +} // CHECK: {{^[}]$}} |
| 61 | + |
| 62 | +// CHECK-LABEL: class DesignatedInitsInheritObjCAttrSub |
| 63 | +class DesignatedInitsInheritObjCAttrSub: InitsInheritObjCAttrBase { |
| 64 | + // CHECK: {{^}} @objc init(foo: Int) |
| 65 | + init(foo: Int) { super.init() } |
| 66 | + // FIXME: The '@objc' is relied upon, but the 'dynamic' probably shouldn't be! |
| 67 | + // CHECK: {{^}} @objc dynamic init(bar: Int) |
| 68 | + init(bar: Int) { super.init() } |
| 69 | + |
| 70 | + // CHECK: {{^}} init(unrelated: Int) |
| 71 | + init(unrelated: Int) { super.init() } |
| 72 | +} // CHECK: {{^[}]$}} |
0 commit comments