mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:54:47 +01:00
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:
@@ -257,11 +257,10 @@ static auto PerformAggregateIndex(Context& context, SemIR::Inst inst)
|
||||
context.ints().Get(bound->int_id).ule(index_val.getZExtValue())) {
|
||||
CARBON_DIAGNOSTIC(ArrayIndexOutOfBounds, Error,
|
||||
"Array index `{0}` is past the end of type `{1}`.",
|
||||
llvm::APSInt, std::string);
|
||||
context.emitter().Emit(
|
||||
index_inst.index_id, ArrayIndexOutOfBounds,
|
||||
llvm::APSInt(index_val, /*isUnsigned=*/true),
|
||||
context.sem_ir().StringifyType(aggregate_type_id));
|
||||
llvm::APSInt, SemIR::TypeId);
|
||||
context.emitter().Emit(index_inst.index_id, ArrayIndexOutOfBounds,
|
||||
llvm::APSInt(index_val, /*isUnsigned=*/true),
|
||||
aggregate_type_id);
|
||||
return SemIR::ConstantId::Error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user