Look outside constant values for designators in where constraints (#7367)

The constant value may lose the designator during eval, such as an
`ImplWitnessAccess` that resolves to some concrete type. Look in the
non-canonical instructions instead.
This commit is contained in:
Dana Jansens
2026-07-16 19:00:06 +00:00
committed by GitHub
parent ee81a4e48e
commit 0848cf941d
7 changed files with 289 additions and 80 deletions
+10 -2
View File
@@ -35,8 +35,16 @@ auto HandleParseNode(Context& /*context*/,
auto HandleParseNode(Context& context, Parse::AliasId /*node_id*/) -> bool {
auto [expr_node, expr_id] = context.node_stack().PopExprWithNodeId();
auto name_context = context.decl_name_stack().FinishName(
PopNameComponentWithoutParams(context, Lex::TokenKind::Alias));
bool diagnosed_params = false;
auto name_context =
context.decl_name_stack().FinishName(PopNameComponentWithoutParams(
context, Lex::TokenKind::Alias, &diagnosed_params));
if (diagnosed_params) {
// If the alias had generic parameters, they could be SymbolicBindings which
// then appear in the `expr_id`. Using those elsewhere is then invalid and
// creates invalid states in the toolchain.
expr_id = SemIR::ErrorInst::InstId;
}
DiscardGenericDecl(context);