DetachHead / basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
http://docs.basedpyright.com/
Other
600 stars 12 forks source link

narrowing variable with `is None` when the type is a `Protocol` that matches `None` incorrectly gets narrowed to `Never` #459

Open DetachHead opened 4 days ago

DetachHead commented 4 days ago
from typing import Protocol

class Foo(Protocol): ...

def foo(x: Foo):
    if x is None:
        reveal_type(x) # revealed type is Never

foo(None) # no error