|
| 1 | +// RUN: %target-swift-frontend -emit-silgen %s -parse-as-library -module-name Test -experimental-lazy-typecheck | %FileCheck %s |
| 2 | + |
| 3 | +public protocol Proto { |
| 4 | + func requirement() |
| 5 | +} |
| 6 | + |
| 7 | +public protocol ProtoWithAssociatedType { |
| 8 | + associatedtype A |
| 9 | + func requirement() -> A |
| 10 | + func otherRequirement(_ a: A) |
| 11 | +} |
| 12 | + |
| 13 | +public struct StructConformingToProto: Proto { |
| 14 | + // CHECK: sil{{.*}} @$s4Test23StructConformingToProtoV11requirementyyF : $@convention(method) (StructConformingToProto) -> () { |
| 15 | + public func requirement() {} |
| 16 | +} |
| 17 | + |
| 18 | +// CHECK: sil shared [transparent] [serialized] [thunk]{{.*}} @$s4Test23StructConformingToProtoVAA0E0A2aDP11requirementyyFTW : $@convention(witness_method: Proto) (@in_guaranteed StructConformingToProto) -> () { |
| 19 | + |
| 20 | +public struct StructConformingToProtoInExtension {} |
| 21 | + |
| 22 | +extension StructConformingToProtoInExtension: Proto { |
| 23 | + // CHECK: sil{{.*}} @$s4Test34StructConformingToProtoInExtensionV11requirementyyF : $@convention(method) (StructConformingToProtoInExtension) -> () { |
| 24 | + public func requirement() {} |
| 25 | +} |
| 26 | +// CHECK: sil shared [transparent] [serialized] [thunk]{{.*}} @$s4Test34StructConformingToProtoInExtensionVAA0E0A2aDP11requirementyyFTW : $@convention(witness_method: Proto) (@in_guaranteed StructConformingToProtoInExtension) -> () { |
| 27 | + |
| 28 | +public struct StructConformingToProtoWithAssociatedType: ProtoWithAssociatedType { |
| 29 | + // CHECK: sil{{.*}} @$s4Test41StructConformingToProtoWithAssociatedTypeV11requirementSiyF : $@convention(method) (StructConformingToProtoWithAssociatedType) -> Int { |
| 30 | + public func requirement() -> Int { return 1 } |
| 31 | + |
| 32 | + // CHECK: sil{{.*}} @$s4Test41StructConformingToProtoWithAssociatedTypeV16otherRequirementyySiF : $@convention(method) (Int, StructConformingToProtoWithAssociatedType) -> () { |
| 33 | + public func otherRequirement(_ a: A) {} |
| 34 | +} |
| 35 | +// CHECK: sil shared [transparent] [serialized] [thunk]{{.*}} @$s4Test41StructConformingToProtoWithAssociatedTypeVAA0efgH0A2aDP11requirement1AQzyFTW : $@convention(witness_method: ProtoWithAssociatedType) (@in_guaranteed StructConformingToProtoWithAssociatedType) -> @out Int { |
| 36 | +// CHECK: sil shared [transparent] [serialized] [thunk]{{.*}} @$s4Test41StructConformingToProtoWithAssociatedTypeVAA0efgH0A2aDP16otherRequirementyy1AQzFTW : $@convention(witness_method: ProtoWithAssociatedType) (@in_guaranteed Int, @in_guaranteed StructConformingToProtoWithAssociatedType) -> () { |
| 37 | + |
| 38 | +// CHECK-LABEL: sil_witness_table [serialized] StructConformingToProto: Proto module Test { |
| 39 | +// CHECK-NEXT: method #Proto.requirement: <Self where Self : Proto> (Self) -> () -> () : @$s4Test23StructConformingToProtoVAA0E0A2aDP11requirementyyFTW |
| 40 | +// CHECK-NEXT: } |
| 41 | + |
| 42 | +// CHECK-LABEL: sil_witness_table [serialized] StructConformingToProtoInExtension: Proto module Test { |
| 43 | +// CHECK-NEXT: method #Proto.requirement: <Self where Self : Proto> (Self) -> () -> () : @$s4Test34StructConformingToProtoInExtensionVAA0E0A2aDP11requirementyyFTW |
| 44 | +// CHECK-NEXT: } |
| 45 | + |
| 46 | +// CHECK-LABEL: sil_witness_table [serialized] StructConformingToProtoWithAssociatedType: ProtoWithAssociatedType module Test { |
| 47 | +// CHECK-NEXT: associated_type A: Int |
| 48 | +// CHECK-NEXT: method #ProtoWithAssociatedType.requirement: <Self where Self : ProtoWithAssociatedType> (Self) -> () -> Self.A : @$s4Test41StructConformingToProtoWithAssociatedTypeVAA0efgH0A2aDP11requirement1AQzyFTW |
| 49 | +// CHECK-NEXT: method #ProtoWithAssociatedType.otherRequirement: <Self where Self : ProtoWithAssociatedType> (Self) -> (Self.A) -> () : @$s4Test41StructConformingToProtoWithAssociatedTypeVAA0efgH0A2aDP16otherRequirementyy1AQzFTW |
| 50 | +// CHECK-NEXT: } |
0 commit comments