Repository navigation
Conversation
FrameworkIdentifier instances were compared structurally before but it was problematic in some cases as '>= net45' matched 'sl40' that wasn't in the same framework. This commit add new operators (.>, .>=, .<, .<=) and methods (Min, Max, IsSameFramework) to FrameworkIdentifier that do the comparison with the expected semantic. Fixes fsprojects#1124
Member
|
would #1130 be enough? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
FrameworkIdentifierinstances were compared structurally before but it was problematic in some cases as>= net45matchedsl40that wasn't in the same framework.This PR add new operators (
.>,.>=,.<,.<=) and methods (Min,Max,IsSameFramework) toFrameworkIdentifierthat do the comparison with the expected semantic.Fixes #1124
Questions
This PR is a work in progress because I have a few questions about the way I did the change.
Structural Equality
The original problem come from the fact that structural comparison was used for
FrameworkIdentifier.But in fact no comparison (that could be used for ordering) could ever be correct for this type because
net40 > sl40should returnfalsebutnet40 < sl40should returnfalsetoo.Problem with that is that Sets are used over
FrameworkIndentifierand due to their implementation require comparison... and I don't see any clean easy way out. Solutions that came to mind are :FrameworkIdentifierinstead of the built-in oneIn the end I applied 3 as the rest of the changes were too big (
Setis used pretty often andFrameworkIdentifieris part of other types that are themselves used in Sets) but I wonder if it's the correct decision.isTargetMatchingRestrictions
I extracted this method to be able to test it but it's behavior relative to portable profiles is pretty specific and I don't know if the name is specific enough.