[Sema] Allow TreatArrayLiteralAsDictionary fix to handle literals with more than one element #59277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This enables recording
TreatArrayLiteralAsDictionary
for every literal sized array where before only size 1 where recorded which in the cases of the issue reported lead to an unhandled ambiguity.Also, by allowing the fix to be recorded, if there is a fix for the dictionary being used as array literal this skips recording fixes for mismatching element types as it adds more verbosity and confusion to the diagnostics and the correlation between array literal elements and dictionary key/value can be unclear and skipping this allows the diagnostic to focus on suggesting the use of the correct dictionary literal. I did thought back and fourth for some time with this part, so let me know what you think.
An NFC item is the move of the attempt to repair logic to the fix method
attempt
.Resolves #59215.