Skip to content

"Dictionary literal has duplicate entries" should be an error not warning #78595

Open
@stefanspringer1

Description

@stefanspringer1

Motivation

When a dictionary literal has duplicate entries (example: let map = [1: "one", 1: "also one"]), the compile issues a warning "Dictionary literal of type '...' has duplicate entries for integer literal key '...'". But in this case the code at this point would crash, so a warning might not be enough. E.g. a CI pipeline might ignore warnings.

Proposed solution

"Dictionary literal of type '...' has duplicate entries for integer literal key '...'" should be an error and not a warning.

Alternatives considered

The only alternative is to leave it as a warning.

Additional information

Note that for duplicate entries of a dictionary, there also is the issue #77318 Missing warning "has duplicate entries for integer literal key" when literal keys are produced by a macro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature request or implementationtriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions