mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:24:41 +01:00
Enforce that the parse node for an instruction has the kind specified in the instruction definition (#4264)
Remove `ReusingLoc` and add enforcement that even for imported locations, the kind of the parse node for an instruction matches the kind specified in the instruction definition. Change the node kind for a few instructions to `NodeId`: - A couple of instructions had a typed node but could be created implicitly with any node as part of a builtin implicit conversion. This happened for `AddrOf`, `ArrayIndex`, and `Deref`. - A bunch of instructions had `InvalidNodeId` as their associated parse node kind but were actually always created with a location. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
dada4fc29f
commit
891c7d8368
@@ -34,7 +34,7 @@ auto BuildAssociatedEntity(Context& context, SemIR::InterfaceId interface_id,
|
||||
// not the declaration itself.
|
||||
auto type_id = context.GetAssociatedEntityType(
|
||||
self_type_id, context.insts().Get(decl_id).type_id());
|
||||
return context.AddInstReusingLoc<SemIR::AssociatedEntity>(
|
||||
return context.AddInst<SemIR::AssociatedEntity>(
|
||||
context.insts().GetLocId(decl_id),
|
||||
{.type_id = type_id, .index = index, .decl_id = decl_id});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user