Skip to content

Xcode 9.3, swift 4.1 compile error  #48

Open

Description

@dongshuju

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

Activity

  1. Dlemex commented on Apr 17, 2018

    @Dlemex

    I have found that this fixes the compiler error:

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

    but will the cast break ===?

  2. tkrajacic commented on Apr 21, 2018

    @tkrajacic

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions