mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:14:42 +01:00
where check stage, step 3: some type checking (#4364)
With this, we now check: * The left argument to `where` is a facet type * The right argument of a rewrite (`=`) requirement converts to the type of the left argument. * The left argument of an `impls` requirement is a type and the right argument is a facet type. No checking is done for `==` constraints yet. In addition, make the "is facet type" query into its own function and fix some comments noticed as part of this change. This change reveals that accessing the members of a facet, like `.Self`, isn't doing the right thing, and will have to be fixed in a follow-on PR. Some tests have been adjusted or disabled as a result. --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com>
This commit is contained in:
@@ -1192,9 +1192,7 @@ auto Context::GetTypeIdForTypeConstant(SemIR::ConstantId constant_id)
|
||||
auto type_id =
|
||||
insts().Get(constant_values().GetInstId(constant_id)).type_id();
|
||||
// TODO: For now, we allow values of facet type to be used as types.
|
||||
CARBON_CHECK(type_id == SemIR::TypeId::TypeType ||
|
||||
types().Is<SemIR::InterfaceType>(type_id) ||
|
||||
constant_id == SemIR::ConstantId::Error,
|
||||
CARBON_CHECK(IsFacetType(type_id) || constant_id == SemIR::ConstantId::Error,
|
||||
"Forming type ID for non-type constant of type {0}",
|
||||
types().GetAsInst(type_id));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user