core-data icon indicating copy to clipboard operation
core-data copied to clipboard

both operands of "===" should be AnyObject

Open EdgarDegas opened this issue 7 years ago • 2 comments

EdgarDegas avatar Apr 07 '18 12:04 EdgarDegas

This eliminates the compiler error. But does it eliminate the root cause? That is, should $0 be Any Object?

PatrickWeigel avatar Apr 20 '18 19:04 PatrickWeigel

~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.

tkrajacic avatar Apr 21 '18 05:04 tkrajacic