Closed LuKuangChen closed 2 years ago
4f1b313 2021-07-27
x: int = True
The program errors.
compiler.static.errors.TypedSyntaxError: type mismatch: Exact[bool] cannot be assigned to int
We expected no error because bool is a subclass of int (isinstance(True, int) is True).
bool
int
isinstance(True, int)
True
We should be allowing this
In general, if C is a subclass of D, is C also a subtype of D?
This should be fixed after 88dd90d1fd43b3c751c3557ba5fc3a140717c3b1. Thanks!
What version of Static Python are you using?
4f1b313 2021-07-27
What program did you run?
What happened?
The program errors.
What should have happened?
We expected no error because
bool
is a subclass ofint
(isinstance(True, int)
isTrue
).