apollographql / apollographql/apollo-tooling

[Swift] Generated code has unnecessary == definitions

Open
#1,265 0 comments 1 reaction 0 assignees View on GitHub
:bird: component - swift 🤖 component - codegen
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

The generated Swift code includes definitions of `==` for each type as part of `Equatable` conformance (introduced in #216).

As of Swift 4.1, these explicit definitions are no longer necessary as the compiler will synthesize them for us. We're already relying on using Swift 4.1 or later for `Hashable` conformance so relying on it for `Equatable` conformance is safe as well. Removing the generated `==` operators will shrink the code size, which seems like a win.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Swift code-generation entry point and the template or logic that emits explicit `==` operators for `Equatable` types. Compare generated output before and after the change, and verify that generated Swift still relies on Swift 4.1 synthesis while omitting those definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift, typescript
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.