Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
supersergiy opened this issue Nov 23, 2022 · 0 comments · Fixed by #15892
Closed

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

supersergiy opened this issue Nov 23, 2022 · 0 comments · Fixed by #15892
Labels
bug mypy got something wrong topic-paramspec PEP 612, ParamSpec, Concatenate

Comments

@supersergiy
Copy link

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
@supersergiy supersergiy added the bug mypy got something wrong label Nov 23, 2022
@hauntsaninja hauntsaninja added the topic-paramspec PEP 612, ParamSpec, Concatenate label Feb 12, 2023
ilevkivskyi added a commit that referenced this issue Aug 17, 2023
Fixes #14169
Fixes #14168

Two sings here:
* Actually check prefix when we should
* `strict_concatenate` check should be off by default (IIUC it is not
mandated by the PEP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-paramspec PEP 612, ParamSpec, Concatenate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants