Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix VersionSetSpecifier calculation for versions with pre-release identifiers #6492

Merged
merged 1 commit into from Apr 28, 2023

Conversation

tomerd
Copy link
Member

@tomerd tomerd commented Apr 28, 2023

motivation: some version calculations were incorrect when dealing with pre-release identifiers, leading to dependency resolution errors

changes:

  • fix Version::nextPatch() to take into pre-release identifiers into account
  • add tests

@tomerd tomerd force-pushed the fix/beta-versions branch 4 times, most recently from 0924330 to 7674645 Compare April 28, 2023 17:19
@tomerd tomerd changed the title wip: fix beta versions fix VersionSetSpecifier calculation for versions with pre-release identifiers Apr 28, 2023
…ntitiers

motivation: some version calculations were incorrect when dealing with pre-release identitiers, leading to dependency resolution errors

changes:
* fix Version::nextPatch() to take into pre-release identitiers into account
* add tests
@tomerd
Copy link
Member Author

tomerd commented Apr 28, 2023

@swift-ci smoke test


state.derive(unsatisfiedTerm.inverse, cause: incompatibility)
self.delegate?.derived(term: unsatisfiedTerm.inverse)
Copy link
Member

Choose a reason for hiding this comment

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

Is it meaningful that the order changed here?

Copy link
Member Author

@tomerd tomerd Apr 28, 2023

Choose a reason for hiding this comment

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

no, it was part of a change I reverted (I made state.derive throwing so wanted to call delegate only if succeeded), but should not have impact - the delegate is used for logging etc and in any case should be called after the fact not before

XCTAssertEqual(VersionSetSpecifier.exact("2.0.0-beta").difference(.exact("1.0.0-beta")), .exact("2.0.0-beta"))

XCTAssertEqual(VersionSetSpecifier.range("1.0.0-beta"..<"1.0.0-beta").difference(.range("1.0.0-beta"..<"1.0.0-beta")), .empty)
XCTAssertEqual(VersionSetSpecifier.range("2.0.0-beta"..<"2.0.0-beta").difference(.range("1.0.0"..<"2.0.0")), .range("2.0.0-beta"..<"2.0.0-beta"))
Copy link
Member

Choose a reason for hiding this comment

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

Possibly not a new thing, but I wonder whether this should just be .empty?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the same as

XCTAssertEqual(VersionSetSpecifier.range("2.0.0"..<"2.0.0").difference(.range("3.0.0"..<"4.0.0")), .range("2.0.0"..<"2.0.0"))

Copy link
Member

Choose a reason for hiding this comment

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

I guess we simply don't touch the first operand if the second one is not a subset of it. It doesn't make a practical difference since I have previously fixed equality in 96ed023, so the two are equal, but could be interesting for readability maybe. In any case, not relevant for this PR since it is pre-existing.

@tomerd tomerd merged commit af05a54 into apple:main Apr 28, 2023
5 checks passed
tomerd added a commit to tomerd/swift-package-manager that referenced this pull request Apr 28, 2023
…ntifiers (apple#6492)

motivation: some version calculations were incorrect when dealing with pre-release identifiers, leading to dependency resolution errors

changes:
* fix Version::nextPatch() to take into pre-release identifiers into account
* add tests
tomerd added a commit that referenced this pull request May 1, 2023
…ntifiers (#6492) (#6495)

motivation: some version calculations were incorrect when dealing with pre-release identifiers, leading to dependency resolution errors

changes:
* fix Version::nextPatch() to take into pre-release identifiers into account
* add tests
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.

None yet

2 participants