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

Fix compiler failure in Xcode 11 #22

Merged

Conversation

p4checo
Copy link
Contributor

@p4checo p4checo commented Oct 10, 2019

Apparently by defining NonEmpty as conforming to Collection right away in its declaration (instead of in an extension), the compilation failure with a weird DESERIALIZATION FAILURE error, as mentioned on #15 seems to be fixed.

Even when performing a clean build, the target now successfully compiles. 🎉 (it didn't with the previous solution).

Not sure about the actual cause for this, but this definitely seems like a compiler bug (file ordering / dependency, perhaps? 🔮).

Fixes #15. 🎉

For some unknown reason (at least to me) the `subscript(position:)`
extension on `MutableCollection` where `Index == Int` was causing the
compilation to fail with a weird `DESERIALIZATION FAILURE` error,
as mentioned on pointfreeco#15.

Updating the `subscript` to use `C.Index` instead of `Int` appears to
make the compiler happy and successfully compile the project. My
suspicion is that it somehow enables it to disambiguate between the
multiple `subscript` implementations, but it's pure speculation 🔮.

On our tests this seems to have fixed the issue, and since it's an
equivalent definition of the subscript (even though more "precise"
from a generics POV), it should cause no side effects.

Fixes pointfreeco#15. 🎉
@p4checo p4checo force-pushed the bugfix/fix-compiler-crash-on-xcode-11 branch from b20f92b to 9670a49 Compare October 10, 2019 13:59
@p4checo
Copy link
Contributor Author

p4checo commented Oct 10, 2019

Well, apparently I got a bit carried away and this only works in an incremental build 😓.

Performing a clean build still fails to compile, and running it for the second time also works with the "original" version (i.e. with the Int).

Sorry for the noise 😇

Apparently by defining `NonEmpty` as conforming to `Collection` right
away in its declaration (instead of in an extension), the compilation
failure seems to be fixed.

Even when performing a clean build, the target now successfully
compiles. 🎉

Not sure about the actual cause for this, but this definitely seems
like a compiler bug (file ordering / dependency, perhaps?).
@p4checo
Copy link
Contributor Author

p4checo commented Oct 10, 2019

After much experimentation, I seem to have found a working solution, even for clean builds 🎉

@p4checo p4checo reopened this Oct 10, 2019
@darrarski
Copy link

What's the status of this PR? NonEmpty v0.2.0 compiles without an issue on my MacBook, but I'm experiencing the bug on Xcode 11.3.1 on my CI (Mac mini). Are there any additional steps required before merging this PR?

Copy link
Member

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

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

Thanks so much for this! and sorry for the delay!

We were seeing this problem while trying to convert to GH actions, and didn't know what the heck was going on. Didn't realize you had already solved it.

We're merging now!

@mbrandonw mbrandonw merged commit 1b33a67 into pointfreeco:master Jan 30, 2020
@p4checo p4checo deleted the bugfix/fix-compiler-crash-on-xcode-11 branch January 30, 2020 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Xcode 11 beta 2/3 fails to compile
3 participants