Skip to content

(🎁) Support inferring type from call to extend when passed a non-list #16045

Open
@KotlinIsland

Description

@KotlinIsland
a = []
a.extend([1, 2])
reveal_type(a)  # list[int]

b = []  # error: need type annotation
b.extend((1, 2))
reveal_type(b)  # list[Any]

Mypy should be able to infer the type of b in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions