Remove SymbolicBindingType (#7114)

This inst was meant to support tracking the depth of a `.Self` facet,
but we have now implemented substitution of `.Self` in facet type
identification, and in eval of where expressions, without needing to
track the depth.

See history here:
-
[2025-06-30](https://docs.google.com/document/d/1Yt-i5AmF76LSvD4TrWRIAE_92kii6j5yFiW-S7ahzlg/edit?tab=t.0#heading=h.4qd5dkyfn2k3)
-
[2025-07-07](https://docs.google.com/document/d/1Yt-i5AmF76LSvD4TrWRIAE_92kii6j5yFiW-S7ahzlg/edit?tab=t.0#heading=h.7urbxcq23olv)
- #6026
This commit is contained in:
Dana Jansens
2026-04-27 19:04:59 +00:00
committed by GitHub
parent df6a5a50dc
commit 554b1b8d10
156 changed files with 8472 additions and 8687 deletions
-57
View File
@@ -2467,63 +2467,6 @@ auto TryEvalTypedInst<SemIR::SymbolicBinding>(EvalContext& eval_context,
return MakeConstantResult(eval_context.context(), bind, phase);
}
template <>
auto TryEvalTypedInst<SemIR::SymbolicBindingType>(EvalContext& eval_context,
SemIR::InstId inst_id,
SemIR::Inst inst)
-> SemIR::ConstantId {
// If a specific provides a new value for the binding with `entity_name_id`,
// the SymbolicBindingType is evaluated for that new value.
const auto& bind_name = eval_context.entity_names().Get(
inst.As<SemIR::SymbolicBindingType>().entity_name_id);
if (bind_name.bind_index().has_value()) {
if (auto value =
eval_context.GetCompileTimeBindValue(bind_name.bind_index());
value.has_value()) {
auto value_inst_id = eval_context.constant_values().GetInstId(value);
// A SymbolicBindingType can evaluate to a FacetAccessType if the new
// value of the entity is a facet value that that does not have a concrete
// type (a FacetType) and does not have a new EntityName to point to (a
// SymbolicBinding).
auto access = SemIR::FacetAccessType{
.type_id = SemIR::TypeType::TypeId,
.facet_value_inst_id = value_inst_id,
};
return ConvertEvalResultToConstantId(
eval_context.context(),
EvalConstantInst(eval_context.context(), access),
SemIR::SymbolicBindingType::Kind,
ComputeInstPhase(eval_context.context(), access));
}
}
Phase phase = Phase::Concrete;
if (!ReplaceTypeWithConstantValue(eval_context, inst_id, &inst, &phase) ||
!ReplaceAllFieldsWithConstantValues(eval_context, &inst, &phase)) {
return SemIR::ConstantId::NotConstant;
}
// Propagate error phase after getting the constant value for all fields.
if (phase == Phase::UnknownDueToError) {
return SemIR::ErrorInst::ConstantId;
}
// Evaluation of SymbolicBindingType.
//
// Like FacetAccessType, a SymbolicBindingType of a FacetValue just evaluates
// to the type inside.
//
// TODO: Look in ScopeStack with the entity_name_id to find the facet value
// and get its constant value in the current specific context. The
// facet_value_inst_id will go away.
if (auto facet_value = eval_context.insts().TryGetAs<SemIR::FacetValue>(
inst.As<SemIR::SymbolicBindingType>().facet_value_inst_id)) {
return eval_context.constant_values().Get(facet_value->type_inst_id);
}
return MakeConstantResult(eval_context.context(), inst, phase);
}
template <>
auto TryEvalTypedInst<SemIR::Temporary>(EvalContext& eval_context,
SemIR::InstId inst_id, SemIR::Inst inst)