mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Fix indirect import handling for functions. (#4258)
The particular test this focused on is indirect_two_file in toolchain/check/testdata/function/definition/no_prelude/extern_library.carbon. This removes `parent_scope_id_for_new_inst` because I think it's returning unhelpful results. The use was at the root of incorrect results for the indirect import chain. `name_id_for_new_inst` is actually wrapping a union, so it's more important. The merging of `is_extern` and `first_owning_decl_id` in `handle_function.cpp` feels like it's less correct with the changes that've been made to `extern`. This ripples in tests, because the error recovery shifts. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
2a7c2c5df2
commit
bed5fdcbbe
@@ -96,7 +96,7 @@ class DeclNameStack {
|
||||
-> SemIR::EntityWithParamsBase {
|
||||
return {
|
||||
.name_id = name_id_for_new_inst(),
|
||||
.parent_scope_id = parent_scope_id_for_new_inst(),
|
||||
.parent_scope_id = parent_scope_id,
|
||||
.generic_id = SemIR::GenericId::Invalid,
|
||||
.first_param_node_id = name.first_param_node_id,
|
||||
.last_param_node_id = name.last_param_node_id,
|
||||
@@ -121,13 +121,6 @@ class DeclNameStack {
|
||||
: SemIR::NameId::Invalid;
|
||||
}
|
||||
|
||||
// Returns the parent_scope_id for a new instruction. This is invalid
|
||||
// when the name resolved.
|
||||
auto parent_scope_id_for_new_inst() -> SemIR::NameScopeId {
|
||||
return state == State::Unresolved ? parent_scope_id
|
||||
: SemIR::NameScopeId::Invalid;
|
||||
}
|
||||
|
||||
// The current scope when this name began. This is the scope that we will
|
||||
// return to at the end of the declaration.
|
||||
ScopeIndex initial_scope_index;
|
||||
|
||||
Reference in New Issue
Block a user