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

spurius "Incompatible types in assignment" with TypedDict and Type #10024

Closed
ZeeD opened this issue Feb 4, 2021 · 1 comment
Closed

spurius "Incompatible types in assignment" with TypedDict and Type #10024

ZeeD opened this issue Feb 4, 2021 · 1 comment
Labels
bug mypy got something wrong topic-type-form TypeForm might fix this topic-typed-dict topic-usability

Comments

@ZeeD
Copy link

ZeeD commented Feb 4, 2021

With this little snippet of code:

from typing import *

class D(TypedDict): ...

class P(Protocol): ...

T = TypeVar('T', bound=P)

def foo(cls: Type[T]) -> T: ...

d:D = foo(D)

I have this error:

>mypy td.py
td.py:11: error: Incompatible types in assignment (expression has type "D", variable has type "D")
Found 1 error in 1 file (checked 1 source file)

It seems a wrong error - or at least the message is not meaningful

@ZeeD ZeeD added the bug mypy got something wrong label Feb 4, 2021
@AlexWaygood AlexWaygood added topic-type-form TypeForm might fix this topic-usability labels Apr 22, 2022
@AlexWaygood
Copy link
Member

I'm closing this in favour of #12385, which is a newer issue but has more discussion attached to it.

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-type-form TypeForm might fix this topic-typed-dict topic-usability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants