Allocate de Bruijn levels to symbolic bindings. (#3906)

Use a level comparison during substitution to determine whether we're
substituting a particular binding. Evaluate symbolic bindings with the
same name and the same level to the same symbolic constant, for example
across redeclarations of a generic function.
This commit is contained in:
Richard Smith
2024-04-23 16:15:47 +00:00
committed by GitHub
parent 76a5cf5f50
commit e0b8728263
106 changed files with 1240 additions and 706 deletions
+4
View File
@@ -19,6 +19,10 @@ auto ScopeStack::Push(SemIR::InstId scope_inst_id, SemIR::NameScopeId scope_id,
{.index = next_scope_index_,
.scope_inst_id = scope_inst_id,
.scope_id = scope_id,
.next_compile_time_bind_index =
scope_stack_.empty()
? SemIR::CompileTimeBindIndex(0)
: scope_stack_.back().next_compile_time_bind_index,
.lexical_lookup_has_load_error =
LexicalLookupHasLoadError() || lexical_lookup_has_load_error});
if (scope_id.is_valid()) {