mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 11:21:05 +01:00
Add fields for extern to EntityWithParamsBase (#4206)
This adds fields to `EntityWithParamsBase` to reflect the intention with `extern library` design. I'm renaming `decl_id` because it shouldn't be expected to be assigned anymore. import_ref.cpp I'm deliberately keeping on `first_owning_decl_id` (which will break when importing `extern library` declarations). Most other cases are for diagnostics, and I'm using `latest_decl_id` to try and get the closest declaration to the error. Note I'm partly splitting out this PR to show the test effect, which apparently we don't test related cases.
This commit is contained in:
@@ -41,21 +41,21 @@ auto CheckFunctionTypeMatches(Context& context,
|
||||
"Function redeclaration differs because no return type is provided.");
|
||||
auto diag =
|
||||
new_return_type_id.is_valid()
|
||||
? context.emitter().Build(new_function.decl_id,
|
||||
? context.emitter().Build(new_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypeDiffers,
|
||||
new_return_type_id)
|
||||
: context.emitter().Build(new_function.decl_id,
|
||||
: context.emitter().Build(new_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypeDiffersNoReturn);
|
||||
if (prev_return_type_id.is_valid()) {
|
||||
CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePrevious, Note,
|
||||
"Previously declared with return type `{0}`.",
|
||||
SemIR::TypeId);
|
||||
diag.Note(prev_function.decl_id, FunctionRedeclReturnTypePrevious,
|
||||
prev_return_type_id);
|
||||
diag.Note(prev_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypePrevious, prev_return_type_id);
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePreviousNoReturn, Note,
|
||||
"Previously declared with no return type.");
|
||||
diag.Note(prev_function.decl_id,
|
||||
diag.Note(prev_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypePreviousNoReturn);
|
||||
}
|
||||
diag.Emit();
|
||||
|
||||
Reference in New Issue
Block a user