[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
Typeguard version
master - 041b0e3fc1650ece19d9319167922e769649984c
Python version
Python 3.10.12
What happened?
When one of the arguments of the types in the union is shadowed, it should effectively be handled as Any but is currently effectively handled as an uninhabited type.
How can we reproduce the bug?
def test_function_with_union_where_one_of_the_types_is_shadowed():
@typechecked
def foo(int: int | None) -> int | None:
return int
# All the following should pass because the typechecker cannot 'see'
# int-type as it's shadowed from the int-argument.
# However, the only test that passes at the moment is `foo(None)`.
assert foo(1) == 1
assert foo(None) is None
assert foo("foo") == "foo"
Things to check first
[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
Typeguard version
master - 041b0e3fc1650ece19d9319167922e769649984c
Python version
Python 3.10.12
What happened?
When one of the arguments of the types in the union is shadowed, it should effectively be handled as
Any
but is currently effectively handled as an uninhabited type.How can we reproduce the bug?