Fix crash lowering call to generic function with concrete type in signature (#7009)

When a function call appears in a generic, and calls another generic
that has a concrete type in its call-site signature, that concrete type
will be completed only in the file that contains the call. The generic
containing the call won't require completeness to be checked again when
forming a specific call, because the type was concrete. This means that
when lowering the call instruction, there is no single file that is
guaranteed to contain complete types for all of the callee's parameters
-- the file containing the specific callee won't necessarily have
completed the concrete parts of the signature, and the files containing
the definition and call won't necessarily have completed the symbolic
parts of the signature.

To handle this, look at both versions of the function when building its
lowered signature -- the version that we saw when forming the `call`
instruction and the version corresponding to the concrete, specific
callee, and combine information from both to form the LLVM function
type.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
Richard Smith
2026-04-03 21:24:00 +00:00
committed by GitHub
co-authored by Geoff Romer
parent fed9e8c878
commit ea409f7cbf
5 changed files with 668 additions and 150 deletions
+2 -2
View File
@@ -2448,12 +2448,12 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver,
resolver, resolver.import_classes()
.Get(resolver.import_vtables().Get(inst.vtable_id).class_id)
.vtable_decl_id);
auto vtable_const_inst = resolver.local_insts().Get(
resolver.local_constant_values().GetInstId(vtable_const_id));
if (resolver.HasNewWork()) {
return ResolveResult::Retry();
}
auto vtable_const_inst = resolver.local_insts().Get(
resolver.local_constant_values().GetInstId(vtable_const_id));
return ResolveResult::Deduplicated<SemIR::VtablePtr>(
resolver,
{.type_id = GetPointerType(resolver.local_context(),