Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Argument 1 totype_check_only has incompatible typetype[S[T, *Ts]]; expectedtype[S[T, *Ts]] #19093

Closed
Labels
bugmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)
@jorenham

Description

@jorenham

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 throughmypy (checked with1.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 additionalT type parameter, the false positive error disappears. It also disappears if I remove thetuple baseclass.
And as far as I could tell, it doesn't seem to be associated with a particular config option or cli flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp