This issue is found because I try to make things like:
#if ECHOES
public __mapped struct gint => int {
}
#elif COOPER || NOUGAT
public __mapped class gint => int? {
}
#endif
So I can use gint
to implement generic interface/delegate with a clean code:
public interface ITestInterface<T>{
T get();
}
public class TestClass : ITestInterface<gint>{
public gint get() => 5;
}
Otherwise, cross-platform code will be terrible:
public class TestClass : ITestInterface<int>{
#if ECHOES
public int get() => 5;
#else
public int? get() => 5;
#endif
}
Another example:
public class List<T> {
public delegate int Comparer<T>(T a, T b);
public void sort(Comparer<T> comparer) {
// ...
}
}
public static class ListComparer {
// Without gint
#if ECHOES
public static int intDescent(int a, int b) {
#else
public static int intDescent(int? a, int? b) {
#endif
return b - a;
}
// With gint
public static int intDescent(gint a, gint b) {
return b - a;
}
}
public class TestCode {
public void test() {
var list = new List<int>();
list.sort(ListComparer.intDescent);
}
}