Consider this .pyi code snippet:
fromtypingimportAny, Generic, Self, TypeVar, TypeVarTuple, type_check_onlyT=TypeVar("T")
Ts=TypeVarTuple("Ts") @type_check_onlyclassS(tuple[*Ts], Generic[T, *Ts]):
deff(self, x: T, /) ->T: ...When ran through mypy (checked with 1.15.0 and the master branch), the following error is reported
Argument 1 to "type_check_only" has incompatible type "type[S[T, *Ts]]"; expected "type[S[T, *Ts]]" [arg-type]
mypy playground repro
Without the additional T type parameter, the false positive error disappears. It also disappears if I remove the tuple baseclass.
And as far as I could tell, it doesn't seem to be associated with a particular config option or cli flag.
Consider this
.pyicode snippet:When ran through
mypy(checked with1.15.0and the master branch), the following error is reportedmypy playground repro
Without the additional
Ttype parameter, the false positive error disappears. It also disappears if I remove thetuplebaseclass.And as far as I could tell, it doesn't seem to be associated with a particular config option or cli flag.