Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stefanspringer1 opened this issue Jan 12, 2025 · 0 comments
Labels
feature A feature request or implementation triage needed This issue needs more specific labels

Comments

@stefanspringer1
Copy link

stefanspringer1 commented Jan 12, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant