mypy
6df281e5 - Make `narrow_declared_type` correctly handle Literal types (#6961)

Commit
7 years ago
Make `narrow_declared_type` correctly handle Literal types (#6961) This diff fixes the `narrowed_declared_type` function to correctly handle cases where the declared type is actually a `Literal[...]`. Specifically, doing something like the below will return `int` instead of `Literal[42]`: narrowed_declared_type(Literal[42], int) This is inconsistent with the behavior of doing something like the below, which will return `ChildType`: narrowed_declared_type(ChildType, ParentType) This diff modifies `narrowed_declared_type` to instead return `Literal[42]` in the first example.
Author
Parents
Loading