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