Skip to content

Fix redundantEquatable removing manual == for types with Any.Type stored properties#2503

Merged
calda merged 2 commits intodevelopfrom
copilot/fix-redundant-equatable-issue
Apr 13, 2026
Merged

Fix redundantEquatable removing manual == for types with Any.Type stored properties#2503
calda merged 2 commits intodevelopfrom
copilot/fix-redundant-equatable-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

Any.Type is a metatype with == defined for pointer identity but does not conform to Equatable, so the compiler cannot synthesize Equatable for types with such properties. The rule was incorrectly treating these as eligible for synthesis.

Changes

  • Sources/Rules/RedundantEquatable.swift: Added "Any.Type" to knownNonEquatableTypes alongside the existing "AnyClass" entry
  • Tests/Rules/RedundantEquatableTests.swift: Added testPreserveCustomEquatableImplementationComparingAnyType

Example

// Manual == must be preserved — Any.Type is not Equatable
struct MyStruct: Equatable {
    let ty: Any.Type

    static func == (lhs: Self, rhs: Self) -> Bool {
        lhs.ty == rhs.ty
    }
}

Copilot AI changed the title [WIP] Fix redundantEquatable to preserve manual equality implementation Fix redundantEquatable removing manual == for types with Any.Type stored properties Apr 13, 2026
Copilot AI requested a review from calda April 13, 2026 14:20
@calda calda marked this pull request as ready for review April 13, 2026 14:21
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.32%. Comparing base (b94d3d8) to head (a5c2435).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2503   +/-   ##
========================================
  Coverage    95.31%   95.32%           
========================================
  Files          168      168           
  Lines        25410    25410           
========================================
+ Hits         24219    24221    +2     
+ Misses        1191     1189    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@calda calda merged commit aceab79 into develop Apr 13, 2026
22 checks passed
@calda calda deleted the copilot/fix-redundant-equatable-issue branch April 13, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

redundantEquatable removes manually implemented == for types with Any.Type stored properties

2 participants