test.py:
fromtypingimportLiteraldeffoo(a: Literal[True]) ->None:
...
FOO: boolfoo(FOO) # error: Argument 1 to "foo" has incompatible type "bool"; expected "Literal[True]" [arg-type]reveal_type(FOO) # note: Revealed type is "builtins.bool"ifnotFOO:
passreveal_type(FOO) # note: Revealed type is "Literal[True]"ifnotFOO:
passimporttest2
test2.py:
fromtestimportFOOreveal_type(FOO) # note: Revealed type is "builtins.bool"ifFOO:
passreveal_type(FOO) # note: Revealed type is "Literal[True]"
> mypy --always-true FOO test.py
test.py:
test2.py:
> mypy --always-true FOO test.py