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

[SR-14076] Special-case array literal in case of type mismatch with dictionary #56465

Closed
typesanitizer opened this issue Jan 21, 2021 · 3 comments
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement type checker Area → compiler: Semantic analysis

Comments

@typesanitizer
Copy link

Previous ID SR-14076
Radar rdar://problem/73430481
Original Reporter @typesanitizer
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI, TypeChecker
Assignee mininny (JIRA)
Priority Medium

md5: 4f8a9386375d8c6aa93d0d427e573ca2

Issue Description:

func f(_ : [Int: Int]) {}
f([]) // error: cannot convert value of type '[Any]' to expected argument type '[Int : Int]'

Instead of this error, I think we should provide a fix-it adding the :. We already have a similar special case in certain cases where we say "use [:] to get an empty dictionary literal".

@typesanitizer
Copy link
Author

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Minhyuk Kim (JIRA)

This issue is duplicated by & solved in this PR: #34521

@typesanitizer
Copy link
Author

Ah, I forgot to test with main, I tested this with 5.3.2. Thanks.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants