-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
Milestone
Description
Description
Some ValueTuples' IStructuralEquatable.Equals methods skip comparing Item4.
runtime/src/libraries/System.Private.CoreLib/src/System/ValueTuple.cs
Lines 1123 to 1128 in 91ac6b3
| bool IStructuralEquatable.Equals(object? other, IEqualityComparer comparer) => | |
| other is ValueTuple<T1, T2, T3, T4, T5> vt && | |
| comparer.Equals(Item1, vt.Item1) && | |
| comparer.Equals(Item2, vt.Item2) && | |
| comparer.Equals(Item3, vt.Item3) && | |
| comparer.Equals(Item5, vt.Item5); |
Search vt.Item3) && in that file to find more.
Reproduction Steps
using System.Collections;
IStructuralEquatable a = ValueTuple.Create(1, 2, 3, 4, 5);
IStructuralEquatable b = ValueTuple.Create(1, 2, 3, 0, 5);
Console.WriteLine(a.Equals(b, EqualityComparer<object>.Default));
await Task.Delay(-1);Expected behavior
False
Actual behavior
True
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
EgorBo, aloraman, ForNeVeR, hrrrrustic, RomanProtas and 33 moreSzer and sivukhinCXuesong and DrunkRussianGunmarco-carvalho and gbtb