Add diagnostic support so that we can just pass in TypeId. (#3695)

Note we may also want to do this with NameId, maybe some other things,
but the TypeId use is pretty broad and repetitive -- I thought I'd start
with it first.
This commit is contained in:
Jon Ross-Perkins
2024-02-09 16:25:23 +00:00
committed by GitHub
parent bdff7ccf28
commit 1bf4dc53d9
16 changed files with 168 additions and 104 deletions
+2 -2
View File
@@ -38,9 +38,9 @@ auto HandleCallExpr(Context& context, Parse::CallExprId parse_node) -> bool {
auto callee_type_id = context.insts().Get(callee_id).type_id();
if (callee_type_id != SemIR::TypeId::Error) {
CARBON_DIAGNOSTIC(CallToNonCallable, Error,
"Value of type `{0}` is not callable.", std::string);
"Value of type `{0}` is not callable.", SemIR::TypeId);
context.emitter().Emit(call_expr_parse_node, CallToNonCallable,
context.sem_ir().StringifyType(callee_type_id));
callee_type_id);
}
context.node_stack().Push(parse_node, SemIR::InstId::BuiltinError);
return true;