Skip to content

[red-knot] fully consolidate display of heterogenous unions of literals #14988

@carljm

Description

@carljm

We currently display Literal[1, 2] | Literal["foo"], but the spec (and other type checkers) prefer Literal[1, 2, "foo"]. We allow the latter in an annotation, but we don't display it that way.

We should probably switch to displaying this like the spec and other type checkers do.

I would leave class and function literals out of this change, since they aren't part of the spec and we may want to display them entirely differently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributions especially welcometyMulti-file analysis & type inference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions