exaloop / exaloop/codon

Class fields type inference fails in inheritance scenarios in Codon 0.19

Open
#687 1 comment 0 reactions 1 assignee Claimed by @inumanag View on GitHub
bug
Dominant language
Python
Stars
16.8k
Forks
603
Avg merge
4d 23h
Merged PRs (30d)
6

Description

In inheritance scenarios, the automatic inference function for class fields in Codon 0.19 fails.
```
class A:
def __init__(self, a: int):
self._a: int = a

class B(A):
def __init__(self, a: int, b: int):
super().__init__(a)
self._b: int = b

def add(self) -> int:
return self._a + self._b

print(B(1, 2).add())
```
An error occurs when the above code is executed. “error: 'A[NoneType]' does not match expected type 'A[int]'”

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.