Skip to content

Type of tuple[()] should evaluate to Sequence[Never] rather than Sequence[Unknown] #7118

@erictraut

Description

@erictraut

The typing spec has clarified that tuple[()] should evaluate to Sequence[Never].

T = TypeVar("T")

def test_seq(x: Sequence[T]) -> Sequence[T]:
    return x

def func8(t3: tuple[()]):
    assert_type(test_seq(t3), Sequence[Never])

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions