Skip to content

Conversation

@kovdan01
Copy link
Contributor

@kovdan01 kovdan01 commented Dec 22, 2025

The conformances Type: Comparable and EnumCase: Equatable were previously introduced in #85757 for implementing AutoDiff closure specialization logic. This patch moves the latter directly to the SIL module. The conformance Type: Comparable is deleted, and sort(by:) is used instead of sort to mimic the same behavior in tests. These changes address warnings mentioned in the comment: #85757 (comment)

The conformances `Type: Comparable` and `EnumCase: Equatable` were
previously introduced in swiftlang#85757 for implementing AutoDiff closure
specialization logic. This patch moves the conformances directly to
the SIL module to address warnings mentioned in the comment:
swiftlang#85757 (comment)
@kovdan01 kovdan01 requested a review from asl December 22, 2025 12:29
@kovdan01 kovdan01 marked this pull request as ready for review December 22, 2025 12:29
@kovdan01 kovdan01 requested a review from eeckstein as a code owner December 22, 2025 12:29
@kovdan01
Copy link
Contributor Author

@swift-ci Please test

hasher.combine(bridged.opaqueValue)
}

public static func < (lhs: Type, rhs: Type) -> Bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very inefficient. It's better to compare the raw pointers of the bridged type.

For what reason do you need Type to be comparable?

Copy link
Contributor Author

@kovdan01 kovdan01 Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've introduced that to make test output more predictable when printing an array of types.

I've also just discovered that such a conformance is not required since we have an overload for sort which accepts the comparator function: https://developer.apple.com/documentation/swift/array/sort(by:)

So, I'll use that instead for ADCS tests and just delete this conformance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eeckstein See fix in 575333d

Update the PR description correspondingly

@kovdan01 kovdan01 changed the title Introduce Type: Comparable and EnumCase: Equatable conformances Fix conformance-related warnings appearing after PR85757 Dec 22, 2025
@kovdan01
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@kovdan01 kovdan01 enabled auto-merge (squash) December 23, 2025 09:06
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.

2 participants