mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:34:41 +01:00
Even more usage of TypeInstId (#5296)
Use TypeInstId in many more places where the instruction is required to/known to always be a type value. This should be a somewhat exhaustive set of places, as it covers all instructions given to GetTypeIdFromTypeInstId(). The things of interest here are: - Singleton instructions are always of type TypeType, so they are now TypeInstIds. - ErrorInst::SingletonInstId gets upcast to be an InstId because it's sometimes used to define the type of a variable (as in `auto inst_id = SemIR::ErrorInst::SingletonInstId;` that may hold other InstIds. - Parse nodes don't really know about TypeInstId, so NodeStack::Push needs to do some special casing to avoid CHECK failures when given a TypeInstId but expecting an InstId. We leave a TODO behind here because the nodes which are being pushed a TypeInstId should probably be taught to expect that, but such a change is a bit tricky, so too much for this PR.
This commit is contained in:
@@ -55,7 +55,7 @@ struct TypeParam {
|
||||
|
||||
// Constraint that a type is a specific builtin. See ValidateSignature for
|
||||
// details.
|
||||
template <const InstId& BuiltinId>
|
||||
template <const TypeInstId& BuiltinId>
|
||||
struct BuiltinType {
|
||||
static auto Check(const File& sem_ir, ValidateState& /*state*/,
|
||||
TypeId type_id) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user