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

Update to Xcode 9.3 #415

Merged
merged 6 commits into from
Apr 27, 2018
Merged

Update to Xcode 9.3 #415

merged 6 commits into from
Apr 27, 2018

Conversation

djbe
Copy link
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).

.ruby-version Outdated
@@ -1 +1 @@
2.4.2
2.4.4
Copy link
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

@@ -80,7 +80,7 @@ extension AssetsCatalogParser {
This method recursively parses a directory structure, processing each folder (files are ignored).
*/
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
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
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
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. 👍

@@ -56,7 +56,7 @@ extension CTFont {
let descs = CTFontManagerCreateFontDescriptorsFromURL(file.url as CFURL) as NSArray?
guard let descRefs = (descs as? [CTFontDescriptor]) else { return [] }

return descRefs.flatMap { desc -> Font? in
return descRefs.compactMap { desc -> Font? in
Copy link
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
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