mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Forbid nested where inside a where expression (#7378)
This disallows building a facet type that contains another facet type with non-extend constraints in it. Which in turn prevents the possibility of introducing a different `.Self` into a facet type. Eval can still insert a facet type with non-extend constraints, as we only prevent it for `where` being written into the facet type. There is a TODO in handle_where.cpp for this and some tests in toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon
This commit is contained in:
@@ -3243,6 +3243,10 @@ auto TryEvalTypedInst<SemIR::WhereExpr>(EvalContext& eval_context,
|
||||
Phase phase = Phase::Concrete;
|
||||
SemIR::FacetTypeInfo info;
|
||||
|
||||
if (inst.type_id() == SemIR::ErrorInst::TypeId) {
|
||||
return SemIR::ErrorInst::ConstantId;
|
||||
}
|
||||
|
||||
// Note that these requirement instructions don't have a constant value. That
|
||||
// means we have to look for errors inside them, we can't just look to see if
|
||||
// their constant value is an error.
|
||||
|
||||
Reference in New Issue
Block a user