Skip to content

Commit

Permalink
Interface resolution when part of generics #1348.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Aug 12, 2024
1 parent baf6e71 commit 9aab962
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions src/compiler/sema_name_resolution.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
{
Expand Down

0 comments on commit 9aab962

Please sign in to comment.