Interface resolution when part of generics #1348.

This commit is contained in:
Christoffer Lerno
2024-08-12 10:25:53 +02:00
parent baf6e71a80
commit 9aab962ebc
2 changed files with 9 additions and 2 deletions

View File

@@ -66,6 +66,7 @@
- Recursively follow interfaces when looking up method.
- Int128 alignment change in LLVM fixed on x64.
- Fix interface lazy resolution errors.
- Interface resolution when part of generics #1348.
### Stdlib changes

View File

@@ -68,9 +68,10 @@ void sema_decl_stack_push(Decl *decl)
static bool add_interface_to_decl_stack(SemaContext *context, Decl *decl)
{
if (!sema_analyse_decl(context, decl)) return false;
FOREACH(TypeInfo *, parent_interface, decl->interfaces)
{
if (!sema_resolve_type_info(context, parent_interface, RESOLVE_TYPE_DEFAULT)) return false;
assert(parent_interface->resolve_status == RESOLVE_DONE);
Decl *inf = parent_interface->type->decl;
if (!sema_analyse_decl(context, inf)) return false;
add_interface_to_decl_stack(context, inf);
@@ -97,7 +98,12 @@ static bool add_members_to_decl_stack(SemaContext *context, Decl *decl)
}
if (decl->decl_kind == DECL_INTERFACE)
{
if (!add_interface_to_decl_stack(context, decl)) return false;
FOREACH(TypeInfo *, parent_interface, decl->interfaces)
{
if (!sema_resolve_type_info(context, parent_interface, RESOLVE_TYPE_DEFAULT)) return false;
Decl *inf = parent_interface->type->decl;
if (!add_interface_to_decl_stack(context, inf)) return false;
}
}
if (decl_is_struct_type(decl) || decl->decl_kind == DECL_BITSTRUCT)
{