Skip to content

spread dict not used to infer type #11691

Closed
@DetachHead

Description

@DetachHead
foo: dict[type, str] = {int: ""}

{**foo, str: ""}
# mypy seems to interpret it as this, where the error makes sense:
{str: ""}.update(foo)
main.py:3: error: Argument 1 to "update" of "dict" has incompatible type "Dict[type, str]"; expected "Mapping[Type[str], str]"
main.py:4: error: Argument 1 to "update" of "dict" has incompatible type "Dict[type, str]"; expected "Mapping[Type[str], str]"

https://mypy-play.net/?mypy=master&python=3.10&gist=c5a3a39b154395b6d26de54050834ac4&flags=strict

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions