Update PackageIdentity to be case-insensitive #3749
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the synthesized conformance to
EquatableandHashableand updates adoption ofComparableto use case-insensitive comparisons.Motivation:
With SE-0292, package identifiers must be case-insensitive. For example, a dependency declared as
mona.LinkedListis equivalent toMONA.LINKEDLIST.This change also makes sense for packages identified by a remote URL* or local path**.
* Technically, URLs are case-sensitive. However, many if not most websites treat them as case-insensitive. This includes all of the popular code hosting services I'm aware of. I would be very surprised if any packages in the wild rely on remote packages differing only in case not being equivalent.
** Filesystems vary in case-sensitivity, so we should to normalize to a single case to make sure Swift packages behave the same on all platforms and don't cause vulnerabilities.
Modifications:
Result:
This shouldn't change any existing behavior. If it causes any new failures in our test suite, we should review to see if the expected behavior is correct.