Move type functions off Context (#4951)

This creates a new check/type.h for most logic, and also moves some
functions to TypeStore in sem_ir/type.h. My approach for TypeStore is to
focus on moving the read-only functions there.
This commit is contained in:
Jon Ross-Perkins
2025-02-13 23:02:38 +00:00
committed by GitHub
parent 23e5677c8e
commit dc8f47e6ad
39 changed files with 506 additions and 393 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ auto HandleParseNode(Context& context, Parse::WhereOperandId node_id) -> bool {
auto self_type_id = ExprAsType(context, self_node, self_id).type_id;
// Only facet types may have `where` restrictions.
if (self_type_id != SemIR::ErrorInst::SingletonTypeId &&
!context.IsFacetType(self_type_id)) {
!context.types().IsFacetType(self_type_id)) {
CARBON_DIAGNOSTIC(WhereOnNonFacetType, Error,
"left argument of `where` operator must be a facet type");
context.emitter().Emit(self_node, WhereOnNonFacetType);
@@ -107,7 +107,7 @@ auto HandleParseNode(Context& context, Parse::RequirementImplsId node_id)
auto lhs_as_type = ExprAsType(context, lhs_node, lhs_id);
auto rhs_as_type = ExprAsType(context, rhs_node, rhs_id);
if (rhs_as_type.type_id != SemIR::ErrorInst::SingletonTypeId &&
!context.IsFacetType(rhs_as_type.type_id)) {
!context.types().IsFacetType(rhs_as_type.type_id)) {
CARBON_DIAGNOSTIC(
ImplsOnNonFacetType, Error,
"right argument of `impls` requirement must be a facet type");