Skip to content

Improving non-Equatable diagnostics #40

Closed

Description

@mbrandonw

Hi ordo-one!

This isn't an issue with the library, but since discussions aren't enabled in the repo this was the only place I could see to discuss this. Feel free to close anytime!

We recently wrote about a macro technique that y'all would be able to take advantage of, if interested. As I'm sure you are well aware, currently if you stick a non-Equatable thing into a type that uses @Equatable, you get an error message hidden in the guts of the macro expansion instead of on the line that actually caused the problem. It is possible to fix this poor developer experience and emit diagnostics directly on the field that is not Equatable.

You can further use this technique to fix #32. You can detect when a field is an AnyObject and opt to compare it using === instead of == without forcing the user to conform their class to Equatable.

Feel free to disregard any of this, but just thought you might be interested in the technique!

Activity

  1. supersonicbyte commented on Oct 13, 2026

    @supersonicbyte
    Collaborator

    Hey @mbrandonw, thanks a lot for the suggestion! I've already opened up a PR that implements it. I think it will be a great improvement.

  2. supersonicbyte commented on Nov 18, 2026

    @supersonicbyte
    Collaborator

    Closing this since the suggestion has been adopted with: #42

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