@@ -593,8 +593,10 @@ AssociatedTypeInference::inferTypeWitnessesViaAssociatedType(
593
593
// Look for types with the given default name that have appropriate
594
594
// @_implements attributes.
595
595
SmallVector<ValueDecl *, 4 > lookupResults;
596
- dc->lookupQualified (adoptee->getAnyNominal (), defaultName,
597
- adoptee->getAnyNominal ()->getStartLoc (),
596
+ dc->lookupQualified (dc->getSelfNominalTypeDecl (), defaultName,
597
+ isa<ExtensionDecl>(dc)
598
+ ? cast<ExtensionDecl>(dc)->getStartLoc ()
599
+ : cast<NominalTypeDecl>(dc)->getStartLoc (),
598
600
subOptions, lookupResults);
599
601
600
602
InferredAssociatedTypesByWitnesses result;
@@ -819,7 +821,7 @@ Type AssociatedTypeInference::computeFixedTypeWitness(
819
821
820
822
// Look at all of the inherited protocols to determine whether they
821
823
// require a fixed type for this associated type.
822
- for (auto conformedProto : adoptee-> getAnyNominal ()->getAllProtocols ()) {
824
+ for (auto conformedProto : dc-> getSelfNominalTypeDecl ()->getAllProtocols ()) {
823
825
if (conformedProto != assocType->getProtocol () &&
824
826
!conformedProto->inheritsFrom (assocType->getProtocol ()))
825
827
continue ;
@@ -888,7 +890,7 @@ AssociatedTypeInference::computeDerivedTypeWitness(
888
890
return std::make_pair (Type (), nullptr );
889
891
890
892
// Can we derive conformances for this protocol and adoptee?
891
- NominalTypeDecl *derivingTypeDecl = adoptee-> getAnyNominal ();
893
+ NominalTypeDecl *derivingTypeDecl = dc-> getSelfNominalTypeDecl ();
892
894
if (!DerivedConformance::derivesProtocolConformance (dc, derivingTypeDecl,
893
895
proto))
894
896
return std::make_pair (Type (), nullptr );
@@ -942,7 +944,7 @@ void AssociatedTypeInference::collectAbstractTypeWitnesses(
942
944
// First, look at all the protocols the adoptee conforms to and feed the
943
945
// same-type constraints in their requirement signatures to the system.
944
946
for (auto *const conformedProto :
945
- adoptee-> getAnyNominal ()->getAllProtocols (/* sorted=*/ true )) {
947
+ dc-> getSelfNominalTypeDecl ()->getAllProtocols (/* sorted=*/ true )) {
946
948
// FIXME: The RequirementMachine will assert on re-entrant construction.
947
949
// We should find a more principled way of breaking this cycle.
948
950
if (ctx.isRecursivelyConstructingRequirementMachine (
0 commit comments