Skip to content

Union of same Tuple with slice or index lose type and size #1579

Closed
@tharvik

Description

@tharvik
from typing import List, Tuple, Union

def f() -> Union[Tuple[str], Tuple[str]]: return 'a',

v = f()
''.join(v[:])

gives

asd.py:6: error: Argument 1 to "join" of "str" has incompatible type Tuple[_T_co, ...]; expected Iterable[str]
asd.py:7: error: List item 0 has incompatible type "_T_co"

Seems somehow that the tuple "lose" his type (and his size).

How course, it is a simplified example.

Might be related to #1578.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions