C#: Add viable callable test cases for statics in interfaces.

This commit is contained in:
Michael Nebel
2023-02-15 14:14:54 +01:00
parent ab58d4c11f
commit cfe2a76431

View File

@@ -503,4 +503,75 @@ class C19
// Viable callables: C19.op_CheckedExplicit()
var n2 = checked((int)c);
}
}
}
public interface I3<T> where T : I3<T>
{
static abstract T operator +(T x, T y);
static abstract T operator checked +(T x, T y);
static abstract T operator -(T x, T y);
static virtual T operator checked -(T x, T y) => throw null;
static virtual T operator *(T x, T y) => throw null;
static virtual T operator checked *(T x, T y) => throw null;
static virtual T operator /(T x, T y) => throw null;
static virtual T operator checked /(T x, T y) => throw null;
void M11();
virtual void M12() => throw null;
virtual void M13() => throw null;
}
public class C20 : I3<C20>
{
public static C20 operator +(C20 x, C20 y) => throw null;
public static C20 operator checked +(C20 x, C20 y) => throw null;
public static C20 operator -(C20 x, C20 y) => throw null;
public static C20 operator /(C20 x, C20 y) => throw null;
public static C20 operator checked /(C20 x, C20 y) => throw null;
public void M11() { }
public void M12() { }
void Run<T>(T c) where T : I3<T>
{
// Viable callables: C20.op_Addition(). MISSING: C20.op_Addition()
var c1 = c + c;
// Viable callables: C20.op_CheckedAddition(). MISSING: C20.op_CheckedAddition()
var c2 = checked(c + c);
// Viable callables: C20.op_Subtraction(). Missing: C20.op_Subtraction()
var c3 = c - c;
// Viable callables: I3<C20>.op_CheckedSubtraction().
var c4 = checked(c - c);
// Viable callables: I3<C20>.op_Multiply().
var c5 = c * c;
// Viable callables: I3<C20>.op_CheckedMultiply().
var c6 = checked(c * c);
// Viable callables: {C20,I3<C20>}.op_Division(). MISSING: C20.op_Division()
var c7 = c / c;
// Viable callables: {C20,I3<C20>}.op_CheckedDivision(). MISSING: C20.op_CheckedDivision()
var c8 = checked(c / c);
// Viable callables: C20.M11. MISSING: C20.M11()
c.M11();
// Viable callables: {C20,I3<C20>}.M12(). MISSING: C20.M12()
c.M12();
// Viable callables: I3<C20>.M13()
c.M13();
}
}