Skip to content

Update to Xcode 9.3#415

Merged
djbe merged 6 commits intomasterfrom
feature/xcode-9.3
Apr 27, 2018
Merged

Update to Xcode 9.3#415
djbe merged 6 commits intomasterfrom
feature/xcode-9.3

Conversation

@djbe
Copy link
Copy Markdown
Member

@djbe djbe commented Apr 25, 2018

Note that to fix some warnings, we have to use compactMap in the SwiftGenKit code, which might be considered a breaking change (Swift 4.1). I don't know if this warrants a major version bump for SwiftGenKit (and SwiftGen).

Comment thread .ruby-version Outdated
@@ -1 +1 @@
2.4.2
2.4.4
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark as for the other PR regarding system version

*/
func process(folder: Path, withPrefix prefix: String = "") -> [Catalog.Entry] {
return (try? folder.children().sorted(by: <).flatMap {
return (try? folder.children().sorted(by: <).compactMap {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I get this change

folder.children().sorted(by:<) is an array
the closure calls process which returns an array too

So in this use case we should be using the monadic flatMap (the one that wasn't renamed), not the non-monadic [T].compactMap(f: (T) -> T?) -> [T] one? So why would the compiler want us to change it there, did we get types mixed up and didn't do what we thought we were doing before, using the non monadic one all along by mistake?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The process(item: $0, withPrefix: prefix) that's called in the compactMap closure has as type:

func process(item: Path, withPrefix prefix: String) -> Catalog.Entry?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right it's not the same process method as process(folder: withPrefix: ) -> [Catalog.Entry], right. 👍

guard let descRefs = (descs as? [CTFontDescriptor]) else { return [] }

return descRefs.flatMap { desc -> Font? in
return descRefs.compactMap { desc -> Font? in
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(… As compared to here where the change is justified as we operate on an array but the closure returns an optional, so here it's indeed intended to be the non-monadic compactMap and this change is expected)

@djbe
Copy link
Copy Markdown
Member Author

djbe commented Apr 27, 2018

I'm assuming that with the ruby change this PR should be ok, and go ahead and merge it.

@djbe djbe merged commit 77a1115 into master Apr 27, 2018
@djbe djbe deleted the feature/xcode-9.3 branch April 27, 2018 21:30
@djbe djbe added this to the Swiftgen 6.0 milestone May 6, 2018
@djbe djbe self-assigned this May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants