What version of Static Python are you using?
6862bbd
2021-10-03
What program did you run?
from typing import Union
x: Union[int, str] = 1
reveal_type(x)
What happened?
The type of x is dynamic
compiler.static.errors.TypedSyntaxError:
reveal_type(x): 'dynamic',
'x' has declared type 'dynamic' and
local type 'Literal[1]'
What should have happened?
We expected the type of x to be Union[int, str] because union types are supported:
x: Any = 1
if True:
x = "hello"
else:
x = 42
reveal_type(x)
# compiler.static.errors.TypedSyntaxError:
# reveal_type(x): 'dynamic',
# 'x' has declared type 'dynamic' and
# local type 'Union[str, int]'
What version of Static Python are you using?
6862bbd
2021-10-03
What program did you run?
What happened?
The type of
xisdynamicWhat should have happened?
We expected the type of
xto beUnion[int, str]because union types are supported: