mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Textual SIL was sometimes ambiguous when SILDeclRefs were used, because the textual representation of SILDeclRefs was the same for functions that have the same name, but different signatures.
99 lines
3.7 KiB
Plaintext
99 lines
3.7 KiB
Plaintext
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil %s -module-name=witness_tables | %target-sil-opt -assume-parsing-unqualified-ownership-sil -module-name=witness_tables | %FileCheck %s
|
|
|
|
protocol AssocReqt {
|
|
func requiredMethod()
|
|
}
|
|
|
|
struct ConformingAssoc : AssocReqt {
|
|
func requiredMethod()
|
|
}
|
|
|
|
sil @_TFV14witness_tables15ConformingAssoc14requiredMethodfS0_FT_T_ : $@convention(method) (ConformingAssoc) -> () {
|
|
bb0(%0 : $ConformingAssoc):
|
|
debug_value %0 : $ConformingAssoc
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
sil @_TTWV14witness_tables15ConformingAssocS_9AssocReqtS_FS1_14requiredMethodU_fRQPS1_FT_T_ : $@convention(witness_method) (@inout ConformingAssoc) -> () {
|
|
bb0(%0 : $*ConformingAssoc):
|
|
%1 = load %0 : $*ConformingAssoc
|
|
%2 = function_ref @_TFV14witness_tables15ConformingAssoc14requiredMethodfS0_FT_T_ : $@convention(method) (ConformingAssoc) -> ()
|
|
%3 = apply %2(%1) : $@convention(method) (ConformingAssoc) -> ()
|
|
return %3 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil_witness_table ConformingAssoc: AssocReqt module witness_tables {
|
|
// CHECK: #AssocReqt.requiredMethod!1: {{.*}} : @_TTWV14witness_tables15ConformingAssocS_9AssocReqtS_FS1_14requiredMethodU_fRQPS1_FT_T_
|
|
// CHECK: }
|
|
sil_witness_table ConformingAssoc: AssocReqt module witness_tables {
|
|
method #AssocReqt.requiredMethod!1: @_TTWV14witness_tables15ConformingAssocS_9AssocReqtS_FS1_14requiredMethodU_fRQPS1_FT_T_
|
|
}
|
|
|
|
protocol AnyProtocol {
|
|
associatedtype AssocType
|
|
associatedtype AssocWithReqt : AssocReqt
|
|
func assocTypesMethod(x: AssocType, y: AssocWithReqt)
|
|
static func staticMethod(x: Self)
|
|
}
|
|
class SomeAssoc {
|
|
}
|
|
protocol InheritedProtocol1 : AnyProtocol {
|
|
func inheritedMethod()
|
|
}
|
|
struct InheritedConformance : InheritedProtocol1 {
|
|
typealias AssocType = SomeAssoc
|
|
typealias AssocWithReqt = ConformingAssoc
|
|
func assocTypesMethod(x: SomeAssoc, y: ConformingAssoc)
|
|
static func staticMethod(x: InheritedConformance)
|
|
func inheritedMethod()
|
|
}
|
|
struct InheritedConformance2 : InheritedProtocol1 {
|
|
typealias AssocType = SomeAssoc
|
|
typealias AssocWithReqt = ConformingAssoc
|
|
func assocTypesMethod(x: SomeAssoc, y: ConformingAssoc)
|
|
static func staticMethod(x: InheritedConformance2)
|
|
func inheritedMethod()
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: sil_witness_table InheritedConformance: InheritedProtocol1 module
|
|
// CHECK: base_protocol AnyProtocol: InheritedConformance: AnyProtocol module
|
|
// CHECK: }
|
|
sil_witness_table InheritedConformance: InheritedProtocol1 module witness_tables {
|
|
base_protocol AnyProtocol: InheritedConformance: AnyProtocol module witness_tables
|
|
}
|
|
|
|
// CHECK-LABEL: sil_witness_table shared InheritedConformance: AnyProtocol module
|
|
// CHECK: associated_type AssocType: SomeAssoc
|
|
// CHECK: associated_type_protocol (AssocWithReqt: AssocReqt): ConformingAssoc: AssocReqt module
|
|
// CHECK: }
|
|
sil_witness_table shared InheritedConformance: AnyProtocol module witness_tables {
|
|
associated_type AssocType: SomeAssoc
|
|
associated_type_protocol (AssocWithReqt: AssocReqt): ConformingAssoc: AssocReqt module witness_tables
|
|
}
|
|
|
|
// CHECK-LABEL: sil_witness_table InheritedConformance2: InheritedProtocol1 module witness_tables
|
|
// CHECK-NOT: }
|
|
sil_witness_table public_external InheritedConformance2: InheritedProtocol1 module witness_tables
|
|
// CHECK-LABEL: sil_witness_table public InheritedConformance2: AnyProtocol module witness_tables
|
|
// CHECK-NOT: }
|
|
sil_witness_table public InheritedConformance2: AnyProtocol module witness_tables
|
|
|
|
|
|
protocol Proto {
|
|
func abc()
|
|
}
|
|
|
|
class DeadMethodClass : Proto {
|
|
func abc()
|
|
}
|
|
|
|
// CHECK-LABEL: sil_witness_table DeadMethodClass: Proto module witness_tables
|
|
// CHECK: method #Proto.abc!1: {{.*}} : nil
|
|
// CHECK: }
|
|
sil_witness_table DeadMethodClass: Proto module witness_tables {
|
|
method #Proto.abc!1: nil
|
|
}
|
|
|