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
compiler.static.TypedSyntaxError: reveal_type(x): 'dynamic', 'x' has declared type 'dynamic' and local type 'dynamic'
What should have happened?
We expected that the variable x has type float because of the annotation x: float. The function float has a
type and float(1) has the type Exact[float]
The text was updated successfully, but these errors were encountered:
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.
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 atype and
float(1)
has the typeExact[float]
The text was updated successfully, but these errors were encountered: