Skip to content

[red-knot] Disambiguate display for intersection types #16912

@MichaReiser

Description

@MichaReiser
          What about intersection types?
def _(
    c: Intersection[Callable[[Union[int, str]], int], A],
    d: Intersection[A, Callable[[Union[int, str]], int]],
    e: Intersection[A, Callable[[Union[int, str]], int], B],
    f: Intersection[Not[Callable[[int, str], Intersection[int, str]]]]
):
    reveal_type(c)  # revealed: ((int | str, /) -> int) & A
    reveal_type(d)  # revealed: A & ((int | str, /) -> int)
    reveal_type(e)  # revealed: A & ((int | str, /) -> int) & B
    reveal_type(f)  # revealed: ~((int, str, /) -> int & str)

Originally posted by @InSyncWithFoo in #16907 (comment)

Same as #16893 but for intersections

Metadata

Metadata

Assignees

Labels

tyMulti-file analysis & type inference

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions