Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;

#nullable enable

namespace Test
{
class TestClass1 : IEquatable<TestClass1>
{
private int field1;

public bool Equals(TestClass1? param1)
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object? param2)
{
return param2 is TestClass1 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}

class TestClass2 : IEquatable<TestClass2>
{
private int field1;

public bool Equals(TestClass2 param1)
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The null check param1 != null is ineffective because param1 is declared as non-nullable. With nullable reference types enabled, this parameter cannot be null under normal circumstances, making the null check unnecessary and potentially misleading.

Suggested change
public bool Equals(TestClass2 param1)
public bool Equals(TestClass2? param1)

Copilot uses AI. Check for mistakes.
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object? param2)
{
return param2 is TestClass2 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}

class TestClass3 : IEquatable<TestClass3>
{
private int field1;

public bool Equals(TestClass3? param1)
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object param2)
{
return param2 is TestClass3 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}

class TestClass4 : IEquatable<TestClass4>
{
private int field1;

public bool Equals(TestClass4 param1)
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object param2)
{
return param2 is TestClass4 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;

#nullable enable

namespace Test
{
class TestClass1 : IEquatable<TestClass1>
{
private int field1;

public bool Equals(TestClass1? param1)
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object? param2)
{
return param2 is TestClass1 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}

class TestClass2 : IEquatable<TestClass2>
{
private int field1;

public bool Equals(TestClass2 param1)
{
return param1 != null && field1 == param1.field1;
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The null check param1 != null is ineffective because param1 is declared as non-nullable. With nullable reference types enabled, this parameter cannot be null under normal circumstances, making the null check unnecessary and potentially misleading.

Suggested change
return param1 != null && field1 == param1.field1;
return field1 == param1.field1;

Copilot uses AI. Check for mistakes.
}

public override bool Equals(object? param2)
{
return param2 is TestClass2 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}

class TestClass3 : IEquatable<TestClass3>
{
private int field1;

public bool Equals(TestClass3? param1)
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object param2)
{
return param2 is TestClass3 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}

class TestClass4 : IEquatable<TestClass4>
{
private int field1;

public bool Equals(TestClass4 param1)
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The null check param1 != null is ineffective because param1 is declared as non-nullable. With nullable reference types enabled, this parameter cannot be null under normal circumstances, making the null check unnecessary and potentially misleading.

Suggested change
public bool Equals(TestClass4 param1)
public bool Equals(TestClass4? param1)

Copilot uses AI. Check for mistakes.
{
return param1 != null && field1 == param1.field1;
}

public override bool Equals(object param2)
{
return param2 is TestClass4 tc && Equals(tc);
}

public override int GetHashCode()
{
return field1;
}
}
}
Loading