Skip to content

Consolidate type[] types in a union when displaying them #1598

@AlexWaygood

Description

@AlexWaygood

When displaying a union (e.g. in error messages or on hover), it would be nicer if we displayed the union type[A] | type[B] | type[C] as type[A | B | C]. The latter means the same thing, is a valid type annotation, and is much more concise. This would be similar to the way we display Literal["a"] | Literal[42] | Literal[b"foooo"] as Literal["a", 42, b"foo"] in diagnostics and on hover.

Keeping type display concise where possible makes our diagnostics much more readable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.help wantedContributions especially welcome

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions