You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Show name of type variable in "Cannot infer type argument" message (#19290)
Fixes#19289
The type argument index currently shown can be wrong if other type
arguments were substituted during an earlier pass.
Given:
```python
def foo[T1, T2](
a: T1,
b: T2,
c: Callable[[T2], T2],
) -> tuple[T1, T2]: ...
def bar(y: float) -> float: ...
reveal_type(foo(1, None, bar)) # Expect T1=int, T2=<failed>
```
Before:
```
main.py:9: error: Cannot infer type argument 1 of "foo" [misc]
main.py:9: note: Revealed type is "tuple[builtins.int, Any]"
```
After:
```
main.py:9: error: Cannot infer type argument to type parameter "T2" of "foo" [misc]
main.py:9: note: Revealed type is "tuple[builtins.int, Any]"
```
0 commit comments