Add Abstract enumerator to InitRepr::Kind (#6513)

This fixes a bug where `CheckFunctionReturnType` could sometimes fail to
diagnose an abstract return type.
This commit is contained in:
Geoff Romer
2025-12-17 00:00:14 +00:00
committed by GitHub
parent 2e65d28a16
commit ad7ea755b0
9 changed files with 47 additions and 23 deletions
+2 -1
View File
@@ -100,7 +100,8 @@ auto CheckFunctionReturnType(Context& context, SemIR::LocId loc_id,
// If we couldn't determine the return information due to the return type
// being incomplete, try to complete it now.
if (return_info.init_repr.kind == SemIR::InitRepr::Incomplete) {
if (return_info.init_repr.kind == SemIR::InitRepr::Incomplete ||
return_info.init_repr.kind == SemIR::InitRepr::Abstract) {
auto diagnose_incomplete_return_type = [&] {
CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Error,
"function returns incomplete type {0}", SemIR::TypeId);