[mono/mono] 4387da15: Better check for open generic types in probing expression. Fixes #15422

"Marek Safar ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141c282bbcb-0737815d-8ecf-42b7-8402-1394866be144-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/b055fa22dfaf...4387da152422

   Commit: 4387da15242255491f2f46099a6410b43e3487df
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-16 18:21:18 GMT
      URL: https://github.com/mono/mono/commit/4387da15242255491f2f46099a6410b43e3487df

Better check for open generic types in probing expression. Fixes #15422

Changed paths:
  M mcs/mcs/expression.cs
  M mcs/tests/gtest-579.cs
  M mcs/tests/ver-il-net_4_5.xml

Modified: mcs/mcs/expression.cs
===================================================================
@@ -1562,7 +1562,7 @@ protected override Expression DoResolve (ResolveContext ec)
 					//
 					// open generic type
 					//
-					if (d is InflatedTypeSpec && InflatedTypeSpec.ContainsTypeParameter (d))
+					if ((d is InflatedTypeSpec || d.IsArray) && InflatedTypeSpec.ContainsTypeParameter (d))
 						return this;
 				}
 			}

Modified: mcs/tests/gtest-579.cs
===================================================================
@@ -9,12 +9,23 @@ public class G<U, V> : IA<G<V, string>>
 
 public class C
 {
+	static bool Test_2 <T2>(T2[] t)
+	{
+		return t is byte[];
+	}
+
 	public static int Main ()
 	{
 		G<long, short> p = new G<long, short> ();
 		if (p is IA<G<string, string>>)
 			return 1;
 
+		if (Test_2 (new int [0]))
+			return 2;
+
+		if (!Test_2 (new byte [0]))
+			return 3;
+
 		return 0;
 	}
 }
\ No newline at end of file

Modified: mcs/tests/ver-il-net_4_5.xml
===================================================================
@@ -18202,11 +18202,14 @@
     </type>
     <type name="C">
       <method name="Int32 Main()" attrs="150">
-        <size>34</size>
+        <size>80</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
+      <method name="Boolean Test_2[T2](T2[])" attrs="145">
+        <size>18</size>
+      </method>
     </type>
   </test>
   <test name="gtest-580.cs">



_______________________________________________
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.