Skip to content

Fixing nasty bug in GetHashCode where two quantities with the same nu… #541

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 2 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Acceleration.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public bool Equals(Acceleration other, Acceleration maxError)
/// <returns>A hash code for the current Acceleration.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Acceleration), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ public bool Equals(AmountOfSubstance other, AmountOfSubstance maxError)
/// <returns>A hash code for the current AmountOfSubstance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(AmountOfSubstance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public bool Equals(AmplitudeRatio other, AmplitudeRatio maxError)
/// <returns>A hash code for the current AmplitudeRatio.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(AmplitudeRatio), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Angle.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ public bool Equals(Angle other, Angle maxError)
/// <returns>A hash code for the current Angle.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Angle), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public bool Equals(ApparentEnergy other, ApparentEnergy maxError)
/// <returns>A hash code for the current ApparentEnergy.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ApparentEnergy), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public bool Equals(ApparentPower other, ApparentPower maxError)
/// <returns>A hash code for the current ApparentPower.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ApparentPower), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Area.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public bool Equals(Area other, Area maxError)
/// <returns>A hash code for the current Area.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Area), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(AreaDensity other, AreaDensity maxError)
/// <returns>A hash code for the current AreaDensity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(AreaDensity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public bool Equals(AreaMomentOfInertia other, AreaMomentOfInertia maxError)
/// <returns>A hash code for the current AreaMomentOfInertia.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(AreaMomentOfInertia), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/BitRate.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public bool Equals(BitRate other, BitRate maxError)
/// <returns>A hash code for the current BitRate.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(BitRate), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public bool Equals(BrakeSpecificFuelConsumption other, BrakeSpecificFuelConsumpt
/// <returns>A hash code for the current BrakeSpecificFuelConsumption.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(BrakeSpecificFuelConsumption), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Capacitance.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(Capacitance other, Capacitance maxError)
/// <returns>A hash code for the current Capacitance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Capacitance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Density.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ public bool Equals(Density other, Density maxError)
/// <returns>A hash code for the current Density.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Density), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Duration.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public bool Equals(Duration other, Duration maxError)
/// <returns>A hash code for the current Duration.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Duration), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public bool Equals(DynamicViscosity other, DynamicViscosity maxError)
/// <returns>A hash code for the current DynamicViscosity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(DynamicViscosity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public bool Equals(ElectricAdmittance other, ElectricAdmittance maxError)
/// <returns>A hash code for the current ElectricAdmittance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricAdmittance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricCharge other, ElectricCharge maxError)
/// <returns>A hash code for the current ElectricCharge.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricCharge), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricChargeDensity other, ElectricChargeDensity maxError)
/// <returns>A hash code for the current ElectricChargeDensity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricChargeDensity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public bool Equals(ElectricConductance other, ElectricConductance maxError)
/// <returns>A hash code for the current ElectricConductance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricConductance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricConductivity other, ElectricConductivity maxError)
/// <returns>A hash code for the current ElectricConductivity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricConductivity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public bool Equals(ElectricCurrent other, ElectricCurrent maxError)
/// <returns>A hash code for the current ElectricCurrent.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricCurrent), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricCurrentDensity other, ElectricCurrentDensity maxError
/// <returns>A hash code for the current ElectricCurrentDensity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricCurrentDensity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricCurrentGradient other, ElectricCurrentGradient maxErr
/// <returns>A hash code for the current ElectricCurrentGradient.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricCurrentGradient), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/ElectricField.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricField other, ElectricField maxError)
/// <returns>A hash code for the current ElectricField.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricField), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public bool Equals(ElectricInductance other, ElectricInductance maxError)
/// <returns>A hash code for the current ElectricInductance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricInductance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public bool Equals(ElectricPotential other, ElectricPotential maxError)
/// <returns>A hash code for the current ElectricPotential.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricPotential), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public bool Equals(ElectricPotentialAc other, ElectricPotentialAc maxError)
/// <returns>A hash code for the current ElectricPotentialAc.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricPotentialAc), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public bool Equals(ElectricPotentialDc other, ElectricPotentialDc maxError)
/// <returns>A hash code for the current ElectricPotentialDc.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricPotentialDc), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public bool Equals(ElectricResistance other, ElectricResistance maxError)
/// <returns>A hash code for the current ElectricResistance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricResistance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public bool Equals(ElectricResistivity other, ElectricResistivity maxError)
/// <returns>A hash code for the current ElectricResistivity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ElectricResistivity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Energy.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ public bool Equals(Energy other, Energy maxError)
/// <returns>A hash code for the current Energy.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Energy), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Entropy.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public bool Equals(Entropy other, Entropy maxError)
/// <returns>A hash code for the current Entropy.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Entropy), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Flow.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ public bool Equals(Flow other, Flow maxError)
/// <returns>A hash code for the current Flow.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Flow), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Force.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public bool Equals(Force other, Force maxError)
/// <returns>A hash code for the current Force.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Force), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public bool Equals(ForceChangeRate other, ForceChangeRate maxError)
/// <returns>A hash code for the current ForceChangeRate.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ForceChangeRate), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public bool Equals(ForcePerLength other, ForcePerLength maxError)
/// <returns>A hash code for the current ForcePerLength.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(ForcePerLength), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Frequency.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public bool Equals(Frequency other, Frequency maxError)
/// <returns>A hash code for the current Frequency.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Frequency), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ public bool Equals(HeatFlux other, HeatFlux maxError)
/// <returns>A hash code for the current HeatFlux.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(HeatFlux), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public bool Equals(HeatTransferCoefficient other, HeatTransferCoefficient maxErr
/// <returns>A hash code for the current HeatTransferCoefficient.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(HeatTransferCoefficient), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Illuminance.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public bool Equals(Illuminance other, Illuminance maxError)
/// <returns>A hash code for the current Illuminance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Illuminance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Information.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public bool Equals(Information other, Information maxError)
/// <returns>A hash code for the current Information.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Information), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Irradiance.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public bool Equals(Irradiance other, Irradiance maxError)
/// <returns>A hash code for the current Irradiance.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Irradiance), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Common/GeneratedCode/Quantities/Irradiation.Common.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public bool Equals(Irradiation other, Irradiation maxError)
/// <returns>A hash code for the current Irradiation.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(Irradiation), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public bool Equals(KinematicViscosity other, KinematicViscosity maxError)
/// <returns>A hash code for the current KinematicViscosity.</returns>
public override int GetHashCode()
{
return new { Value, Unit }.GetHashCode();
return new { type = typeof(KinematicViscosity), Value, Unit }.GetHashCode();
}

#endregion
Expand Down
Loading