mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Interface resolution when part of generics #1348.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user