swift
edbbefce - [CodeCompletion][Sema] Add fix to treat empty or single-element array literals as dictionaries when used as such

Commit
4 years ago
[CodeCompletion][Sema] Add fix to treat empty or single-element array literals as dictionaries when used as such In the single-element case, it is treated as the dictionary key. func takesDict(_ x: [Int: String]) {} takesDict([]) // diagnose with fixit to add missing ':' takesDict([1]) // diagnose with fixit to add missing ': <#value#>' takesDict([foo.<complete>]) // prioritise Int members in completion results - // the user just hasn't written the value yet. The above previously failed with a generic mismatch error in normal type checking (due to the literal being parsed as an array literal) and code completion could not pick up the expected type from the context.
Author
Nathan Hawes
Committer
Nathan Hawes
Parents
Loading