Skip to content

Constrain/narrow literal type with 'in' checks #9718

Description

@KotlinIsland
fromtypingimportLiterala: Literal[1, 2, 3] =2assertain (1, 2)
b: Literal[1, 2] =a
error: Incompatible types in assignment (expression has type "Union[Literal[1], Literal[2], Literal[3]]", variable has type "Union[Literal[1], Literal[2]]")
b: Literal[1, 2] = a
^

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions