Position-only parameter mismatch has counts for expected/received swapped in too many parameters case
Author: MeGaGiGaGonCreated Sep 16, 2026Updated Sep 16, 2026
Labelsbug
Describe the bug In the code/diagnostic below, the message is correct except for this part:
Position-only parameter mismatch; expected 2 but received 1
That error is backwards, as the assignability being questioned here is "(int, int) -> int" into "(int) -> int", so it should actually read
Position-only parameter mismatch; expected 1 but received 2
The rest of the diagnostic, including the "Function accepts too many positional parameters" part, is correct.
Code or Screenshots Code in Pyright Playground
from typing import Callable
def accepts_one(x: Callable[[int], int]) -> None: ...
def wrong(two: Callable[[int, int], int]) -> None:
accepts_one(two)Resulting diagnostic:
Argument of type "(int, int) -> int" cannot be assigned to parameter "x" of type "(int) -> int" in function "accepts_one"
Type "(int, int) -> int" is not assignable to type "(int) -> int"
Position-only parameter mismatch; expected 2 but received 1
Function accepts too many positional parameters; expected 1 but received 2 (reportArgumentType)VS Code extension or command-line Tested on Pyright Playground using Pyright version 1.1.414
Source: microsoft/pyright