Closed
Description
Using mypy 0.761, Python 3.7.5 here. The ANIMALS2
value is highlighted as incorrect by Mypy:
COW: Literal['cow'] = 'cow'
PIG: Literal['pig'] = 'pig'
ANIMALS1: Literal['cow', 'pig'] # This is OK
ANIMALS2: Literal[COW, PIG]
# ^^^^^^^ Mypy: Parameter 1 of Literal[...] is invalid
But it seems Mypy should be able to deduce that ANIMALS1 and ANIMALS2 are the same thing?
I'm not sure if the more lax version should be allowed as well, but seems useful:
OX = 'ox'
ANIMALS = Literal[OX]
Metadata
Metadata
Assignees
Labels
No labels