Closed LuKuangChen closed 2 years ago
This is currently due to a combination of behaviors. First, we treat a float
annotation as float | int
because the Python type checkers treat int
as being compatible with float
. We then treat arguments which are declared as unions as dynamic because we don't support runtime type checking of them, so we can't keep them typed otherwise the compiler could narrow through isinstance checks incorrectly. If we solved the second issue we'd then report this as int | float
.
Closing this as a special case of #49
What version of Static Python are you using?
9965302 2021-07-15
What program did you run?
What happened?
The variable
x
has typedynamic
.What should have happened?
We expected that the variable
x
has typefloat
because of the annotationx: float
. The functionfloat
has a type andfloat(1)
has the typeExact[float]