X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FTest%2FSystem%2FTypeTest.cs;h=9cc8ca79a413f707d27ad210899583c3fdb03456;hb=3e6c4f526499a339783cbe427e9916bbd99d7a0e;hp=4676c8551e8f574d360c72f125a7dee0aa0b122b;hpb=d231b5134decb9f2303be441a119ca552b51d0e1;p=mono.git diff --git a/mcs/class/corlib/Test/System/TypeTest.cs b/mcs/class/corlib/Test/System/TypeTest.cs index 4676c8551e8..9cc8ca79a41 100644 --- a/mcs/class/corlib/Test/System/TypeTest.cs +++ b/mcs/class/corlib/Test/System/TypeTest.cs @@ -3068,6 +3068,14 @@ namespace MonoTests.System object o = Array.CreateInstance (typeof (global::System.TypedReference), 1); } + [Test] + public void MakeArrayTypeLargeRank () + { + Assert.Throws (delegate () { + typeof (int).MakeArrayType (33); + }); + } + [ComVisible (true)] public class ComFoo { } @@ -3263,6 +3271,38 @@ namespace MonoTests.System Assert.AreSame (expectedType, r, "#2"); } + public class BConstrained where Y : BConstrained { + } + + public class AConstrained : BConstrained> { + } + + [Test] // Bug https://bugzilla.xamarin.com/show_bug.cgi?id=54485 + public void MakeGenericType_GTD_Constraint () + { + // This is pretty weird, but match .NET behavior (note + // that typeof(BConstrained>) is a + // compile-time error with roslyn, but it's apparently + // an ok thing to make with reflection. + var tb = typeof (BConstrained<>); + var ta = typeof (AConstrained<>); + var result = tb.MakeGenericType (ta); + Assert.IsNotNull (result, "#1"); + // lock down the answer to match what .NET makes + Assert.IsTrue (result.IsGenericType, "#2"); + Assert.AreEqual (tb, result.GetGenericTypeDefinition (), "#3"); + var bargs = result.GetGenericArguments (); + Assert.AreEqual (1, bargs.Length, "#4"); + var arg = bargs [0]; + Assert.IsTrue (arg.IsGenericType, "#5"); + // N.B. evidently AConstrained`1 and AConstrained`1 are the same type + Assert.IsTrue (arg.IsGenericTypeDefinition, "#6"); + Assert.AreEqual (ta, arg.GetGenericTypeDefinition (), "#7"); + var aargs = arg.GetGenericArguments (); + Assert.AreEqual (1, aargs.Length, "#8"); + Assert.AreEqual (ta.GetGenericArguments () [0], aargs [0], "#9"); + } + [Test] public void EqualsUserType () { UserType2 t1 = new UserType2(null); @@ -4289,7 +4329,7 @@ namespace MonoTests.System } -#if !MONOTOUCH && !FULL_AOT_RUNTIME +#if !MONOTOUCH && !FULL_AOT_RUNTIME && !MONOMAC [Test] [Category ("AndroidNotWorking")] // requires symbol writer public void FullNameGetTypeParseEscapeRoundtrip () // bug #26384 @@ -4297,7 +4337,7 @@ namespace MonoTests.System var nm = new AssemblyName ("asm"); var ab = AssemblyBuilder.DefineDynamicAssembly (nm, AssemblyBuilderAccess.Run); - var mb = ab.DefineDynamicModule("m", true); + var mb = ab.DefineDynamicModule("m", false); var tb = mb.DefineType ("NameSpace,+*&[]\\.Type,+*&[]\\", TypeAttributes.Class | TypeAttributes.Public);