#pragma warning disable 168 using System; using System.Collections; namespace System { extension Array1 { public static Self operator+(Self lhs, Self rhs) where T : IDisposable { return lhs; } } } namespace IDETest { class Generics { public void Method1(T val) where T : Array { } public void Method2(T val, T2 val2) { Method1(val2); //FAIL 'T', declared to be 'T2' } public void Method3(ref TFoo[] val) { var res = val + val; //FAIL } public void Method4(ref TFoo[] val) where TFoo : IDisposable { var res = val + val; } interface IFaceA { public void MethodA(T val, M1 val2, delegate T (M1 arg) val3); } class ClassA : IFaceA<(T1, T2)> //FAIL 'IDETest.Generics.ClassA' does not implement interface member 'IDETest.Generics.IFaceA<(T1, T2)>.MethodA((T1, T2) val, M1 val2, delegate (T1, T2)(M1 arg) val3)' { void MethodA(int a) { } void MethodB() { function void() f = => MethodA; //FAIL Method 'void IDETest.Generics.ClassA.MethodA(int a)' does not match function 'function void()' } } static void Method5() where A : IEnumerable { } static void Method6() { Method5(); //FAIL Generic argument 'A', declared to be 'E' for 'IDETest.Generics.Method5()', must implement 'System.Collections.IEnumerable' } interface IFaceB { void MethodA0(); } extension IFaceB { void MethodA1(); } class ClassB : IFaceB //FAIL 'IDETest.Generics.ClassB' does not implement interface member 'IDETest.Generics.IFaceB.MethodA0()' { } extension ClassB { } public static void TestGen(T val) where T : IEnumerator where TItem : var { Console.WriteLine(typeof(decltype(val)).ToString(.. scope .())); } public static void TestPreGen() { T a = default; TestGen(a); //FAIL Unable to determine generic argument 'TItem' } static void Method7() where T : var where comptype(typeof(T)) : class { } public static void TestGenBug() { TestPreGen>(); Method7(); //FAIL The type 'int' must be a reference type in order to use it as parameter 'comptype(typeof(T))' for 'IDETest.Generics.Method7()' } public static void CircDepMethod() where T : T2 where T2 : T //FAIL { } class CircDep where T : T //FAIL { } public class TestExt where T : struct { public struct InnerA { } public struct InnerB where T2 : struct { } } extension TestExt where T : Int { public int a = 0; public struct InnerC { } } static void TestExtMethod() { TestExt.InnerA a; //FAIL TestExt.InnerB b; //FAIL TestExt.InnerB c; TestExt.InnerC d; TestExt.InnerC e; //FAIL } } } namespace System.Collections { extension List //FAIL where T : T { } }