Remove ImportRefUsed (#3934)

This was to track use of a declaration after import, prior to a
redeclaration. Per [discussion on
Discord](https://discord.com/channels/655572317891461132/1217182321933815820/1236016521059237962),
we likely don't need this check due to the change in behavior of
`extern`.

Rather than potentially getting one of many `extern` decls and depending
on it by accident, it is now planned to be _required_ to be imported,
and the library doing a non-`extern` decl must _know_ it's importing the
`extern` decl. The stricter requirement on the library means it now
seems more reasonable to use the `extern` decl.

So kind of rolling back #3831, though keeping `ImportIRInstId` (at least
for now) and keeping `Loaded`/`Unloaded` terminology (seems a nicer
fit).
This commit is contained in:
Jon Ross-Perkins
2024-05-03 23:33:42 +00:00
committed by GitHub
parent 76ed3c73cb
commit 92fa0ac1ac
76 changed files with 361 additions and 475 deletions
+3 -3
View File
@@ -90,7 +90,7 @@ static auto BuildInterfaceWitness(
.replacement_id = context.types().GetConstantId(impl.self_id)}};
for (auto decl_id : assoc_entities) {
LoadImportRef(context, decl_id, impl.definition_id);
LoadImportRef(context, decl_id);
auto const_id = context.constant_values().Get(decl_id);
CARBON_CHECK(const_id.is_constant()) << "Non-constant associated entity";
auto decl = context.insts().Get(const_id.inst_id());
@@ -105,8 +105,8 @@ static auto BuildInterfaceWitness(
CARBON_FATAL() << "Unexpected type: " << type_inst;
}
auto& fn = context.functions().Get(fn_type->function_id);
auto impl_decl_id = context.LookupNameInExactScope(
decl_id, fn.name_id, impl_scope, /*mark_imports_used=*/true);
auto impl_decl_id =
context.LookupNameInExactScope(decl_id, fn.name_id, impl_scope);
if (impl_decl_id.is_valid()) {
used_decl_ids.push_back(impl_decl_id);
table.push_back(CheckAssociatedFunctionImplementation(