Provide a Printable CRTP parent to replace HasPrintable templates. (#3166)

With the toolchain splitting namespaces, ostream.h's `operator<<`
templates aren't reliably found with name lookup, likely due to the loss
of associated namespaces (zygoloid commented on this at
https://github.com/carbon-language/carbon-lang/pull/3161#discussion_r1307941999).
This is especially a barrier to moving the lex files into `Carbon::Lex`;
versus other parts of the toolchain, they contain more printable types
which are used cross-namespace, including `Carbon::Testing`. As a
consequence, I'm looking at migrating ostream.h to a more reliable
approach that doesn't rely as much on everything being in the `Carbon`
namespace.
This commit is contained in:
Jon Ross-Perkins
2023-08-30 21:32:19 +00:00
committed by GitHub
parent 9600030a05
commit 53af8f04b2
32 changed files with 114 additions and 240 deletions
+1 -2
View File
@@ -183,8 +183,7 @@ auto ImplScope::TryResolve(Nonnull<const Value*> constraint_type,
CARBON_ASSIGN_OR_RETURN(
Nonnull<const Value*> type,
type_checker.Substitute(local_bindings, intrinsic.type));
IntrinsicConstraint converted = {
.type = type, .kind = intrinsic.kind, .arguments = {}};
IntrinsicConstraint converted(type, intrinsic.kind, {});
converted.arguments.reserve(intrinsic.arguments.size());
for (Nonnull<const Value*> argument : intrinsic.arguments) {
CARBON_ASSIGN_OR_RETURN(