Skip to content

Commit b562663

Browse files
committed
[test] Add deserialization recovery test for 'override required init'
This could have had different behavior from normal 'required', but it doesn't. Everything seems to work.
1 parent 8987394 commit b562663

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/Serialization/Recovery/typedefs.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ func testSymbols() {
2929

3030
// CHECK-IR-LABEL: define{{.*}} void @_T08typedefs18testVTableBuildingy3Lib4UserC4user_tF
3131
public func testVTableBuilding(user: User) {
32-
// The important thing in this CHECK line is the "i64 28", which is the offset
32+
// The important thing in this CHECK line is the "i64 29", which is the offset
3333
// for the vtable slot for 'lastMethod()'. If the layout here
34-
// changes, please check that offset 28 is still correct.
34+
// changes, please check that offset 29 is still correct.
3535
// CHECK-IR-NOT: ret
36-
// CHECK-IR: getelementptr inbounds void (%T3Lib4UserC*)*, void (%T3Lib4UserC*)** %{{[0-9]+}}, {{i64 28|i32 31}}
36+
// CHECK-IR: getelementptr inbounds void (%T3Lib4UserC*)*, void (%T3Lib4UserC*)** %{{[0-9]+}}, {{i64 29|i32 32}}
3737
_ = user.lastMethod()
3838
} // CHECK-IR: ret void
3939

@@ -168,6 +168,10 @@ open class User {
168168
// CHECK-RECOVERY: /* placeholder for init(wrappedRequired:) */
169169
public required init(wrappedRequired: WrappedInt) {}
170170

171+
// CHECK: {{^}} init(wrappedRequiredInSub: WrappedInt)
172+
// CHECK-RECOVERY: /* placeholder for init(wrappedRequiredInSub:) */
173+
public init(wrappedRequiredInSub: WrappedInt) {}
174+
171175
public func lastMethod() {}
172176
}
173177
// CHECK: {{^}$}}
@@ -195,7 +199,8 @@ open class User {
195199
// 25 CHECK-VTABLE-NEXT: #User.init!initializer.1:
196200
// 26 CHECK-VTABLE-NEXT: #User.init!allocator.1:
197201
// 27 CHECK-VTABLE-NEXT: #User.init!initializer.1:
198-
// 28 CHECK-VTABLE-NEXT: #User.lastMethod!1:
202+
// 28 CHECK-VTABLE-NEXT: #User.init!initializer.1:
203+
// 29 CHECK-VTABLE-NEXT: #User.lastMethod!1:
199204
// CHECK-VTABLE: }
200205

201206

@@ -264,6 +269,10 @@ open class UserSub : User {
264269
// CHECK: required init(wrappedRequired: WrappedInt?)
265270
// CHECK-RECOVERY: /* placeholder for init(wrappedRequired:) */
266271
public required init(wrappedRequired: WrappedInt?) { super.init() }
272+
273+
// CHECK: required init(wrappedRequiredInSub: WrappedInt?)
274+
// CHECK-RECOVERY: /* placeholder for init(wrappedRequiredInSub:) */
275+
public required override init(wrappedRequiredInSub: WrappedInt?) { super.init() }
267276
}
268277
// CHECK: {{^}$}}
269278
// CHECK-RECOVERY: {{^}$}}

0 commit comments

Comments
 (0)