Open
Description
This is an issue I ran into working on #9097.
Code adapted from this test.
Literals with one value:
from typing import List
from typing_extensions import Literal
lit1: Literal[1]
lit2: Literal[2]
arr2 = [lit1, lit2]
reveal_type(arr2)
➜ mypy git:(master) python3 -m mypy leba_misc/test2.py
leba_misc/test2.py:9: note: Revealed type is 'builtins.list[builtins.int*]'
Literals with multiple values:
from typing import List
from typing_extensions import Literal
lit1: Literal[1]
lit2: Literal[2, 3]
arr2 = [lit1, lit2]
reveal_type(arr2)
➜ mypy git:(master) python3 -m mypy leba_misc/test2.py
leba_misc/test2.py:9: note: Revealed type is 'builtins.list[Union[Literal[1], Literal[2], Literal[3]]]'
On Python 3.7
and mypy 0.790
.