Skip to content

Add Equatable and Hashable property retention#1126

Merged
ileitch merged 2 commits into
peripheryapp:masterfrom
horia-openai:codex/retain-equatable-hashable-properties
May 15, 2026
Merged

Add Equatable and Hashable property retention#1126
ileitch merged 2 commits into
peripheryapp:masterfrom
horia-openai:codex/retain-equatable-hashable-properties

Conversation

@horia-openai
Copy link
Copy Markdown
Contributor

@horia-openai horia-openai commented May 13, 2026

Summary

  • Add retain_equatable_properties and retain_hashable_properties configuration options and CLI flags.
  • Retain stored properties for value types that conform to Equatable or Hashable, including inherited protocol conformances.
  • Add fixtures and retention tests covering both options.

Motivation

Swift can synthesize Equatable and Hashable conformances from stored properties without producing explicit references in index data. That can make properties appear unused even though changing or removing them changes synthesized equality or hashing behavior.

This keeps the behavior opt-in, similar to the existing retain_codable_properties setting, so projects can choose the broader retention behavior when synthesized protocol requirements are part of their API surface.

Fixes #869.
Fixes #1028.
Related to #721.

Testing

  • swift test --filter "RetentionTest/testRetains"
  • swift test
  • swiftformat --quiet --strict .
  • swiftlint lint --quiet --strict
  • bazelisk run //bazel/dev:buildifier.check
  • git diff --check

@horia-openai horia-openai marked this pull request as ready for review May 13, 2026 21:45
@horia-openai horia-openai force-pushed the codex/retain-equatable-hashable-properties branch from 1620a5c to fe56f5d Compare May 13, 2026 21:48
@horia-openai
Copy link
Copy Markdown
Contributor Author

@ileitch This is ready for review, please take a look.

@ileitch ileitch merged commit b4e202d into peripheryapp:master May 15, 2026
11 of 13 checks passed
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.

Add option to retain Hashable properties --retain-equatable-properties option

2 participants