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
{{ message }}
Repository navigation
(馃悶) always-true/always-false doesn't activate until it's truth is checked聽#12325
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]"
changed the title [-](馃悶) `always-true` doesn't activate until [/-][+](馃悶) `always-true`/`always-false` doesn't activate until it's truth is checked[/+]on Mar 10, 2022
Activity
[-](馃悶) `always-true` doesn't activate until [/-][+](馃悶) `always-true`/`always-false` doesn't activate until it's truth is checked[/+]Zeckie commentedon Mar 13, 2022
Can you explain what you think is wrong, and why?
eg. is it that due to
--always-true FOOon command line, the variableFOOshould always be treated asLiteral[True]?Is this going to have flow on effects, such as having the code inside
if not FOO:being unreachable?KotlinIsland commentedon Mar 13, 2022
@Zeckie You can read about the expected functionality here
There are some negative consequences to this functionality, such as #11364