Using ParamSpec
in decorator with new type inference results in Never
populated as type arguments
#16512
Labels
bug
mypy got something wrong
Bug Report
Using a decorator including a
ParamSpec
variable on a function declaring multiple parameters from a generic protocol swaps any protocol argument toNever
(pheuh, having a bit of trouble phrasing this decently..)To Reproduce
I drilled down an issue in our code base, when running with
1.7.0
, to the following script. This passes fine with1.6.1
. It might probably be reduced further.While I was at it I ran git bisect with the script below and ended up at 93d4cb0 (#16345) (CC @ilevkivskyi).
I see that there's a flag to run with the old type inference to resolve things for now.
Playground link
Expected Behavior
There should be no
Never
populated as generic argument and script should pass.Actual Behavior
Some strategic reveals in the script but the 2 errors it spits back are:
What's interesting is that if I only keep 1
Metric[T]
argument e.g.It seems to get things right.
Your Environment
1.7.0
(alsomaster
)mypy.ini
(and other config files): -The text was updated successfully, but these errors were encountered: