Never
inferred in complex situation with variadic callable protocol
#16522
Labels
Never
inferred in complex situation with variadic callable protocol
#16522
Bug Report
Mypy is inferring a
Never
in a bit of a complicated setup involvingTypeVarTuple
,__call__
protocols and a regularTypeVar
. If an annotated assignment is present it is able to check that they match. But when a bare call is done, it infersNever
and always produces an error. This is a simplified version of Trio'sNursery.start()
async spawn method, which I'm trying to type. (Seesrc/trio/_core/_run.py
.) I simplified it a little, removing an overload and making it synchronous.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=31be4208e294eb6c5cbc7390f4a836f4
Expected Behavior
Ideally Mypy would be able to propagate the typevar in
TaskStatus
to determine the return type, and verify that appropriate types were passed for*args
.Actual Behavior
The first error is correct, showing that Mypy can understand the types somewhat. But in the second case it's strangely producing
Never
, when it should really be effectivelyAny
- the type is unused so it doesn't matter what it is.Your Environment
1.7.0
, also triedmaster
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: