You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interface resolution fails when an interface is defined in one module with a parent interface and implemented in another module where the implementation has a List of that interface as a field
#1348
Open
cheese3660 opened this issue
Aug 11, 2024
· 1 comment
When compiled with c3c compile main.c3 other.c3 works perfectly fine
But when compiled with c3c compile other.c3 main.c3 does not work and instead spits out the following error
5:
6: }
7:
8: interface IntC : IntA {
^^^^
(/home/cheese3660/c3c-stuff/minimal_repro/src/main.c3:8:18) Error: Did you mean the interface 'IntA' in module minimal_repro? If so please add 'import minimal_repro'.
6:
7: def ElementPredicate = fn bool(Type *type);
8: def ElementTest = fn bool(Type *type, any context);
9: const ELEMENT_IS_EQUATABLE = types::is_equatable_type(Type);
^^^^^^^^^^^^^^^^^^^^^^^
(/home/cheese3660/c3c-stuff/c3c-master/lib/std/collections/list.c3:9:37) Note: Inlined from here.
As such it seems dependent on the compilation order.
And if you remove List(<IntC>) from the fields of HasList, it also compiles as expected.
The text was updated successfully, but these errors were encountered:
I've fixed THIS error, but I feel like a more uniform approach is needed here to be honest. There is a need to consider whether interfaces should be lifted out a little bit different. Also in general it would just be nice to see if it's possible to delay initialization on some other things. Plus, it need to be SPECIFIED, not just ad hoc, what kind of circular references are needed. The hard part is:
main.c3
other.c3
When compiled with
c3c compile main.c3 other.c3
works perfectly fineBut when compiled with
c3c compile other.c3 main.c3
does not work and instead spits out the following errorAs such it seems dependent on the compilation order.
And if you remove
List(<IntC>)
from the fields of HasList, it also compiles as expected.The text was updated successfully, but these errors were encountered: