Skip to content

Refactor some solver stuff #1836

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

Merged
merged 7 commits into from
Mar 20, 2018
Merged

Refactor some solver stuff #1836

merged 7 commits into from
Mar 20, 2018

Conversation

nex3
Copy link
Member

@nex3 nex3 commented Mar 20, 2018

No description provided.

nex3 added 6 commits March 20, 2018 15:08
This makes it statically clearer which type of assignment is happening
where.
Before, we considered an assignment to be a decision if it was
positive and the package name was a PackageId.
This gives us a central place to track which decisions have been made,
rather than needing to derive that information from the assignment
list.
Now that we're tracking decisions in PartialSolution, we no longer
need to distinguish decision-like terms from derivation-like terms.
@nex3 nex3 requested a review from munificent March 20, 2018 22:10
!constraint.isAny || (source is! PathSource && source is! GitSource)) {
!isRoot &&
(!constraint.isAny ||
(source is! PathSource && source is! GitSource))) {
Copy link
Member

Choose a reason for hiding this comment

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

Operators nested four deep is pretty rough. Maybe break some of this out into local variables so it's clearer what they represent?

Or perhaps add a getter on Source that means what (source is! PathSource && source is! GitSource) means? Is it "has multiple versions"?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do have Source.hasMultipleVersions, but I don't think it's exactly the right fit here—we usually expect users to include version constraints for SDK dependencies, even though they technically only have one version available at a time.

I've factored this out into a getter to reduce nesting.

@nex3 nex3 merged commit d382969 into feature.solver Mar 20, 2018
@nex3 nex3 deleted the feature.solver.refactor branch March 20, 2018 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants