Skip to content

Incompatible dictionary results in confusing error message #1183

Closed
@JukkaL

Description

@JukkaL

Dictionary literals with incompatible keys/values result in weird error message, because mypy translate the expression internally to something quite different before type checking.

from typing import Dict
d = {1 : ''} # type: Dict[int, int]

This gives a confusing error message:

t2.py:2: error: List item 0 has incompatible type "Tuple[int, str]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions