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:
committed by
Andrew Gallant
parent
2e94d37275
commit
0230cbac2c
@@ -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]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user