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
{{ message }}
Repository navigation
Mypy reports error for different argument, than the one which is actually wrong #19289
When using generic Callables as parameters, the error is correctly reported, but it's reported for different argument than the one which is in fact wrong.
To clarify, it's complaining about the first type argument, not the type of the first argument. bigfunc takes two type arguments, one for each of T1 and T2. The error is stating that it failed to infer a value for the first one, T1.
However, that's still wrong. It actually infers T1 fine and wittles the signature of bigfunc down to
Activity
brianschubert commentedon Jun 13, 2025
To clarify, it's complaining about the first type argument, not the type of the first argument.
bigfunctakes two type arguments, one for each ofT1andT2. The error is stating that it failed to infer a value for the first one,T1.However, that's still wrong. It actually infers
T1fine and wittles the signature ofbigfuncdown tomypy then fails to infer a value for
T2, which it sees as being the first type parameter of the refined signature.sterliakov commentedon Jun 13, 2025
Can we just use tvar name instead of index? Names don't change when some generics are substituted, and are no less helpful for identification.
jan-spurny commentedon Jun 13, 2025
@sterliakov that would be great!
Show name of type variable in "Cannot infer type argument" message (p…