- Empty enums would return the values as zero sized arrays #2838

This commit is contained in:
Christoffer Lerno
2026-01-25 04:41:06 +01:00
parent 0fdd6bdc81
commit 109e15b5a0
8 changed files with 43 additions and 26 deletions

View File

@@ -5293,14 +5293,6 @@ FOUND:;
vec_add(generic->generic_decl.instances, instance);
AnalysisStage stage = module->stage;
ASSERT(stage > ANALYSIS_IMPORTS);
// Add all the normal top level declarations
FOREACH(Decl *, decl, copied) unit_register_global_decl(decl->unit, decl);
// Add all the conditional declarations
FOREACH(Decl *, decl, copied_cond)
{
unit_register_optional_global_decl(decl->unit, decl);
if (decl->decl_kind != DECL_ERASED) vec_add(copied, decl);
}
if (compiler.context.errors_found) return poisoned_decl;
// Check contracts
@@ -5316,11 +5308,22 @@ FOUND:;
SourceSpan param_span = extend_span_with_token(params[0]->span, VECLAST(params)->span);
if (!sema_analyse_generic_module_contracts(context, module, instance, contracts, param_span, invocation_span))
{
return poisoned_decl;
decl_poison(instance);
decl_poison(alias);
return alias;
}
}
}
// Add all the normal top level declarations
FOREACH(Decl *, decl, copied) unit_register_global_decl(decl->unit, decl);
// Add all the conditional declarations
FOREACH(Decl *, decl, copied_cond)
{
unit_register_optional_global_decl(decl->unit, decl);
if (decl->decl_kind != DECL_ERASED) vec_add(copied, decl);
}
if (stage < ANALYSIS_METHODS_REGISTER) goto EXIT;
FOREACH(Decl *, decl, copied)
{