Skip to content

Exception message for incorrect dict literal is too wide #893

@ndmitchell

Description

@ndmitchell

Describe the Bug

Given:

mp: dict[int, int] = {
    1: 2,
    3: "test"
}

This tells me:

`dict[int, int | str]` is not assignable to `dict[int, int]`

But the error message is reported as the whole dict literal in { brackets }. Would be nice if it told me just about the one that is wrong.

Sandbox Link

https://pyrefly.org/sandbox/?code=LYBwXABAJglgxgFwNowHYIDQTQguhAXggG8AoCCiARkgCYNzKBmSAIgQFMBnBV0gXyA&version=3.12

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions