-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.
Milestone
Description
Description
Given two methods with identical code and a single type parameter T; and, given different type constraints, a false S4144 (“Update this method so that its implementation is not identical to …”) message is generated.
Repro steps
public static class TypeConstraints
{
public static int Use<T>(T? value) where T : struct => 1;
public static int Use<T>(T? value) where T : class => 2;
public static void First<T>(T? value) where T : struct // Secondary
{
var x = Use(value);
Console.WriteLine(x);
}
public static void Second<T>(T? value) where T : class // Noncompliant
{
var x = Use(value);
Console.WriteLine(x);
}
}Expected behavior
We should not raise any issues here. A different overload is used due to the type constraints.
Actual behavior
An issue is raised. See the code snippet.
Related information
- C#/VB.NET Plugins version: 8.55
Metadata
Metadata
Assignees
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.