Skip to content

Infer optional type for list with None values #1863

Closed
@JukkaL

Description

@JukkaL

This is unexpected:

x = [1, None]
reveal_type(x)   # Revealed type is 'builtins.list[builtins.object*]'

I'd expect the list item type to to be Optional[int]. A join of a non-optional type with None should probably produce an optional type.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions