Summary
ty doesn't infer that val cannot be None when a walrus operator is used:
class Foo:
val: int | None
def test() -> None:
foo1 = Foo()
if foo1.val:
reveal_type(foo1.val) # int & ~AlwaysFalsy
if (foo2 := Foo()).val:
reveal_type(foo2.val) # int | None
Playground
Version
962e0b729