mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Explorer: improve type checking trace output (#3039)
Updates the trace output for type checking to be more consistent like the rest of trace output. This PR also includes few changes in the lit tests related to trace output. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
6d3a4b84cb
commit
a359da37c4
+28
-12
@@ -37,23 +37,39 @@ void Bindings::Add(Nonnull<const GenericBinding*> binding,
|
||||
}
|
||||
}
|
||||
|
||||
void Bindings::Print(llvm::raw_ostream& out) const {
|
||||
std::vector<std::pair<Nonnull<const GenericBinding*>, Nonnull<const Value*>>>
|
||||
args(args_.begin(), args_.end());
|
||||
|
||||
std::vector<std::pair<Nonnull<const ImplBinding*>, Nonnull<const Value*>>>
|
||||
witnesses(witnesses_.begin(), witnesses_.end());
|
||||
|
||||
std::stable_sort(args.begin(), args.end(), [](const auto& a, const auto& b) {
|
||||
return a.first->index() < b.first->index();
|
||||
});
|
||||
|
||||
std::stable_sort(
|
||||
witnesses.begin(), witnesses.end(), [](const auto& a, const auto& b) {
|
||||
return a.first->type_var()->index() < b.first->type_var()->index();
|
||||
});
|
||||
|
||||
llvm::ListSeparator sep;
|
||||
out << " > bindings args: [";
|
||||
for (const auto& [binding, value] : args) {
|
||||
out << sep << "`" << *binding << "`: `" << *value << "`";
|
||||
}
|
||||
out << "]\n > bindings witnesses: [";
|
||||
for (const auto& [binding, value] : witnesses) {
|
||||
out << sep << "`" << *binding << "`: `" << *value << "`";
|
||||
}
|
||||
out << "]";
|
||||
};
|
||||
|
||||
auto Bindings::None() -> Nonnull<const Bindings*> {
|
||||
static Nonnull<const Bindings*> bindings = new Bindings;
|
||||
return bindings;
|
||||
}
|
||||
|
||||
void Bindings::Print(llvm::raw_ostream& out) const {
|
||||
out << "{";
|
||||
llvm::ListSeparator sep;
|
||||
for (const auto& [name, value] : args_) {
|
||||
out << sep << *name << " -> " << *value;
|
||||
}
|
||||
for (const auto& [name, value] : witnesses_) {
|
||||
out << sep << *name << " -> " << *value;
|
||||
}
|
||||
out << "}";
|
||||
}
|
||||
|
||||
auto Bindings::SymbolicIdentity(
|
||||
Nonnull<Arena*> arena,
|
||||
llvm::ArrayRef<Nonnull<const GenericBinding*>> bindings)
|
||||
|
||||
Reference in New Issue
Block a user