@@ -228,6 +228,16 @@ class Noot : Aap {
228228 override func map( ) -> ( S ? ) -> ( ) -> Noot { }
229229}
230230
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+
231241// 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>
232242// CHECK: [[IMPL:%.*]] = function_ref @$s13vtable_thunks3BarC3foo{{[_0-9a-zA-Z]*}}F
233243// CHECK: apply [[IMPL]]
@@ -257,6 +267,8 @@ class Noot : Aap {
257267// CHECK: [[OUTER:%.*]] = convert_function [[INNER]] : $@callee_guaranteed () -> @owned Noot to $@callee_guaranteed () -> @owned Optional<Aap>
258268// CHECK: return [[OUTER]]
259269
270+ // CHECK-LABEL: sil private [thunk] [ossa] @$s13vtable_thunks7DerivedC15returnsOptionalSiyFAA4BaseCADSiSgyFTV : $@convention(method) <τ_0_0> (@guaranteed Derived<τ_0_0>) -> Optional<Int> {
271+
260272// CHECK-LABEL: sil_vtable D {
261273// CHECK: #B.iuo!1: {{.*}} : @$s13vtable_thunks1D{{[A-Z0-9a-z_]*}}FTV
262274// CHECK: #B.f!1: {{.*}} : @$s13vtable_thunks1D{{[A-Z0-9a-z_]*}}F
@@ -321,3 +333,8 @@ class Noot : Aap {
321333// CHECK-LABEL: sil_vtable NoThrowVariance {
322334// CHECK: #ThrowVariance.mightThrow!1: {{.*}} : @$s13vtable_thunks{{[A-Z0-9a-z_]*}}F
323335
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