[ty] Improve specialization-error diagnostics (#20326)

## Summary

Add information about the upper bound or the constraints of the type
variable to the `SpecializationError` diagnostics.
This commit is contained in:
David Peter
2025-09-10 14:01:23 +02:00
committed by GitHub
parent b85c995927
commit 2b51ec6531
7 changed files with 21 additions and 15 deletions

View File

@@ -112,7 +112,7 @@ def _(n: int):
# error: [too-many-positional-arguments]
# error: [invalid-argument-type] "Argument to function `f2` is incorrect: Expected `str`, found `Literal[3]`"
# error: [missing-argument]
# error: [invalid-argument-type] "Argument to function `f4` is incorrect: Argument type `Literal[3]` does not satisfy upper bound of type variable `T`"
# error: [invalid-argument-type] "Argument to function `f4` is incorrect: Argument type `Literal[3]` does not satisfy upper bound `str` of type variable `T`"
# error: [invalid-argument-type] "Argument to function `f5` is incorrect: Expected `str`, found `Literal[3]`"
# error: [no-matching-overload] "No overload of function `f6` matches arguments"
# error: [call-non-callable] "Object of type `Literal[5]` is not callable"