Incorrect handling of Concatenate when used with generics and decorators #9742
Labels
addressed in next version
Issue is fixed and will appear in next published version
bug
Something isn't working
Describe the bug
A clear and concise description of the behavior you are seeing and the expected behavior along with steps to reproduce it.
In the following example, we define a generic decorator that turns a (higher order) function into a MyGeneric (which could be, i.e. a descriptor).
We use that decorator on dumb_thingy, a function that takes a function and injects an
int
argument into it. The type checker should therefore assume that the ParamSpec**Args
has a single mandatoryint
argument. However, pyright incorrectly infers that there are TWO mandatory int arguments.Interestingly, this bug does NOT apply to the Callable generic, only user-defined generics. I.e. replacing
MyGeneric[Args]
withCallable[Args, Any]
exhibits the correct behavior. It also does NOT apply unless Concatenate is used. I.e. replacingConcatenate[int, P]
with[int]
exhibits the correct behavior.Tested on pyright command line version 1.1.392
Also occurs on latest pylance VSCode extension.
mypy has the correct behavior.
The text was updated successfully, but these errors were encountered: