@@ -342,20 +342,18 @@ void swift::rewriting::realizeRequirement(
342
342
ModuleDecl *moduleForInference,
343
343
SmallVectorImpl<StructuralRequirement> &result) {
344
344
auto firstType = req.getFirstType ();
345
- if (moduleForInference) {
346
- auto firstLoc = (reqRepr ? reqRepr->getFirstTypeRepr ()->getStartLoc ()
347
- : SourceLoc ());
348
- inferRequirements (firstType, firstLoc, moduleForInference, result);
349
- }
350
-
351
345
auto loc = (reqRepr ? reqRepr->getSeparatorLoc () : SourceLoc ());
352
346
353
347
switch (req.getKind ()) {
354
348
case RequirementKind::Superclass:
355
349
case RequirementKind::Conformance: {
356
350
auto secondType = req.getSecondType ();
357
351
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 ()
359
357
: SourceLoc ());
360
358
inferRequirements (secondType, secondLoc, moduleForInference, result);
361
359
}
@@ -365,6 +363,12 @@ void swift::rewriting::realizeRequirement(
365
363
}
366
364
367
365
case RequirementKind::Layout: {
366
+ if (moduleForInference) {
367
+ auto firstLoc = (reqRepr ? reqRepr->getSubjectRepr ()->getStartLoc ()
368
+ : SourceLoc ());
369
+ inferRequirements (firstType, firstLoc, moduleForInference, result);
370
+ }
371
+
368
372
SmallVector<Requirement, 2 > reqs;
369
373
desugarLayoutRequirement (firstType, req.getLayoutConstraint (), reqs);
370
374
@@ -377,6 +381,10 @@ void swift::rewriting::realizeRequirement(
377
381
case RequirementKind::SameType: {
378
382
auto secondType = req.getSecondType ();
379
383
if (moduleForInference) {
384
+ auto firstLoc = (reqRepr ? reqRepr->getFirstTypeRepr ()->getStartLoc ()
385
+ : SourceLoc ());
386
+ inferRequirements (firstType, firstLoc, moduleForInference, result);
387
+
380
388
auto secondLoc = (reqRepr ? reqRepr->getSecondTypeRepr ()->getStartLoc ()
381
389
: SourceLoc ());
382
390
inferRequirements (secondType, secondLoc, moduleForInference, result);
0 commit comments