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
{{ message }}
Repository navigation
Base class attribute type does not provide type context in subclass #4547
Activity
ilevkivskyi commentedon Mar 6, 2019
#6511 provides another use case for this.
ashb commentedon Mar 6, 2019
Minimal repro case:
And the error:
The error is reported on the assignment in
C.I would have expected that B.a would have the same type as A.a since B.a doesn't have an explicit type.
(This is the case from #6511 copied here in case it is useful)
ilevkivskyi commentedon May 3, 2019
(Raising priority to high since this keeps coming.)
onlined commentedon May 13, 2019
This example from #6766 (comment), which is related to partial list type, doesn't give an error while it should:
ilevkivskyi commentedon Aug 23, 2022
It looks like the situation is even worse here. Here we have no partial types and we still infer wrong type (the one that violates Liskov):
The problem is that we use supertype as type context when checking compatibility. But then again when storing the variable type we use empty context.