Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Concatenate false negative (caught by pyright, but not mypy) #14169

Closed
@supersergiy

Description

@supersergiy

Bug Report
False negative in the following example:

To Reproduce
Playground Link

from typing import Protocol
from typing_extensions import ParamSpec, Concatenate

P = ParamSpec("P")

class A(Protocol[P]):
    def foo(self, *args: P.args, **kwargs: P.kwargs):
        ...
    
def bar(b: A[P]) -> A[Concatenate[int, P]]:
    return b # no error

Expected Behavior

Type error on return b, which is what pyright does (pyright playground)

Actual Behavior

No type error.

Your Environment

  • Mypy version used: 0.991

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-paramspecPEP 612, ParamSpec, Concatenate

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions