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
+5 -2
View File
@@ -81,8 +81,8 @@ auto PopNameComponent(Context& context, SemIR::InstId return_pattern_id)
// Pop the name of a declaration from the node stack, and diagnose if it has
// parameters.
auto PopNameComponentWithoutParams(Context& context, Lex::TokenKind introducer)
-> NameComponent {
auto PopNameComponentWithoutParams(Context& context, Lex::TokenKind introducer,
bool* diagnosed_params) -> NameComponent {
NameComponent name = PopNameComponent(context);
if (name.call_params_id.has_value()) {
CARBON_DIAGNOSTIC(UnexpectedDeclNameParams, Error,
@@ -95,6 +95,9 @@ auto PopNameComponentWithoutParams(Context& context, Lex::TokenKind introducer)
UnexpectedDeclNameParams, introducer);
name.call_params_id = SemIR::InstBlockId::None;
if (diagnosed_params) {
*diagnosed_params = true;
}
}
return name;
}