@@ -676,8 +676,7 @@ struct InferRequirementsWalker : public TypeWalker {
676676// / We automatically infer 'T : Hashable' from the fact that 'struct Set'
677677// / declares a Hashable requirement on its generic parameter.
678678void swift::rewriting::inferRequirements (
679- Type type, SourceLoc loc,
680- ModuleDecl *module , DeclContext *dc,
679+ Type type, ModuleDecl *module , DeclContext *dc,
681680 SmallVectorImpl<StructuralRequirement> &result) {
682681 if (!type)
683682 return ;
@@ -707,13 +706,8 @@ void swift::rewriting::realizeRequirement(
707706 auto secondType = req.getSecondType ();
708707
709708 if (shouldInferRequirements) {
710- auto firstLoc = (reqRepr ? reqRepr->getSubjectRepr ()->getStartLoc ()
711- : SourceLoc ());
712- inferRequirements (firstType, firstLoc, moduleForInference, dc, result);
713-
714- auto secondLoc = (reqRepr ? reqRepr->getConstraintRepr ()->getStartLoc ()
715- : SourceLoc ());
716- inferRequirements (secondType, secondLoc, moduleForInference, dc, result);
709+ inferRequirements (firstType, moduleForInference, dc, result);
710+ inferRequirements (secondType, moduleForInference, dc, result);
717711 }
718712
719713 realizeTypeRequirement (dc, firstType, secondType, loc, result, errors);
@@ -723,9 +717,7 @@ void swift::rewriting::realizeRequirement(
723717 case RequirementKind::Layout: {
724718 if (shouldInferRequirements) {
725719 auto firstType = req.getFirstType ();
726- auto firstLoc = (reqRepr ? reqRepr->getSubjectRepr ()->getStartLoc ()
727- : SourceLoc ());
728- inferRequirements (firstType, firstLoc, moduleForInference, dc, result);
720+ inferRequirements (firstType, moduleForInference, dc, result);
729721 }
730722
731723 result.push_back ({req, loc});
@@ -735,14 +727,10 @@ void swift::rewriting::realizeRequirement(
735727 case RequirementKind::SameType: {
736728 if (shouldInferRequirements) {
737729 auto firstType = req.getFirstType ();
738- auto firstLoc = (reqRepr ? reqRepr->getFirstTypeRepr ()->getStartLoc ()
739- : SourceLoc ());
740- inferRequirements (firstType, firstLoc, moduleForInference, dc, result);
730+ inferRequirements (firstType, moduleForInference, dc, result);
741731
742732 auto secondType = req.getSecondType ();
743- auto secondLoc = (reqRepr ? reqRepr->getSecondTypeRepr ()->getStartLoc ()
744- : SourceLoc ());
745- inferRequirements (secondType, secondLoc, moduleForInference, dc, result);
733+ inferRequirements (secondType, moduleForInference, dc, result);
746734 }
747735
748736 result.push_back ({req, loc});
@@ -843,14 +831,14 @@ void swift::rewriting::realizeInheritedRequirements(
843831
844832 if (!inheritedType) continue ;
845833
846- auto *typeRepr = inheritedTypes.getTypeRepr (index);
847- SourceLoc loc = (typeRepr ? typeRepr->getStartLoc () : SourceLoc ());
848-
849834 if (shouldInferRequirements) {
850- inferRequirements (inheritedType, loc, moduleForInference,
835+ inferRequirements (inheritedType, moduleForInference,
851836 decl->getInnermostDeclContext (), result);
852837 }
853838
839+ auto *typeRepr = inheritedTypes.getTypeRepr (index);
840+ SourceLoc loc = (typeRepr ? typeRepr->getStartLoc () : SourceLoc ());
841+
854842 realizeTypeRequirement (dc, type, inheritedType, loc, result, errors);
855843 }
856844
0 commit comments