Open Thirumalai-Shaktivel opened 3 weeks ago
Assigned: @tanay-man
I think the Constant number might be handled in the data member initialisation. With that case, for this we need to handle the Call
node. Check for the runtime assignments, if allowed by CPython.
This doesn't work for dataclass as well.
from lpython import i32, i64
@dataclass
class test:
i: i64 = i64(4)
t: test = test()
print(t)
Note that x: i32 = i64(4)
must be a compiler error, since the types do not match.
I am not sure if we need to support this use case at all, since this is a class variable. I would say in terms of priorities, this is below regular instance variables and inheritance / virtual functions.
Note that
x: i32 = i64(4)
must be a compiler error, since the types do not match.
That is a typo, it should be x : i64 = i64(4)
.
I am not sure if we need to support this use case at all, since this is a class variable. I would say in terms of priorities, this is below regular instance variables and inheritance / virtual functions.
This is fixed in the latest commit. 4 tests were failing due to this, that is why I was trying to fix this.
@tanay-man we will handle this later. We will complete the initial implementation and move on to other implementations
MRE: