Skip to content

Literal["abba"] should be a subtype of Sequence[Literal["a", "b"]] #2128

@carljm

Description

@carljm

A string literal containing only characters from a given set should be a subtype of Sequence of the union of those literal characters.

from collections.abc import Sequence
from typing import Literal

def func(tags: Sequence[Literal["a", "b"]]) -> None:
    pass

func("abba")

https://play.ty.dev/381e87b8-2438-4287-a1cd-2e26c04a6dd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerstype propertiessubtyping, assignability, equivalence, and more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions