Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
variux opened this issue Jan 21, 2024 · 1 comment
Open

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

variux opened this issue Jan 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@variux
Copy link

variux commented Jan 21, 2024

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 inumanag self-assigned this Jan 29, 2024
@inumanag inumanag added the bug Something isn't working label Jan 29, 2024
@inumanag
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants