Closed lhunath closed 2 years ago
@lhunath the first issue is now fixed in SwiftFormat 0.49.10. The second is a known issue that isn't easily solved (see known issues in README.md).
Is there any mechanism for SwiftFormat to check whether its output is syntactically legal? Though I suppose for detecting [2] we would require a type checker, perhaps the requirements machine is relevant.
Considering the following utility:
Utilized like this:
swiftformat
reformats the usage point to:Which is illegal.
For instance, the following reformatting may seem to be a valid fix:
However, since
\.id
is a non-optionally typed property andcompactMap
's first block takes a block with an optionally-typed return value, the two are not in fact compatible (even though an explicit block allows transparent type conversion to take place, this does not happen for under the keypath short-hand syntax).