New tests.
authorMarek Safar <marek.safar@gmail.com>
Fri, 19 Sep 2008 15:22:30 +0000 (15:22 -0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 19 Sep 2008 15:22:30 +0000 (15:22 -0000)
svn path=/trunk/mcs/; revision=113535

mcs/tests/gtest-411.cs [new file with mode: 0755]
mcs/tests/gtest-412.cs [new file with mode: 0755]
mcs/tests/ver-il-gmcs.xml

diff --git a/mcs/tests/gtest-411.cs b/mcs/tests/gtest-411.cs
new file mode 100755 (executable)
index 0000000..d3927f3
--- /dev/null
@@ -0,0 +1,30 @@
+using System;
+
+static class Maybe
+{
+       public static Maybe<T> C<T> (T value)
+       {
+               return null;
+       }
+}
+
+sealed class Maybe<T>
+{
+       public Maybe (T value)
+       {
+       }
+}
+
+static class Extensions {
+       public static R Match<T,R>(this T self, params Func<T,Maybe<R>>[] matchers)
+       {
+               return default (R);
+       }
+}
+
+class Test {
+       public static void Main ()
+       {
+               Extensions.Match ("a", s => Maybe.C(s));
+       }
+}
diff --git a/mcs/tests/gtest-412.cs b/mcs/tests/gtest-412.cs
new file mode 100755 (executable)
index 0000000..50d9c25
--- /dev/null
@@ -0,0 +1,42 @@
+using System;
+using System.Reflection;
+
+class Program
+{
+       static int Main ()
+       {
+               Type type = typeof (Foo<>);
+               Type [] gargs = type.GetGenericArguments ();
+               if (gargs == null || gargs.Length != 1) {
+                       Console.WriteLine ("#1");
+                       return 1;
+               }
+
+               Type garg = gargs [0];
+               Type [] csts = garg.GetGenericParameterConstraints ();
+
+               if (garg.Name != "T") {
+                       Console.WriteLine ("#2: " + garg.Name);
+                       return 2;
+               }
+               if (garg.GenericParameterAttributes !=
+                       (GenericParameterAttributes.DefaultConstructorConstraint | GenericParameterAttributes.NotNullableValueTypeConstraint)) {
+                       Console.WriteLine ("#3: " + garg.GenericParameterAttributes);
+                       return 3;
+               }
+               if (csts == null || csts.Length != 1) {
+                       Console.WriteLine ("#4");
+                       return 4;
+               }
+               if (csts [0] != typeof (ValueType)) {
+                       Console.WriteLine ("#5: " + csts [0].FullName);
+                       return 5;
+               }
+
+               return 0;
+       }
+}
+
+struct Foo<T> where T : struct
+{
+}
index b5dc327b2d221bd017020b0aa3313853bc18f13f..f520c9f37948764b1ccceec69845b9aeafbc115a 100644 (file)
       </method>
     </type>
   </test>
+  <test name="gtest-411.cs">
+    <type name="Maybe">
+      <method name="Maybe`1[T] C[T](T)">
+        <size>2</size>
+      </method>
+    </type>
+    <type name="Maybe`1[T]">
+      <method name="Void .ctor(T)">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Extensions">
+      <method name="R Match[T,R](T, System.Func`2[T,Maybe`1[R]][])">
+        <size>10</size>
+      </method>
+    </type>
+    <type name="Test">
+      <method name="Void .ctor()">
+        <size>7</size>
+      </method>
+      <method name="Void Main()">
+        <size>50</size>
+      </method>
+      <method name="Maybe`1[System.String] &lt;Main&gt;m__0(System.String)">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="gtest-412.cs">
+    <type name="Program">
+      <method name="Void .ctor()">
+        <size>7</size>
+      </method>
+      <method name="Int32 Main()">
+        <size>213</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-anon-1.cs">
     <type name="X">
       <method name="Void .ctor()">