Skip to content

Deprecate more usage of QuantityType #1019

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 10 commits into from
Jan 26, 2022

Conversation

tmilnthorp
Copy link
Collaborator

I noticed we had only partially deprecated QuantityType. I think this hits all of them.

@tmilnthorp
Copy link
Collaborator Author

Continued from #864

@@ -43,16 +43,6 @@ public static partial class Quantity
Writer.WL(@"
};

// Used by the QuantityInfo .ctor to map a name to a QuantityType. Will be removed when QuantityType
// will be removed.
internal static readonly IDictionary<string, QuantityType> QuantityTypeByName = new Dictionary<string, QuantityType>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was no longer used anywhere

@tmilnthorp tmilnthorp requested a review from angularsen January 26, 2022 16:25
@tmilnthorp tmilnthorp self-assigned this Jan 26, 2022
@@ -585,7 +587,7 @@ public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comp
/// <returns>A hash code for the current {_quantity.Name}.</returns>
public override int GetHashCode()
{{
return new {{ QuantityType, Value, Unit }}.GetHashCode();
return new {{ Info.Name, Value, Unit }}.GetHashCode();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Matching implementation to main library

@codecov
Copy link

codecov bot commented Jan 26, 2022

Codecov Report

Merging #1019 (4a224d4) into master (7f67ffb) will decrease coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1019     +/-   ##
========================================
- Coverage    82.7%   82.7%   -0.0%     
========================================
  Files         310     310             
  Lines       46586   46585      -1     
========================================
- Hits        38526   38525      -1     
  Misses       8060    8060             
Impacted Files Coverage Δ
UnitsNet/GeneratedCode/Quantity.g.cs 51.8% <ø> (-<0.1%) ⬇️
UnitsNet/UnitConverter.cs 82.4% <ø> (ø)
...nitsNet/GeneratedCode/Quantities/Acceleration.g.cs 82.6% <100.0%> (ø)
...et/GeneratedCode/Quantities/AmountOfSubstance.g.cs 82.9% <100.0%> (ø)
...tsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs 77.8% <100.0%> (ø)
UnitsNet/GeneratedCode/Quantities/Angle.g.cs 82.7% <100.0%> (ø)
...tsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs 77.3% <100.0%> (ø)
...itsNet/GeneratedCode/Quantities/ApparentPower.g.cs 77.8% <100.0%> (ø)
UnitsNet/GeneratedCode/Quantities/Area.g.cs 84.5% <100.0%> (ø)
UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs 75.0% <100.0%> (ø)
... and 104 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f67ffb...4a224d4. Read the comment docs.

@tmilnthorp
Copy link
Collaborator Author

CodeCov is really hating me today.

Love the error for a deleted/unused line of code: "Your changes would remove code coverage for this line" 😄

Copy link
Owner

@angularsen angularsen left a comment

Choose a reason for hiding this comment

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

Looks great to me!

{ "VolumetricHeatCapacity", QuantityType.VolumetricHeatCapacity },
{ "WarpingMomentOfInertia", QuantityType.WarpingMomentOfInertia },
};

Copy link
Owner

Choose a reason for hiding this comment

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

Good riddance!

@angularsen angularsen merged commit f3d3b8c into angularsen:master Jan 26, 2022
@angularsen
Copy link
Owner

Nuget should be out shortly
Release UnitsNet/4.115.0 · angularsen/UnitsNet

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.

2 participants