Add 'let' handling for ImportRefUsed. (#3700)

- File::StringifyTypeExpr now has a case that hits the ImportRefUsed
TODO, so implementing that. I think the `static` approach will be
helpful in ensuring there aren't access bugs, particularly when future
support is added.

- `let` wasn't adding to exports because it doesn't use
`decl_name_stack` the way `var` does. This now adds to exports, but we
might want to unify logic for issues such as this.

- BuildImportRefUsedValueRepr is now called for another inst kind, and
it seemed like calling back to BuildValueRepr was the best way to
resolve this. I don't *think* that's going to cause recursion.
This commit is contained in:
Jon Ross-Perkins
2024-02-13 00:53:13 +00:00
committed by GitHub
parent 99bc9734d9
commit f76bc733f4
9 changed files with 272 additions and 101 deletions
+3 -2
View File
@@ -21,9 +21,10 @@ static auto GetImportName(const SemIR::File& import_sem_ir,
SemIR::Inst import_inst)
-> std::pair<SemIR::NameId, SemIR::NameScopeId> {
switch (import_inst.kind()) {
case SemIR::InstKind::BindName: {
case SemIR::InstKind::BindName:
case SemIR::InstKind::BindSymbolicName: {
const auto& bind_name = import_sem_ir.bind_names().Get(
import_inst.As<SemIR::BindName>().bind_name_id);
import_inst.As<SemIR::AnyBindName>().bind_name_id);
return {bind_name.name_id, bind_name.enclosing_scope_id};
}