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-12242] Swift is complaining even when types passed in closure are of same type #54669

Closed
swift-ci opened this issue Feb 20, 2020 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12242
Radar rdar://problem/59655524
Original Reporter anmol (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, DiagnosticsQoI
Assignee None
Priority Medium

md5: 0b8ef327088ceebb483e47430f314576

Issue Description:

I am trying to convert a response coming from server to my own type.

Please check the attached playground for better understanding.

@hborla
Copy link
Member

hborla commented Feb 20, 2020

This is a bad diagnostic where the types in the error message look the same because they have the same name, but one is a generic parameter and the other is a struct.

@hborla
Copy link
Member

hborla commented Feb 21, 2020

@swift-ci create

@LucianoPAlmeida
Copy link
Collaborator

@hborla Here is a minimized version of it 🙂

struct R<Value> {
}

protocol P {}
struct T {
}

func f() -> R<[T]> {
  
}
func genericFunc<T: P>(_ completion:  @escaping (R<[T]>) -> Void) {
  let t = f()
  completion(t) // error: cannot convert value of type 'R<[T]>' to expected argument type 'R<Array<_>>'
}

@LucianoPAlmeida
Copy link
Collaborator

On master, it was 'type of expression is ambiguous without more context'
Here is a PR #30814

@LucianoPAlmeida
Copy link
Collaborator

Diagnostic has been improved on master, anmol (JIRA User) Can you please verify using the next available development snapshot from https://swift.org/download/#snapshots and close. 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
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

3 participants