You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Reacted by hstdt, Shuju, Ryan Grier and Randy Weinstein
Activity
Dlemex commentedon Apr 17, 2018
I have found that this fixes the compiler error:
return contains { $0 as AnyObject === object }
but will the cast break ===?
tkrajacic commentedon Apr 21, 2018
The correctA better fix for this would be to change the extension to:extension Sequence where Element: AnyObjectWhile the iterator also uses the
Elementassociated type and that one is constrained to be equal to the Sequence'sElementtype, the type system only checks the Sequence'sElementtype in this case, so it can't establish that every element of the Sequence is also anAnyObjectanyway when only the Iterator'sElementis specified.Hope that makes sense.