mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Wrap lookup result in a new ScopeLookupResult (#4831)
Benefits: * Provide a proper API for accessing lookup information. * Make assumptions on whether the result is poisoned or not and how we can use `InstId` explicit. * Allow safely reusing the `InstId` value for pointing to the poisoning entity for poisoned results (in a future PR). * Consolidate `LookupNameInExactScopeResult`, `std::pair<SemIR::InstId, bool>` and part of `LookupResult`. Part of #4622.
This commit is contained in:
@@ -416,12 +416,13 @@ auto FinishImplWitness(Context& context, SemIR::Impl& impl) -> void {
|
||||
CARBON_FATAL("Unexpected type: {0}", type_inst);
|
||||
}
|
||||
auto& fn = context.functions().Get(fn_type->function_id);
|
||||
auto [impl_decl_id, _, is_poisoned] = context.LookupNameInExactScope(
|
||||
auto lookup_result = context.LookupNameInExactScope(
|
||||
decl_id, fn.name_id, impl.scope_id, impl_scope);
|
||||
if (impl_decl_id.has_value()) {
|
||||
used_decl_ids.push_back(impl_decl_id);
|
||||
if (lookup_result.is_found()) {
|
||||
used_decl_ids.push_back(lookup_result.target_inst_id());
|
||||
witness_block[index] = CheckAssociatedFunctionImplementation(
|
||||
context, *fn_type, impl_decl_id, self_type_id, impl.witness_id);
|
||||
context, *fn_type, lookup_result.target_inst_id(), self_type_id,
|
||||
impl.witness_id);
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(
|
||||
ImplMissingFunction, Error,
|
||||
|
||||
Reference in New Issue
Block a user