@@ -322,11 +322,12 @@ Constraint *Constraint::clone(ConstraintSystem &cs) const {
322
322
llvm_unreachable (" Unhandled ConstraintKind in switch." );
323
323
}
324
324
325
- void Constraint::print (llvm::raw_ostream &Out, SourceManager *sm) const {
325
+ void Constraint::print (llvm::raw_ostream &Out, SourceManager *sm, bool repeatedLocator ) const {
326
326
// Print all type variables as $T0 instead of _ here.
327
327
PrintOptions PO;
328
328
PO.PrintTypesForDebugging = true ;
329
329
330
+ ConstraintLocator *firstLocator;
330
331
if (Kind == ConstraintKind::Disjunction ||
331
332
Kind == ConstraintKind::Conjunction) {
332
333
Out << (Kind == ConstraintKind::Disjunction ? " disjunction"
@@ -337,6 +338,7 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm) const {
337
338
if (isIsolated ())
338
339
Out << " (isolated)" ;
339
340
341
+ firstLocator = Locator;
340
342
if (Locator) {
341
343
Out << " [[" ;
342
344
Locator->dump (sm, Out);
@@ -352,7 +354,11 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm) const {
352
354
Out << " > [favored] " ;
353
355
else
354
356
Out << " > " ;
357
+ if (constraint->getLocator () == firstLocator) {
358
+ constraint->print (Out, sm, true );
359
+ } else {
355
360
constraint->print (Out, sm);
361
+ }
356
362
},
357
363
[&] { Out << " \n " ; });
358
364
return ;
@@ -522,7 +528,7 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm) const {
522
528
fix->print (Out);
523
529
}
524
530
525
- if (Locator) {
531
+ if (Locator && !repeatedLocator ) {
526
532
Out << " [[" ;
527
533
Locator->dump (sm, Out);
528
534
Out << " ]];" ;
0 commit comments