Switch EvalLookupSingleImplWitness from "concrete" to "final" terminology (#6246)

A `final impl` can have a symbolic witness, but that witness is still
final. Using "final" here per discussion on
[#generics-and-templates](https://discord.com/channels/655572317891461132/941071822756143115/1428851511672312120).

I'm also changing the variant a little because `concrete_witness` was
only called when `has_concrete_value` was true, so it can be more
careful about its contract. Having a more explicit `None` also
simplifies `has_value`. I think it doesn't change the overall cost much
past that.
This commit is contained in:
Jon Ross-Perkins
2025-10-20 17:25:26 +00:00
committed by GitHub
parent 1df0d4566e
commit b1f734e1cd
4 changed files with 38 additions and 36 deletions
+3 -3
View File
@@ -295,7 +295,7 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id,
auto result = EvalLookupSingleImplWitness(context, SemIR::LocId(inst_id),
inst, self_facet_value_inst_id,
/*poison_concrete_results=*/true);
/*poison_final_results=*/true);
if (!result.has_value()) {
// We use NotConstant to communicate back to impl lookup that the lookup
// failed. This can not happen for a deferred symbolic lookup in a generic
@@ -303,9 +303,9 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id,
// evaluated here) to the SemIR if the lookup succeeds.
return ConstantEvalResult::NotConstant;
}
if (result.has_concrete_value()) {
if (result.has_final_value()) {
return ConstantEvalResult::Existing(
context.constant_values().Get(result.concrete_witness()));
context.constant_values().Get(result.final_witness()));
}
return ConstantEvalResult::NewSamePhase(inst);