Support constant InstActions (#7671)

Treat `InstConstantKind::InstAction` the same as
`InstConstantKind::ConstInstAction`. Drop `ConstInstAction`, since the
two now behave the same.

Fix eval for specifics in a couple places to handle `InstId::None`.
This commit is contained in:
Nicholas Bishop
2026-08-24 18:05:15 +00:00
committed by GitHub
parent 369b8fd06f
commit 7f3584a123
17 changed files with 451 additions and 172 deletions
+1 -11
View File
@@ -773,17 +773,7 @@ auto EvalConstantInst(Context& context, SemIR::SpliceInst inst)
return ConstantEvalResult::Existing(
context.constant_values().Get(inst_value->inst_id));
}
switch (nested_inst.kind().constant_kind()) {
case SemIR::InstConstantKind::ConstantInstAction:
return ConstantEvalResult::NewSamePhase(inst);
case SemIR::InstConstantKind::InstAction:
// TODO: Consider creating a new `ValueOfInst` instruction analogous to
// `TypeOfInst` to defer determining the constant value until we know the
// instruction. Alternatively, produce a symbolic `SpliceInst` constant.
return ConstantEvalResult::NotConstant;
default:
CARBON_FATAL("Unexpected inst kind for inst splice: {0}", nested_inst);
}
return ConstantEvalResult::NewSamePhase(inst);
}
auto EvalConstantInst(Context& context, SemIR::StructAccess inst)