ty_python_semantic: update "no matching overload" diagnostic test

It looks like support for `@overload` has been added since this test was
created, so we remove the TODO and add a snippet (from #274).
This commit is contained in:
Andrew Gallant
2025-05-13 11:23:19 -04:00
committed by Andrew Gallant
parent 2e94d37275
commit 0230cbac2c
2 changed files with 30 additions and 13 deletions

View File

@@ -4,11 +4,15 @@
## Calls to overloaded functions
TODO: Note that we do not yet support the `@overload` decorator to define overloaded functions in
real Python code. We are instead testing a special-cased function where we create an overloaded
signature internally. Update this to an `@overload` function in the Python snippet itself once we
can.
```py
type("Foo", ()) # error: [no-matching-overload]
from typing import overload
@overload
def f(x: int) -> int: ...
@overload
def f(x: str) -> str: ...
def f(x: int | str) -> int | str:
return x
f(b"foo") # error: [no-matching-overload]
```