@@ -342,20 +342,18 @@ void swift::rewriting::realizeRequirement(
342342 ModuleDecl *moduleForInference,
343343 SmallVectorImpl<StructuralRequirement> &result) {
344344 auto firstType = req.getFirstType ();
345- if (moduleForInference) {
346- auto firstLoc = (reqRepr ? reqRepr->getFirstTypeRepr ()->getStartLoc ()
347- : SourceLoc ());
348- inferRequirements (firstType, firstLoc, moduleForInference, result);
349- }
350-
351345 auto loc = (reqRepr ? reqRepr->getSeparatorLoc () : SourceLoc ());
352346
353347 switch (req.getKind ()) {
354348 case RequirementKind::Superclass:
355349 case RequirementKind::Conformance: {
356350 auto secondType = req.getSecondType ();
357351 if (moduleForInference) {
358- auto secondLoc = (reqRepr ? reqRepr->getSecondTypeRepr ()->getStartLoc ()
352+ auto firstLoc = (reqRepr ? reqRepr->getSubjectRepr ()->getStartLoc ()
353+ : SourceLoc ());
354+ inferRequirements (firstType, firstLoc, moduleForInference, result);
355+
356+ auto secondLoc = (reqRepr ? reqRepr->getConstraintRepr ()->getStartLoc ()
359357 : SourceLoc ());
360358 inferRequirements (secondType, secondLoc, moduleForInference, result);
361359 }
@@ -365,6 +363,12 @@ void swift::rewriting::realizeRequirement(
365363 }
366364
367365 case RequirementKind::Layout: {
366+ if (moduleForInference) {
367+ auto firstLoc = (reqRepr ? reqRepr->getSubjectRepr ()->getStartLoc ()
368+ : SourceLoc ());
369+ inferRequirements (firstType, firstLoc, moduleForInference, result);
370+ }
371+
368372 SmallVector<Requirement, 2 > reqs;
369373 desugarLayoutRequirement (firstType, req.getLayoutConstraint (), reqs);
370374
@@ -377,6 +381,10 @@ void swift::rewriting::realizeRequirement(
377381 case RequirementKind::SameType: {
378382 auto secondType = req.getSecondType ();
379383 if (moduleForInference) {
384+ auto firstLoc = (reqRepr ? reqRepr->getFirstTypeRepr ()->getStartLoc ()
385+ : SourceLoc ());
386+ inferRequirements (firstType, firstLoc, moduleForInference, result);
387+
380388 auto secondLoc = (reqRepr ? reqRepr->getSecondTypeRepr ()->getStartLoc ()
381389 : SourceLoc ());
382390 inferRequirements (secondType, secondLoc, moduleForInference, result);
0 commit comments