A function that expects a heterogeneous dictionary and gets a dictionary with a subset of the expected types seems to cause problems.
fromtypingimportAny, Mapping, Uniondeff(arg: Mapping[ str , Any]) ->None: passdefg(arg: Mapping[Union[str, int], Any]) ->None: passf({'b': 'c'})
g({'b': 'c'})
d= {'b': 'c'}
f(d)
g(d) # <--- Line 8Mypy's output is
mypy-test.py:8: error: Argument 1 to "g" has incompatible type "Dict[str, str]"; expected "Mapping[Union[str, int], Any]"
I'm using Python 3.7.1 and Mypy 0.641. Possibly related to #5849?
A function that expects a heterogeneous dictionary and gets a dictionary with a subset of the expected types seems to cause problems.
Mypy's output is
I'm using Python 3.7.1 and Mypy 0.641. Possibly related to #5849?