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

Xcode 9.3, swift 4.1 compile error #48

Open
dongshuju opened this issue Apr 16, 2018 · 2 comments
Open

Xcode 9.3, swift 4.1 compile error #48

dongshuju opened this issue Apr 16, 2018 · 2 comments

Comments

@dongshuju
Copy link

core-data-master/SharedCode/Utilities.swift:47:30: Binary operator '===' cannot be applied to operands of type 'Self.Element' and 'AnyObject'

@Dlemex
Copy link

Dlemex commented Apr 17, 2018

I have found that this fixes the compiler error:

return contains { $0 as AnyObject === object }

but will the cast break ===?

@tkrajacic
Copy link

tkrajacic commented Apr 21, 2018

The correct A better fix for this would be to change the extension to:

extension Sequence where Element: AnyObject

While the iterator also uses the Element associated type and that one is constrained to be equal to the Sequence's Element type, the type system only checks the Sequence's Element type in this case, so it can't establish that every element of the Sequence is also an AnyObject anyway when only the Iterator's Element is specified.

Hope that makes sense.

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

No branches or pull requests

3 participants