Skip to content

Certain order of union members causes Incompatible types error #3085

Closed
@Stiivi

Description

@Stiivi

I’m getting this weird error: Incompatible types in assignment (expression has type Dict[str, Union[str, float]], variable has type Dict[str, Union[str, int, float, bool]])

Value = Union[str, int, float, bool]
d: Dict[str, Value]
d = {}

however this works:

Value = Union[str, float, bool, int]

The order of union elements is different.

Other offenses:

Value = Union[int, str, bool, float]
Value = Union[str, int, bool, float]

Causes: Incompatible types in assignment (expression has type Dict[str, Union[str, float]], variable has type Dict[str, Union[int, str, bool, float]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions