Skip to content

Item4 is missing in some ValueTuples' IStructuralEquatable.Equals #91457

@skyoxZ

Description

@skyoxZ

Description

Some ValueTuples' IStructuralEquatable.Equals methods skip comparing Item4.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions