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
We noticed that instance fields have a similar issue. The following program passes type check. If the last line is uncommented, a compile-time error will be reported. This shows that the x: str in the subclass D is ignored. It might be more sensible to error at the re-declaration, instead of to ignore it silently.
classC:
x: intclassD(C):
x: str# D().x = "foo" # compile-time type error. int is expected.
What version of Static Python are you using?
9965302
2021-07-15
What program did you run?
What happened?
The program terminates without errors.
What should have happened?
We expected a compile-time error because
D
override the class variablex
with an incompatible type.The text was updated successfully, but these errors were encountered: