Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Add contracts for System.Version #318

Merged
merged 3 commits into from
Jan 26, 2016

Conversation

yaakov-h
Copy link
Contributor

@yaakov-h yaakov-h commented Dec 1, 2015

Cross-checked with Reference Source.

I've verified that this compiles, and work as expected for .NET 4.5.

@hubuk
Copy link
Contributor

hubuk commented Dec 1, 2015

It should be safe to also add the following contracts for properties.

//for Major and Minor
Contract.Ensures(Contract.Result<int>() >= 0);
//for Build and Revision
Contract.Ensures(Contract.Result<int>() >= -1);
//for MajorRevision and MinorRevision
Contract.Ensures(Contract.Result<short>() >= -1);

@yaakov-h
Copy link
Contributor Author

yaakov-h commented Dec 1, 2015

Thanks @hubuk.

Confirmed still compiling.

}

[Pure]
public int MajorRevision
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't spotted this before. Version.MajorRevision is of short type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll fix them up tomorrow morning.

SergeyTeplyakov added a commit that referenced this pull request Jan 26, 2016
Add contracts for System.Version
@SergeyTeplyakov SergeyTeplyakov merged commit 783ef95 into microsoft:master Jan 26, 2016
@yaakov-h yaakov-h deleted the pr-system.version branch April 24, 2018 13:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants