Skip to content

Commit 85be43f

Browse files
committed
[RequirementMachine] Omit duplicate conflict diagnostics.
1 parent 7e5c483 commit 85be43f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/AST/RequirementMachine/RewriteSystem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,10 @@ void RewriteSystem::computeConflictDiagnostics(
796796

797797
assert(firstRule.isPropertyRule() && secondRule.isPropertyRule());
798798

799+
if (firstRule.isSubstitutionSimplified() ||
800+
secondRule.isSubstitutionSimplified())
801+
continue;
802+
799803
bool chooseFirstRule = firstRule.getRHS().size() > secondRule.getRHS().size();
800804
auto subjectRule = chooseFirstRule ? firstRule : secondRule;
801805
auto subjectTerm = subjectRule.getRHS();

test/Generics/requirement_machine_diagnostics.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,12 @@ func sameTypeConflicts() {
308308

309309
struct G<T> {}
310310

311-
// FIXME: conflict diagnosed twice
312-
// expected-error@+1 2{{no type for 'T.X' can satisfy both 'T.X == G<U.Foo>' and 'T.X == Int'}}
311+
// expected-error@+1{{no type for 'T.X' can satisfy both 'T.X == G<U.Foo>' and 'T.X == Int'}}
313312
func fail7<U: Fooable, T: Concrete>(_: U, _: T) where T.X == G<U.Foo> {}
314313

315-
// FIXME: conflict diagnosed twice
316-
// expected-error@+2{{no type for 'T' can satisfy both 'T == Int' and 'T == G<U.Foo>'}}
317314
// expected-error@+1{{no type for 'T' can satisfy both 'T == G<U.Foo>' and 'T == Int'}}
318315
func fail8<T, U: Fooable>(_: U, _: T) where T == G<U.Foo>, T == Int {}
319316

320-
// FIXME: conflict diagnosed twice
321-
// expected-error@+1 2{{no type for 'T' can satisfy both 'T == G<U.Foo>' and 'T == Int'}}
317+
// expected-error@+1{{no type for 'T' can satisfy both 'T == G<U.Foo>' and 'T == Int'}}
322318
func fail9<T, U: Fooable>(_: U, _: T) where T == Int, T == G<U.Foo> {}
323319
}

0 commit comments

Comments
 (0)