Further fix shadowing of generics

This commit is contained in:
Christoffer Lerno
2026-02-05 18:43:54 +01:00
parent 472c49de25
commit 2c55d6e220
2 changed files with 27 additions and 5 deletions

View File

@@ -276,8 +276,30 @@ static void register_generic_decls(CompilationUnit *unit, Decl **decls)
if (decl->func_decl.type_parent) continue;
break;
}
htable_set(&unit->module->symbols, (void *)decl->name, decl);
htable_set(&unit->local_symbols, (void *)decl->name, decl);
Decl *old;
if (decl->visibility < VISIBLE_LOCAL)
{
if ((old = htable_set(&unit->module->symbols, (void *)decl->name, decl)))
{
if (old->generic_id != decl->generic_id)
{
sema_shadow_error(NULL, decl, old);
decl_poison(decl);
decl_poison(old);
continue;
}
}
}
if ((old = htable_set(&unit->local_symbols, (void *)decl->name, decl)))
{
if (old->generic_id != decl->generic_id)
{
sema_shadow_error(NULL, decl, old);
decl_poison(decl);
decl_poison(old);
continue;
}
}
if (decl->visibility == VISIBLE_PUBLIC)
{