basedpyright
basedpyright copied to clipboard
support narrowing on `a is b` where `b` is a generic
Description
Code sample in basedpyright playground
def foo[T](a: object, b: T) -> T:
assert a is b
return a # error: Type "object" is not assignable to type "T@foo"
doesn't look like this is in the list of supported type guards but i think it should be supported. i also couldn't find an upstream issue but i'm certain this has been raised and rejected already
related: #391