Form the contents of the witness table. (#3756)

Check that functions in an `impl` are declared properly. For now, simply
reuse the redeclaration checking logic. Longer-term, we need to check
that the signatures match in a more approximate way, after substituting
the `Self` type into the signature in the `interface`.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-03-08 23:53:48 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 551a6d385e
commit a1317e61e0
14 changed files with 910 additions and 16 deletions
+6
View File
@@ -173,6 +173,12 @@ static auto CheckRedecl(Context& context, const SemIR::Function& new_function,
return true;
}
auto CheckFunctionRedecl(Context& context, SemIR::FunctionId new_function_id,
SemIR::FunctionId prev_function_id) -> bool {
return CheckRedecl(context, context.functions().Get(new_function_id),
context.functions().Get(prev_function_id));
}
auto MergeFunctionRedecl(Context& context, Parse::NodeId parse_node,
SemIR::Function& new_function,
SemIR::FunctionId prev_function_id, bool is_definition)