mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:11:12 +01:00
Do a stable sort when splitting up impls by interface (#5423)
Keep the impls for each interface in the order that they were declared. This ensures that the resulting diagnostics will be deterministic.
This commit is contained in:
@@ -575,7 +575,7 @@ auto CheckUnit::CheckOverlappingImpls() -> void {
|
||||
// interface. We only need to compare impls within each such segment.
|
||||
llvm::SmallVector<SemIR::Impl> impls_by_interface(
|
||||
context_.impls().array_ref());
|
||||
llvm::sort(
|
||||
llvm::stable_sort(
|
||||
impls_by_interface, [](const SemIR::Impl& a, const SemIR::Impl& b) {
|
||||
return a.interface.interface_id.index < b.interface.interface_id.index;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user