Skip to content

Equatable conformance will not compile – ARTErrorInfo is not Equatable #288

@maratal

Description

@maratal

DiscontinuityEvent declares Equatable, yet the stored property ARTErrorInfo coming from Ably Cocoa does not conform to Equatable.
Compilation will therefore fail with “Type ‘ARTErrorInfo’ does not conform to protocol ‘Equatable’”.

Two ways forward:

-public struct DiscontinuityEvent: Sendable, Equatable {
+public struct DiscontinuityEvent: Sendable {

or keep Equatable and provide a manual implementation (comparing the few stable fields you care about, e.g. code + message). Removing the conformance is usually safer because ARTErrorInfo also lacks Sendable, so you might need @unchecked Sendable too.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

public struct DiscontinuityEvent: Sendable {
    /// The error associated with this discontinuity.
    public var error: ARTErrorInfo

    public init(error: ARTErrorInfo) {
        self.error = error
    }
}
🤖 Prompt for AI Agents (early access)
In Sources/AblyChat/Discontinuity.swift around lines 3 to 10, the struct
DiscontinuityEvent declares Equatable conformance but its stored property
ARTErrorInfo does not conform to Equatable, causing a compilation error. To fix
this, either remove the Equatable conformance from DiscontinuityEvent or
implement a custom Equatable conformance manually by comparing selected stable
fields of ARTErrorInfo such as code and message. Also consider removing or
adjusting Sendable conformance accordingly.

Originally posted by @coderabbitai[bot] in #286 (comment)

┆Issue is synchronized with this Jira Task by Unito

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