@@ -228,6 +228,16 @@ class Noot : Aap {
228
228
override func map( ) -> ( S ? ) -> ( ) -> Noot { }
229
229
}
230
230
231
+ // rdar://problem/59669591
232
+ class Base {
233
+ func returnsOptional( ) -> Int ? { return nil }
234
+ }
235
+
236
+ class Derived < Foo> : Base {
237
+ // The thunk here needs to be generic.
238
+ override func returnsOptional( ) -> Int { return 0 }
239
+ }
240
+
231
241
// CHECK-LABEL: sil private [thunk] [ossa] @$s13vtable_thunks3BarC3foo{{[_0-9a-zA-Z]*}}FTV : $@convention(method) (@guaranteed @callee_guaranteed (Int) -> Int, @guaranteed Bar) -> @owned Optional<@callee_guaranteed (Int) -> Int>
232
242
// CHECK: [[IMPL:%.*]] = function_ref @$s13vtable_thunks3BarC3foo{{[_0-9a-zA-Z]*}}F
233
243
// CHECK: apply [[IMPL]]
@@ -257,6 +267,8 @@ class Noot : Aap {
257
267
// CHECK: [[OUTER:%.*]] = convert_function [[INNER]] : $@callee_guaranteed () -> @owned Noot to $@callee_guaranteed () -> @owned Optional<Aap>
258
268
// CHECK: return [[OUTER]]
259
269
270
+ // CHECK-LABEL: sil private [thunk] [ossa] @$s13vtable_thunks7DerivedC15returnsOptionalSiyFAA4BaseCADSiSgyFTV : $@convention(method) <τ_0_0> (@guaranteed Derived<τ_0_0>) -> Optional<Int> {
271
+
260
272
// CHECK-LABEL: sil_vtable D {
261
273
// CHECK: #B.iuo!1: {{.*}} : @$s13vtable_thunks1D{{[A-Z0-9a-z_]*}}FTV
262
274
// CHECK: #B.f!1: {{.*}} : @$s13vtable_thunks1D{{[A-Z0-9a-z_]*}}F
@@ -321,3 +333,8 @@ class Noot : Aap {
321
333
// CHECK-LABEL: sil_vtable NoThrowVariance {
322
334
// CHECK: #ThrowVariance.mightThrow!1: {{.*}} : @$s13vtable_thunks{{[A-Z0-9a-z_]*}}F
323
335
336
+ // CHECK-LABEL: sil_vtable Base {
337
+ // CHECK: #Base.returnsOptional!1: (Base) -> () -> Int? : @$s13vtable_thunks4BaseC15returnsOptionalSiSgyF
338
+
339
+ // CHECK-LABEL: sil_vtable Derived {
340
+ // CHECK: #Base.returnsOptional!1: (Base) -> () -> Int? : @$s13vtable_thunks7DerivedC15returnsOptionalSiyFAA4BaseCADSiSgyFTV [override]
0 commit comments