Skip to content
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

Fix HasValueX incorrectly returning true #676

Merged
merged 4 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
[#675] Corrected order of execution when assigning values to ValueX, …
…from object collection, and correctly storing the state of HasValueX
  • Loading branch information
Adam Smith-Platts committed Dec 13, 2023
commit 60dd7f6ef0b5238a14aa9427b167e43262b6d81d
16 changes: 8 additions & 8 deletions Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,21 +245,21 @@ public Values(IEnumerable<object?> items)
}
}

this.HasValue1 = items1?.Count > 0;
this.HasValue2 = items2?.Count > 0;
this.HasValue3 = items3?.Count > 0;
this.HasValue4 = items4?.Count > 0;
this.HasValue5 = items5?.Count > 0;
this.HasValue6 = items6?.Count > 0;
this.HasValue7 = items7?.Count > 0;

this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
this.Value5 = items5 == null ? default : (OneOrMany<T5>)items5;
this.Value6 = items6 == null ? default : (OneOrMany<T6>)items6;
this.Value7 = items7 == null ? default : (OneOrMany<T7>)items7;

this.HasValue1 = this.Value1.Count > 0;
this.HasValue2 = this.Value2.Count > 0;
this.HasValue3 = this.Value3.Count > 0;
this.HasValue4 = this.Value4.Count > 0;
this.HasValue5 = this.Value5.Count > 0;
this.HasValue6 = this.Value6.Count > 0;
this.HasValue7 = this.Value7.Count > 0;
}

/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,19 @@ public Values(IEnumerable<object?> items)
}
}

this.HasValue1 = items1?.Count > 0;
this.HasValue2 = items2?.Count > 0;
this.HasValue3 = items3?.Count > 0;
this.HasValue4 = items4?.Count > 0;
this.HasValue5 = items5?.Count > 0;
this.HasValue6 = items6?.Count > 0;

this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
this.Value5 = items5 == null ? default : (OneOrMany<T5>)items5;
this.Value6 = items6 == null ? default : (OneOrMany<T6>)items6;

this.HasValue1 = this.Value1.Count > 0;
this.HasValue2 = this.Value2.Count > 0;
this.HasValue3 = this.Value3.Count > 0;
this.HasValue4 = this.Value4.Count > 0;
this.HasValue5 = this.Value5.Count > 0;
this.HasValue6 = this.Value6.Count > 0;
}

/// <summary>
Expand Down
12 changes: 6 additions & 6 deletions Source/Common/Values{T1,T2,T3,T4,T5}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,17 @@ public Values(IEnumerable<object?> items)
}
}

this.HasValue1 = items1?.Count > 0;
this.HasValue2 = items2?.Count > 0;
this.HasValue3 = items3?.Count > 0;
this.HasValue4 = items4?.Count > 0;
this.HasValue5 = items5?.Count > 0;

this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
this.Value5 = items5 == null ? default : (OneOrMany<T5>)items5;

this.HasValue1 = this.Value1.Count > 0;
this.HasValue2 = this.Value2.Count > 0;
this.HasValue3 = this.Value3.Count > 0;
this.HasValue4 = this.Value4.Count > 0;
this.HasValue5 = this.Value5.Count > 0;
}

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions Source/Common/Values{T1,T2,T3,T4}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ public Values(IEnumerable<object?> items)
}
}

this.HasValue1 = items1?.Count > 0;
this.HasValue2 = items2?.Count > 0;
this.HasValue3 = items3?.Count > 0;
this.HasValue4 = items4?.Count > 0;

this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;

this.HasValue1 = this.Value1.Count > 0;
this.HasValue2 = this.Value2.Count > 0;
this.HasValue3 = this.Value3.Count > 0;
this.HasValue4 = this.Value4.Count > 0;
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Source/Common/Values{T1,T2,T3}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public Values(IEnumerable<object> items)
}
}

this.HasValue1 = items1?.Count > 0;
this.HasValue2 = items2?.Count > 0;
this.HasValue3 = items3?.Count > 0;

this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;

this.HasValue1 = this.Value1.Count > 0;
this.HasValue2 = this.Value2.Count > 0;
this.HasValue3 = this.Value3.Count > 0;
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions Source/Common/Values{T1,T2}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public Values(IEnumerable<object?> items)
}
}

this.HasValue1 = items1?.Count > 0;
this.HasValue2 = items2?.Count > 0;

this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;

this.HasValue1 = this.Value1.Count > 0;
this.HasValue2 = this.Value2.Count > 0;
}

/// <summary>
Expand Down