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
I expected the following script to pass type checking:
import typing as t
Foo = t.Literal["foo-1", "foo-2"]
FOO_1: Foo = "foo-1"
FOO_2: Foo = "foo-2"
def use_set_of_foos(v: set[Foo]):
print(v)
# Typecheck fails here, because {FOO_1} is inferred to be set[str] rather than set[Foo]
use_set_of_foos({FOO_1})
Reproduction steps
See script above.
Expected behavior
I expected this to pass type checking
Logs
Please include any relevant logs here:
ƛ Found 1 type error!
repro.py:13:16 Incompatible parameter type [6]: In call `use_set_of_foos`, for 1st positional argument, expected `Set[Union[typing_extensions.Literal['foo-1'], typing_extensions.Literal['foo-2']]]` but got `Set[str]`.
Hi! Thanks for the report. We are currently tracking improvements to expression-level type inference which would solve your problem. I'll add this to the set of examples.
Pyre Bug
Bug description
I expected the following script to pass type checking:
Reproduction steps
See script above.
Expected behavior
I expected this to pass type checking
Logs
Please include any relevant logs here:
rage.log
The text was updated successfully, but these errors were encountered: