diff --git a/crates/ty_python_semantic/resources/mdtest/narrow/hasattr.md b/crates/ty_python_semantic/resources/mdtest/narrow/hasattr.md index 2a231802da..b158912160 100644 --- a/crates/ty_python_semantic/resources/mdtest/narrow/hasattr.md +++ b/crates/ty_python_semantic/resources/mdtest/narrow/hasattr.md @@ -15,12 +15,24 @@ def f(x: Foo): if hasattr(x, "spam"): reveal_type(x) # revealed: Foo & reveal_type(x.spam) # revealed: object + else: + reveal_type(x) # revealed: Foo & ~ + + # TODO: should error and reveal `Unknown` + reveal_type(x.spam) # revealed: @Todo(map_with_boundness: intersections with negative contributions) if hasattr(x, "not-an-identifier"): reveal_type(x) # revealed: Foo + else: + reveal_type(x) # revealed: Foo def y(x: Bar): if hasattr(x, "spam"): reveal_type(x) # revealed: Never reveal_type(x.spam) # revealed: Never + else: + reveal_type(x) # revealed: Bar + + # error: [unresolved-attribute] + reveal_type(x.spam) # revealed: Unknown ```