Unexpected error for a user-defined conditional logical operator resolution due to nullable annotations
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
```
public class Program
{
static void Main()
{
var x2 = new C1();
var y2 = new C1();
// error CS0217: In order to be applicable as a short circuit operator a user-defined logical operator
// ('C1.operator &(C1, C1)')
// must have the same return type and parameter types
_ = x2 && y2;
}
}
class C1 where T : class
{
public static C1 operator &(C1 x, C1 y) => x;
public static bool operator true(C1 x) => true;
public static bool operator false(C1 x) => false;
}
```
Observed: error CS0217: In order to be applicable as a short circuit operator a user-defined logical operator ('C1.operator &(C1, C1)') must have the same return type and parameter types
Contributor guide
Assessment
This issue has not been assessed yet.