basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

narrow types under same constant condition

Open KotlinIsland opened this issue 1 year ago • 1 comments

a: Final[str]

if a == "a":
    def f(): ...
if a == "a":
    f()

this shouldn't be an error

also possibly-undefined:

def func(x: bool):
    if x:
        msg = 'hello world'
    if x:
        print(msg)

KotlinIsland avatar Feb 19 '24 16:02 KotlinIsland