@@ -1468,12 +1468,10 @@ class AccessorConformanceInfo : public ConformanceInfo {
1468
1468
1469
1469
void defineAssociatedTypeWitnessTableAccessFunction (
1470
1470
AssociatedConformance requirement,
1471
- CanType associatedType,
1472
1471
ProtocolConformanceRef conformance);
1473
1472
1474
1473
llvm::Constant *getAssociatedConformanceWitness (
1475
1474
AssociatedConformance requirement,
1476
- CanType associatedType,
1477
1475
ProtocolConformanceRef conformance);
1478
1476
1479
1477
const FulfillmentMap &getFulfillmentMap () {
@@ -1765,10 +1763,6 @@ class AccessorConformanceInfo : public ConformanceInfo {
1765
1763
return ;
1766
1764
}
1767
1765
1768
- auto associate =
1769
- ConformanceInContext.getAssociatedType (
1770
- requirement.getAssociation ())->getCanonicalType ();
1771
-
1772
1766
ProtocolConformanceRef associatedConformance =
1773
1767
ConformanceInContext.getAssociatedConformance (
1774
1768
requirement.getAssociation (),
@@ -1802,8 +1796,7 @@ class AccessorConformanceInfo : public ConformanceInfo {
1802
1796
}
1803
1797
1804
1798
llvm::Constant *witnessEntry =
1805
- getAssociatedConformanceWitness (requirement, associate,
1806
- associatedConformance);
1799
+ getAssociatedConformanceWitness (requirement, associatedConformance);
1807
1800
1808
1801
if (isRelative) {
1809
1802
Table.addRelativeAddress (witnessEntry);
@@ -1869,19 +1862,17 @@ static void buildAssociatedTypeValueName(CanType depAssociatedType,
1869
1862
1870
1863
llvm::Constant *WitnessTableBuilderBase::getAssociatedConformanceWitness (
1871
1864
AssociatedConformance requirement,
1872
- CanType associatedType,
1873
1865
ProtocolConformanceRef conformance) {
1874
- defineAssociatedTypeWitnessTableAccessFunction (requirement, associatedType,
1875
- conformance);
1866
+ defineAssociatedTypeWitnessTableAccessFunction (requirement, conformance);
1876
1867
assert (isa<NormalProtocolConformance>(Conformance) && " has associated type" );
1877
1868
auto conf = cast<NormalProtocolConformance>(&Conformance);
1878
1869
return IGM.getMangledAssociatedConformance (conf, requirement);
1879
1870
}
1880
1871
1881
1872
void WitnessTableBuilderBase::defineAssociatedTypeWitnessTableAccessFunction (
1882
1873
AssociatedConformance requirement,
1883
- CanType associatedType,
1884
1874
ProtocolConformanceRef associatedConformance) {
1875
+ auto associatedType = associatedConformance.getType ()->getCanonicalType ();
1885
1876
bool hasArchetype = associatedType->hasArchetype ();
1886
1877
bool isOpaqueArchetype = isa<OpaqueTypeArchetypeType>(associatedType);
1887
1878
@@ -1926,8 +1917,6 @@ void WitnessTableBuilderBase::defineAssociatedTypeWitnessTableAccessFunction(
1926
1917
const ConformanceInfo *conformanceI = nullptr ;
1927
1918
1928
1919
if (associatedConformance.isConcrete ()) {
1929
- assert (associatedType->isEqual (associatedConformance.getConcrete ()->getType ()));
1930
-
1931
1920
conformanceI = &IGM.getConformanceInfo (associatedProtocol,
1932
1921
associatedConformance.getConcrete ());
1933
1922
@@ -2023,10 +2012,6 @@ void ResilientWitnessTableBuilder::collectResilientWitnesses(
2023
2012
if (entry.getKind () == SILWitnessTable::AssociatedConformance) {
2024
2013
const auto &witness = entry.getAssociatedConformanceWitness ();
2025
2014
2026
- auto associate =
2027
- ConformanceInContext.getAssociatedType (
2028
- witness.Requirement )->getCanonicalType ();
2029
-
2030
2015
ProtocolConformanceRef associatedConformance =
2031
2016
ConformanceInContext.getAssociatedConformance (witness.Requirement ,
2032
2017
witness.Witness .getProtocol ());
@@ -2036,8 +2021,7 @@ void ResilientWitnessTableBuilder::collectResilientWitnesses(
2036
2021
witness.Witness .getProtocol ());
2037
2022
2038
2023
llvm::Constant *witnessEntry =
2039
- getAssociatedConformanceWitness (requirement, associate,
2040
- associatedConformance);
2024
+ getAssociatedConformanceWitness (requirement, associatedConformance);
2041
2025
resilientWitnesses.push_back (witnessEntry);
2042
2026
continue ;
2043
2027
}
@@ -2052,8 +2036,7 @@ void ResilientWitnessTableBuilder::collectResilientWitnesses(
2052
2036
ProtocolConformanceRef inheritedConformance =
2053
2037
ConformanceInContext.getAssociatedConformance (selfType, baseProto);
2054
2038
llvm::Constant *witnessEntry =
2055
- getAssociatedConformanceWitness (requirement, ConcreteType,
2056
- inheritedConformance);
2039
+ getAssociatedConformanceWitness (requirement, inheritedConformance);
2057
2040
resilientWitnesses.push_back (witnessEntry);
2058
2041
continue ;
2059
2042
}
@@ -3448,12 +3431,12 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
3448
3431
auto association = entry.getAssociatedConformancePath ();
3449
3432
auto associatedRequirement = entry.getAssociatedConformanceRequirement ();
3450
3433
3451
- CanType associatedType = sourceConformance.getAssociatedType (association)
3452
- ->getCanonicalType ();
3453
- sourceKey.Type = associatedType;
3454
3434
3455
3435
auto associatedConformance =
3456
3436
sourceConformance.getAssociatedConformance (association, associatedRequirement);
3437
+ auto associatedType = associatedConformance.getType ()->getCanonicalType ();
3438
+
3439
+ sourceKey.Type = associatedType;
3457
3440
sourceKey.Kind =
3458
3441
LocalTypeDataKind::forProtocolWitnessTable (associatedConformance);
3459
3442
@@ -3526,8 +3509,9 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
3526
3509
// type directly.
3527
3510
auto depMemType = cast<DependentMemberType>(association);
3528
3511
CanType baseSubstType =
3529
- sourceConformance.getAssociatedType (depMemType.getBase ())
3530
- ->getCanonicalType ();
3512
+ depMemType.getBase ().subst (
3513
+ SubstitutionMap::getProtocolSubstitutions (sourceConformance))
3514
+ ->getCanonicalType ();
3531
3515
if (auto archetypeType = dyn_cast<ArchetypeType>(baseSubstType)) {
3532
3516
AssociatedType baseAssocType (depMemType->getAssocType ());
3533
3517
0 commit comments