[mono/mono] [3 commits] f4aa1c41: Add new tests

"Marek Safar ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141ef298d82-2698ad21-4d75-455b-90b5-583260db8ee4-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/913a2d5fbd78...707d91400710

   Commit: f4aa1c4149c83106075871486ac6eaebdeba6177
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-25 08:42:57 GMT
      URL: https://github.com/mono/mono/commit/f4aa1c4149c83106075871486ac6eaebdeba6177

Add new tests

Added paths:
  A mcs/tests/gtest-iter-32.cs
  A mcs/tests/gtest-iter-33.cs
  A mcs/tests/test-873.cs
Removed paths:
  D mcs/tests/gtest-381.cs
  D mcs/tests/gtest-217.cs

Renamed: mcs/tests/gtest-iter-32.cs
===================================================================


Renamed: mcs/tests/gtest-iter-33.cs
===================================================================


Added: mcs/tests/test-873.cs
===================================================================
@@ -0,0 +1,28 @@
+using System;
+
+class Program
+{
+	static int Main ()
+	{
+		int foo = 9;
+
+		switch (foo) {
+		case 1:
+			gotoTarget: 
+			{
+				return 0;
+			}
+		default:
+			{
+				if (foo != 0) {
+					goto gotoTarget;
+				}
+
+				break;
+			}
+		}
+
+		return 1;
+	}
+}
+

   Commit: fcad876ef1cf57a0b8b066a2b5080885e32e8fa2
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-25 09:59:53 GMT
      URL: https://github.com/mono/mono/commit/fcad876ef1cf57a0b8b066a2b5080885e32e8fa2

When looking for base implementation of generic MVAR methods use non-inflated parameter types. Fixes #15523

Changed paths:
  M mcs/mcs/ecore.cs
  M mcs/mcs/generic.cs
Added paths:
  A mcs/tests/gtest-598.cs
  A mcs/tests/gtest-599.cs

Modified: mcs/mcs/ecore.cs
===================================================================
@@ -3002,7 +3002,21 @@ protected MethodSpec CandidateToBaseOverride (ResolveContext rc, MethodSpec meth
 				//
 				TypeSpec[] targs = null;
 				if (method.DeclaringType != InstanceExpression.Type) {
-					var base_override = MemberCache.FindMember (InstanceExpression.Type, new MemberFilter (method), BindingRestriction.InstanceOnly | BindingRestriction.OverrideOnly) as MethodSpec;
+					//
+					// Candidate can have inflated MVAR parameters and we need to find
+					// base match for original definition not inflated parameter types
+					//
+					var parameters = method.Parameters;
+					if (method.Arity > 0) {
+						parameters = ((IParametersMember) method.MemberDefinition).Parameters;
+						var inflated = method.DeclaringType as InflatedTypeSpec;
+						if (inflated != null) {
+							parameters = parameters.Inflate (inflated.CreateLocalInflator (rc));
+						}
+					}
+
+					var filter = new MemberFilter (method.Name, method.Arity, MemberKind.Method, parameters, null);
+					var base_override = MemberCache.FindMember (InstanceExpression.Type, filter, BindingRestriction.InstanceOnly | BindingRestriction.OverrideOnly) as MethodSpec;
 					if (base_override != null && base_override.DeclaringType != method.DeclaringType) {
 						if (base_override.IsGeneric)
 							targs = method.TypeArguments;
@@ -3046,6 +3060,7 @@ protected MethodSpec CandidateToBaseOverride (ResolveContext rc, MethodSpec meth
 			// Only base will allow this invocation to happen.
 			//
 			if (method.IsAbstract) {
+				rc.Report.SymbolRelatedToPreviousError (method);
 				Error_CannotCallAbstractBase (rc, method.GetSignatureForError ());
 			}
 

Modified: mcs/mcs/generic.cs
===================================================================
@@ -1787,7 +1787,7 @@ public static bool ContainsTypeParameter (TypeSpec type)
 			return false;
 		}
 
-		TypeParameterInflator CreateLocalInflator (IModuleContext context)
+		public TypeParameterInflator CreateLocalInflator (IModuleContext context)
 		{
 			TypeParameterSpec[] tparams_full;
 			TypeSpec[] targs_full = targs;

Added: mcs/tests/gtest-598.cs
===================================================================
@@ -0,0 +1,63 @@
+using System;
+
+public class A
+{
+	public virtual T Test<T> (T t)
+	{
+		throw new ApplicationException ();
+	}
+}
+
+public class B : A
+{
+	public override T Test<T> (T t)
+	{
+		Console.WriteLine ("Base");
+		return default (T);
+	}
+}
+
+public class C : B
+{
+	public override T Test<T> (T t)
+	{
+		base.Test ("a");
+		return default (T);
+	}
+}
+
+
+public class AG<U>
+{
+	public virtual T Test<T> (T t, U u)
+	{
+		throw new ApplicationException ();
+	}
+}
+
+public class B<UB> : AG<UB>
+{
+	public override T Test<T> (T t, UB u)
+	{
+		Console.WriteLine ("Base");
+		return default (T);
+	}
+}
+
+public class C<UC> : B<UC>
+{
+	public override T Test<T> (T t, UC u)
+	{
+		base.Test ("a", default (UC));
+		return default (T);
+	}
+}
+
+class X
+{
+	public static void Main ()
+	{
+		new C ().Test<int> (1);
+		new C<int> ().Test (5, 3);
+	}
+}
\ No newline at end of file

Added: mcs/tests/gtest-599.cs
===================================================================
@@ -0,0 +1,32 @@
+using System;
+
+public abstract class A<X>
+{
+	public abstract T Test<T> (T t, X x);
+}
+
+public class B : A<char>
+{
+	public override T Test<T> (T t, char x)
+	{
+		Console.WriteLine ("B");
+		return default (T);
+	}
+}
+
+public class C : B
+{
+	public override T Test<T> (T t, char c)
+	{
+		base.Test ("a", 'a');
+		return default (T);
+	}
+}
+
+class X
+{
+	public static void Main ()
+	{
+		new C ().Test<int> (1, '1');
+	}
+}
\ No newline at end of file

   Commit: 707d91400710b129a51c38154386e04047608714
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-25 10:25:49 GMT
      URL: https://github.com/mono/mono/commit/707d91400710b129a51c38154386e04047608714

Tests update

Changed paths:
  M mcs/tests/ver-il-net_4_5.xml

Modified: mcs/tests/ver-il-net_4_5.xml
===================================================================
@@ -9374,97 +9374,6 @@
       </method>
     </type>
   </test>
-  <test name="gtest-217.cs">
-    <type name="Fun`2[A1,R]">
-      <method name="R Invoke(A1)" attrs="454">
-        <size>0</size>
-      </method>
-      <method name="IAsyncResult BeginInvoke(A1, System.AsyncCallback, System.Object)" attrs="454">
-        <size>0</size>
-      </method>
-      <method name="R EndInvoke(IAsyncResult)" attrs="454">
-        <size>0</size>
-      </method>
-      <method name="Void .ctor(Object, IntPtr)" attrs="6278">
-        <size>0</size>
-      </method>
-    </type>
-    <type name="MyTest">
-      <method name="Void Main(System.String[])" attrs="150">
-        <size>99</size>
-      </method>
-      <method name="System.String &lt;Main&gt;m__0(Int32)" attrs="145">
-        <size>22</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-    </type>
-    <type name="MyTest+&lt;Map&gt;c__Iterator0`4[Aa,Af,Rf,Rr]">
-      <method name="Rr System.Collections.Generic.IEnumerator&lt;Rr&gt;.get_Current()" attrs="2529">
-        <size>14</size>
-      </method>
-      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
-        <size>19</size>
-      </method>
-      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
-        <size>14</size>
-      </method>
-      <method name="Boolean MoveNext()" attrs="486">
-        <size>215</size>
-      </method>
-      <method name="Void Dispose()" attrs="486">
-        <size>69</size>
-      </method>
-      <method name="Void Reset()" attrs="486">
-        <size>6</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-    </type>
-    <type name="MyTest+&lt;FromTo&gt;c__Iterator1">
-      <method name="Int32 System.Collections.Generic.IEnumerator&lt;int&gt;.get_Current()" attrs="2529">
-        <size>14</size>
-      </method>
-      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
-        <size>19</size>
-      </method>
-      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
-        <size>14</size>
-      </method>
-      <method name="Boolean MoveNext()" attrs="486">
-        <size>125</size>
-      </method>
-      <method name="Void Dispose()" attrs="486">
-        <size>15</size>
-      </method>
-      <method name="Void Reset()" attrs="486">
-        <size>6</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-    </type>
-    <type name="MyTest">
-      <method name="System.Collections.Generic.IEnumerable`1[Rr] Map[Aa,Af,Rf,Rr](Fun`2[Af,Rf], System.Collections.Generic.IEnumerable`1[Aa])" attrs="150">
-        <size>37</size>
-      </method>
-      <method name="System.Collections.Generic.IEnumerable`1[System.Int32] FromTo(Int32, Int32)" attrs="150">
-        <size>37</size>
-      </method>
-    </type>
-    <type name="MyTest+&lt;Map&gt;c__Iterator0`4[Aa,Af,Rf,Rr]">
-      <method name="System.Collections.Generic.IEnumerator`1[Rr] System.Collections.Generic.IEnumerable&lt;Rr&gt;.GetEnumerator()" attrs="481">
-        <size>52</size>
-      </method>
-    </type>
-    <type name="MyTest+&lt;FromTo&gt;c__Iterator1">
-      <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable&lt;int&gt;.GetEnumerator()" attrs="481">
-        <size>52</size>
-      </method>
-    </type>
-  </test>
   <test name="gtest-218.cs">
     <type name="Foo">
       <method name="Void .ctor()" attrs="6278">
@@ -13604,88 +13513,6 @@
       </method>
     </type>
   </test>
-  <test name="gtest-381.cs">
-    <type name="TestGoto">
-      <method name="Void Main(System.String[])" attrs="150">
-        <size>71</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-      <method name="Void .cctor()" attrs="6289">
-        <size>7</size>
-      </method>
-    </type>
-    <type name="TestGoto+&lt;setX&gt;c__Iterator0">
-      <method name="Boolean System.Collections.Generic.IEnumerator&lt;bool&gt;.get_Current()" attrs="2529">
-        <size>14</size>
-      </method>
-      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
-        <size>19</size>
-      </method>
-      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
-        <size>14</size>
-      </method>
-      <method name="Boolean MoveNext()" attrs="486">
-        <size>115</size>
-      </method>
-      <method name="Void Dispose()" attrs="486">
-        <size>53</size>
-      </method>
-      <method name="Void Reset()" attrs="486">
-        <size>6</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-    </type>
-    <type name="TestGoto+&lt;test&gt;c__Iterator1">
-      <method name="Boolean System.Collections.Generic.IEnumerator&lt;bool&gt;.get_Current()" attrs="2529">
-        <size>14</size>
-      </method>
-      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
-        <size>19</size>
-      </method>
-      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
-        <size>14</size>
-      </method>
-      <method name="Boolean MoveNext()" attrs="486">
-        <size>189</size>
-      </method>
-      <method name="Void Dispose()" attrs="486">
-        <size>69</size>
-      </method>
-      <method name="Void Reset()" attrs="486">
-        <size>6</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-    </type>
-    <type name="TestGoto+&lt;setX&gt;c__Iterator0">
-      <method name="Void &lt;&gt;__Finally0()" attrs="129">
-        <size>9</size>
-      </method>
-    </type>
-    <type name="TestGoto">
-      <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] setX()" attrs="145">
-        <size>23</size>
-      </method>
-      <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] test()" attrs="145">
-        <size>23</size>
-      </method>
-    </type>
-    <type name="TestGoto+&lt;setX&gt;c__Iterator0">
-      <method name="System.Collections.Generic.IEnumerator`1[System.Boolean] System.Collections.Generic.IEnumerable&lt;bool&gt;.GetEnumerator()" attrs="481">
-        <size>26</size>
-      </method>
-    </type>
-    <type name="TestGoto+&lt;test&gt;c__Iterator1">
-      <method name="System.Collections.Generic.IEnumerator`1[System.Boolean] System.Collections.Generic.IEnumerable&lt;bool&gt;.GetEnumerator()" attrs="481">
-        <size>26</size>
-      </method>
-    </type>
-  </test>
   <test name="gtest-382.cs">
     <type name="C">
       <method name="Int32 Main()" attrs="150">
@@ -18605,6 +18432,98 @@
       </method>
     </type>
   </test>
+  <test name="gtest-598.cs">
+    <type name="A">
+      <method name="T Test[T](T)" attrs="454">
+        <size>7</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="B">
+      <method name="T Test[T](T)" attrs="198">
+        <size>28</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="C">
+      <method name="T Test[T](T)" attrs="198">
+        <size>30</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="AG`1[U]">
+      <method name="T Test[T](T, U)" attrs="454">
+        <size>7</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="B`1[UB]">
+      <method name="T Test[T](T, UB)" attrs="198">
+        <size>28</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="C`1[UC]">
+      <method name="T Test[T](T, UC)" attrs="198">
+        <size>39</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>27</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="gtest-599.cs">
+    <type name="A`1[X]">
+      <method name="T Test[T](T, X)" attrs="1478">
+        <size>0</size>
+      </method>
+      <method name="Void .ctor()" attrs="6276">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="B">
+      <method name="T Test[T](T, Char)" attrs="198">
+        <size>28</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="C">
+      <method name="T Test[T](T, Char)" attrs="198">
+        <size>32</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>16</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-anontype-01.cs">
     <type name="Test">
       <method name="Int32 Main()" attrs="150">
@@ -24583,6 +24502,165 @@
       </method>
     </type>
   </test>
+  <test name="gtest-iter-32.cs">
+    <type name="TestGoto">
+      <method name="Void Main(System.String[])" attrs="150">
+        <size>71</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] setX()" attrs="145">
+        <size>23</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] test()" attrs="145">
+        <size>23</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+      <method name="Void .cctor()" attrs="6289">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="TestGoto+&lt;setX&gt;c__Iterator0">
+      <method name="Boolean System.Collections.Generic.IEnumerator&lt;bool&gt;.get_Current()" attrs="2529">
+        <size>14</size>
+      </method>
+      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+        <size>19</size>
+      </method>
+      <method name="Boolean MoveNext()" attrs="486">
+        <size>115</size>
+      </method>
+      <method name="Void Dispose()" attrs="486">
+        <size>53</size>
+      </method>
+      <method name="Void Reset()" attrs="486">
+        <size>6</size>
+      </method>
+      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+        <size>14</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerator`1[System.Boolean] System.Collections.Generic.IEnumerable&lt;bool&gt;.GetEnumerator()" attrs="481">
+        <size>26</size>
+      </method>
+      <method name="Void &lt;&gt;__Finally0()" attrs="129">
+        <size>9</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="TestGoto+&lt;test&gt;c__Iterator1">
+      <method name="Boolean System.Collections.Generic.IEnumerator&lt;bool&gt;.get_Current()" attrs="2529">
+        <size>14</size>
+      </method>
+      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+        <size>19</size>
+      </method>
+      <method name="Boolean MoveNext()" attrs="486">
+        <size>189</size>
+      </method>
+      <method name="Void Dispose()" attrs="486">
+        <size>69</size>
+      </method>
+      <method name="Void Reset()" attrs="486">
+        <size>6</size>
+      </method>
+      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+        <size>14</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerator`1[System.Boolean] System.Collections.Generic.IEnumerable&lt;bool&gt;.GetEnumerator()" attrs="481">
+        <size>26</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="gtest-iter-33.cs">
+    <type name="Fun`2[A1,R]">
+      <method name="R Invoke(A1)" attrs="454">
+        <size>0</size>
+      </method>
+      <method name="IAsyncResult BeginInvoke(A1, System.AsyncCallback, System.Object)" attrs="454">
+        <size>0</size>
+      </method>
+      <method name="R EndInvoke(IAsyncResult)" attrs="454">
+        <size>0</size>
+      </method>
+      <method name="Void .ctor(Object, IntPtr)" attrs="6278">
+        <size>0</size>
+      </method>
+    </type>
+    <type name="MyTest">
+      <method name="Void Main(System.String[])" attrs="150">
+        <size>99</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerable`1[Rr] Map[Aa,Af,Rf,Rr](Fun`2[Af,Rf], System.Collections.Generic.IEnumerable`1[Aa])" attrs="150">
+        <size>37</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerable`1[System.Int32] FromTo(Int32, Int32)" attrs="150">
+        <size>37</size>
+      </method>
+      <method name="System.String &lt;Main&gt;m__0(Int32)" attrs="145">
+        <size>22</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="MyTest+&lt;Map&gt;c__Iterator0`4[Aa,Af,Rf,Rr]">
+      <method name="Rr System.Collections.Generic.IEnumerator&lt;Rr&gt;.get_Current()" attrs="2529">
+        <size>14</size>
+      </method>
+      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+        <size>19</size>
+      </method>
+      <method name="Boolean MoveNext()" attrs="486">
+        <size>215</size>
+      </method>
+      <method name="Void Dispose()" attrs="486">
+        <size>69</size>
+      </method>
+      <method name="Void Reset()" attrs="486">
+        <size>6</size>
+      </method>
+      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+        <size>14</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerator`1[Rr] System.Collections.Generic.IEnumerable&lt;Rr&gt;.GetEnumerator()" attrs="481">
+        <size>52</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="MyTest+&lt;FromTo&gt;c__Iterator1">
+      <method name="Int32 System.Collections.Generic.IEnumerator&lt;int&gt;.get_Current()" attrs="2529">
+        <size>14</size>
+      </method>
+      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+        <size>19</size>
+      </method>
+      <method name="Boolean MoveNext()" attrs="486">
+        <size>125</size>
+      </method>
+      <method name="Void Dispose()" attrs="486">
+        <size>15</size>
+      </method>
+      <method name="Void Reset()" attrs="486">
+        <size>6</size>
+      </method>
+      <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+        <size>14</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable&lt;int&gt;.GetEnumerator()" attrs="481">
+        <size>52</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-lambda-01.cs">
     <type name="IntFunc">
       <method name="Int32 Invoke(Int32)" attrs="454">
@@ -48239,6 +48317,16 @@
       </method>
     </type>
   </test>
+  <test name="test-873.cs">
+    <type name="Program">
+      <method name="Int32 Main()" attrs="145">
+        <size>51</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-88.cs">
     <type name="X">
       <method name="Void f(System.String)" attrs="145">



_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.