exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
15k stars 517 forks source link

Inheritance between 3 classes gives an infer.cpp error #532

Open variux opened 8 months ago

variux commented 8 months ago

Good day, I know that right now the inheritance needs to be consider as experimental but when trying to inherit A, B and C I'm getting the following error

class A:
    _map: Dict[str, str]
    def __init__(self):
        self._map = Dict[str, str]()

class B(A):
     def __init__(self):
        super().__init__()

class C(B):
    placeholder: str
    def __init__(self):
        super().__init__()

test = C() 

Assert failed: cannot find distance between C.4 and B.6 [:0:0] Expression: found || ctx->cache->classes[baseTyp->name].fields.empty() Source: /github/workspace/codon/parser/visitors/typecheck/infer.cpp:476 Aborted

Adding an attribute to B, solves the problem, but not sure if this is the expected behavior

class B(A):
     test: cr
     def __init__(self):
        super().__init__()
inumanag commented 8 months ago

Thank you for the report—inheritance still has some bugs that need ironing out. Will check soon.