mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user