[SR-6971] Single line closure cannot infer type, but multiline can #49519
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
Xcode 9.2
Swift 4.0.x
Additional Detail from JIRA
md5: 782051cebbe7a6fa9664c4e339e3853e
Issue Description:
Consider this simple `chunk` addition to `Array`:
This currently does not compile. Even if I add return types and explicit `return` to the closure:
However, if I break this to a multiline closure, it will then work, even without explicit types in the closure:
Even weirder, it doesn't seem to depend on the contents of the extra line in the closure. Even a print statement somehow kicks it into shape:
The text was updated successfully, but these errors were encountered: