X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Ftests%2Fgtest-117.cs;h=1e07e91cf03d975e9db2706b6dcdef8d0b00dd39;hb=301984b6480590282620a6fbb17b13d9bbcac1e8;hp=71dc3b8cd3d9bdb0afa8de23b3580e065af5de89;hpb=a097b5471761180c4aae2dab224ed9caeeae3e86;p=mono.git diff --git a/mcs/tests/gtest-117.cs b/mcs/tests/gtest-117.cs index 71dc3b8cd3d..1e07e91cf03 100644 --- a/mcs/tests/gtest-117.cs +++ b/mcs/tests/gtest-117.cs @@ -1,3 +1,5 @@ +// Compiler options: -warnaserror + using System; public interface IFoo @@ -9,12 +11,76 @@ public class Foo { return x is IFoo; } + + public static bool Test () + { + T t = default (T); + return t is int; + } + + public static bool TestB () + { + T t = default (T); + return t is int?; + } +} + +class Y where T : struct +{ + public bool Foo () + { + object o = null; + return o is System.Nullable ; + } } class X { - static void Main () + public static bool TestA (object o) + { + return o is int?; + } + + public static bool TestB (T o) + { + return o is int[]; + } + + public static int TestC () { - Foo.Test (3); + int? i = null; + if (i is int) { + return (int) i; + } + + return 3; + } + + static int Main () + { + if (Foo.Test (3)) + return 1; + + if (!Foo.Test()) + return 2; + + // False expected int? != null + if (Foo.TestB()) + return 3; + + int? i = 0; + if (!TestA(i)) + return 4; + + int[] a = new int[0]; + if (!TestB(a)) + return 5; + + if (TestC () != 3) + return 6; + + Console.WriteLine ("OK"); + return 0; } } +