-
-
Notifications
You must be signed in to change notification settings - Fork 277
Codefix for RCS1244 can change semantics of code #938
Copy link
Copy link
Closed
Labels
Description
Product and Version Used: Roslynator 4.1.1 (in VS 17.3)
Steps to Reproduce:
internal readonly struct C
{
public static implicit operator C(int i) => new C();
public static bool operator ==(C left, C right) => default;
public static bool operator !=(C left, C right) => default;
public override bool Equals(object? obj) => default;
public override int GetHashCode() => default;
void M()
{
_ = default(C) == 0; // Compares `C` and `C`
// ~~~ RCS1244: Simplify 'default' expression
}
}Actual Behavior:
The codefix removes the argument to the default operator, changing the semantics of the expression.
void M()
{
_ = default == 0; // Compares `int` and `int`
}Expected Behavior:
The codefix is not offered.
Reactions are currently unavailable