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-14824] Improve diagnostic for multi-statement closures instead of saying "too complex closure return type" #57172

Closed
typesanitizer opened this issue Jun 24, 2021 · 1 comment

Comments

@typesanitizer
Copy link

@typesanitizer typesanitizer commented Jun 24, 2021

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

md5: 36dfe752f68258a70ceeb284792464d3

Issue Description:

See https://forums.swift.org/t/too-complex-closure-return-type/49897 – it's not clear why a closure is "too complex" because from a user perspective, it looks quite simple.

In case there are multiple statements, we can provide a more specialized diagnostic saying that the compiler doesn't support inferring types of closures with multiple statements.

_ = { // error: Unable to infer complex closure return type; add explicit type to disambiguate
    _ = "" // or anything else here
    return ""
} 
@typesanitizer
Copy link
Author

@typesanitizer typesanitizer commented Jun 24, 2021

@swift-ci create

@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
Projects
None yet
Development

No branches or pull requests

1 participant