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
Using ParamSpec in decorator with new type inference results in Never populated as type arguments #16512
Using a decorator including a ParamSpec variable on a function declaring multiple parameters from a generic protocol swaps any protocol argument to Never (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 with 1.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.
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:
main.py:41: error: Argument 1 to "Combine" has incompatible type "Callable[[], float]"; expected "Metric[Never]" [arg-type]
main.py:41: error: Argument 2 to "Combine" has incompatible type "Callable[[], float]"; expected "Metric[Never]" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
What's interesting is that if I only keep 1Metric[T] argument e.g.
Activity
kjagiello commentedon Nov 17, 2023
Tried reducing the repro case:
Playground link
Fix polymorphic application for callback protocols (#16514)
Fix polymorphic application for callback protocols (#16514)