You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have a function that accepts a dictionary that can accept a variety of key types, and then pass in a dictionary whose key type is only a subset, the code fails to type check.
Example code:
def foo(input_dict: Dict[Optional[str], Any]) -> Dict[str, str]:
return {'bar': 'baz'}
a = {'b': 'c'} # type: Dict[str, Any]
foo(a) # fails to type check
This also seems to apply with the following function definition:
def bar(input_dict: Dict[Union[str, bytes], Any]) -> Dict[str, str]:
return {'bar': 'baz'}
a = {'b': 'c'} # type: Dict[str, Any]
bar(a) # fails to type check
If I have a function that accepts a dictionary that can accept a variety of key types, and then pass in a dictionary whose key type is only a subset, the code fails to type check.
Example code:
This also seems to apply with the following function definition:
I'm using these mypy flags and mypy 0.670:
The text was updated successfully, but these errors were encountered: