mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Test testPassingMappingSubclassForKeywordVarArg is wrong

Open davidhalter opened this issue 3 years ago • 0 comments

The test looks like this:

from typing import Mapping
class MappingSubclass(Mapping[str, str]): pass
def f(**kwargs: 'A') -> None: pass
d = None # type: MappingSubclass
f(**d)
class A: pass

but line 5 should be something like:

f(**d)  # E: Argument 1 to "f" has incompatible type "**MappingSubclass"; expected "A"

This is because the value type str does not match A. I feel like this is a bug somewhere in Mypy.

I have tried to find an issue about kwargs and super types, but could not find anything.

davidhalter avatar Sep 17 '22 23:09 davidhalter