mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Remove overeager CHECK. (#4159)
When evaluating within the context of a specific, we can encounter uses of bindings that are nested within that specific, for example parts of the declaration of a nested generic. Those bindings should evaluate to the canonical form of themselves, as they would when evaluating outside the context of the specific. Fixes #4157.
This commit is contained in:
@@ -1335,13 +1335,9 @@ auto TryEvalInstInContext(EvalContext& eval_context, SemIR::InstId inst_id,
|
||||
const auto& specific =
|
||||
eval_context.generic_instances().Get(eval_context.specific_id);
|
||||
auto args = eval_context.inst_blocks().Get(specific.args_id);
|
||||
if (static_cast<size_t>(bind_name.bind_index.index) >= args.size()) {
|
||||
// TODO: For now we don't provide a mapping for the `Self` type in an
|
||||
// interface, and fall back to the canonical constant type.
|
||||
CARBON_CHECK(bind_name.name_id == SemIR::NameId::SelfType)
|
||||
<< "Use of binding " << bind_name.bind_index
|
||||
<< " with no corresponding value.";
|
||||
} else {
|
||||
// Bindings past the ones with known arguments can appear as local
|
||||
// bindings of entities declared within this generic.
|
||||
if (static_cast<size_t>(bind_name.bind_index.index) < args.size()) {
|
||||
return eval_context.context.constant_values().Get(
|
||||
args[bind_name.bind_index.index]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user