Is bool a subtype of int?
LuKuangChen opened this issue · comments
KC Lu commented
What version of Static Python are you using?
4f1b313
2021-07-27
What program did you run?
x: int = True
What happened?
The program errors.
compiler.static.errors.TypedSyntaxError: type mismatch: Exact[bool] cannot be assigned to int
What should have happened?
We expected no error because bool
is a subclass of int
(isinstance(True, int)
is True
).
Dino Viehland commented
We should be allowing this
KC Lu commented
In general, if C is a subclass of D, is C also a subtype of D?
Max Bernstein commented
This should be fixed after 88dd90d. Thanks!