[SR-6989] Trailing closure syntax shouldn't apply when argument is generic but not explicitly a function #49537
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Environment
Swift 4.0.2, 4.1
Additional Detail from JIRA
md5: 48568a9aa9b62907251dc6d3a4f85009
Issue Description:
As discovered here: ReactiveCocoa/ReactiveSwift#601 (comment)
This code:
yields this error:
This does not seem like a valid application of trailing closure syntax. Specifically: trailing closure syntax should only apply when the argument is definitely a function
(U) -> T
—not when it's any generic valueU
to which you can pass a function.I'm hoping you'll consider this a bug. But if not, I'd be happy to open a swift-evolution discussion. 🙂
The text was updated successfully, but these errors were encountered: