mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
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:
@@ -219,23 +219,6 @@ auto EvalConstantInst(Context& context, SemIR::FacetAccessType inst)
|
||||
context.constant_values().Get(facet_value->type_inst_id));
|
||||
}
|
||||
|
||||
if (auto bind_name = context.insts().TryGetAs<SemIR::SymbolicBinding>(
|
||||
inst.facet_value_inst_id)) {
|
||||
return ConstantEvalResult::NewSamePhase(SemIR::SymbolicBindingType{
|
||||
.type_id = SemIR::TypeType::TypeId,
|
||||
.entity_name_id = bind_name->entity_name_id,
|
||||
// TODO: This is to be removed, at which point explore if we should
|
||||
// replace NewSamePhase with NewAnyPhase (to make the constant value
|
||||
// concrete). This is still a symbolic type though even if the inst
|
||||
// doesn't contain a symbolic constant. Previously we crashed in CHECKs
|
||||
// when we had a symbolic instruction with only an EntityNameId, due to
|
||||
// it not changing in a generic eval block. Maybe that has improved in
|
||||
// the latest version of this instruction. If it's not symbolic, then
|
||||
// SubstConstantCallbacks and other Subst callers may need to handle
|
||||
// looking through concrete instructions which would be unfortunate.
|
||||
.facet_value_inst_id = inst.facet_value_inst_id});
|
||||
}
|
||||
|
||||
// The `facet_value_inst_id` is always a facet value (has type facet type).
|
||||
CARBON_CHECK(context.types().Is<SemIR::FacetType>(
|
||||
context.insts().Get(inst.facet_value_inst_id).type_id()));
|
||||
@@ -248,18 +231,14 @@ auto EvalConstantInst(Context& context, SemIR::FacetAccessType inst)
|
||||
|
||||
auto EvalConstantInst(Context& context, SemIR::FacetValue inst)
|
||||
-> ConstantEvalResult {
|
||||
// A FacetValue that just wraps a SymbolicBinding without adding/removing any
|
||||
// witnesses is evaluated back to the SymbolicBinding itself.
|
||||
if (auto bind_as_type = context.insts().TryGetAs<SemIR::SymbolicBindingType>(
|
||||
inst.type_inst_id)) {
|
||||
// TODO: Look in ScopeStack with the entity_name_id to find the facet value.
|
||||
auto bind_id = bind_as_type->facet_value_inst_id;
|
||||
auto bind = context.insts().GetAs<SemIR::SymbolicBinding>(bind_id);
|
||||
// If the FacetTypes are the same, then the FacetValue didn't add/remove
|
||||
// any witnesses.
|
||||
if (bind.type_id == inst.type_id) {
|
||||
// A FacetValue that just wraps a facet without adding/removing any witnesses
|
||||
// (which means they have the same type) is evaluated to the facet itself.
|
||||
if (auto access =
|
||||
context.insts().TryGetAs<SemIR::FacetAccessType>(inst.type_inst_id)) {
|
||||
if (context.insts().Get(access->facet_value_inst_id).type_id() ==
|
||||
inst.type_id) {
|
||||
return ConstantEvalResult::Existing(
|
||||
context.constant_values().Get(bind_id));
|
||||
context.constant_values().Get(access->facet_value_inst_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user