diff options
author | Marek Safar <marek.safar@gmail.com> | 2013-10-16 22:21:18 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2013-10-16 22:21:18 +0400 |
commit | 4387da15242255491f2f46099a6410b43e3487df (patch) | |
tree | c3fdc5cfda96676fd6fea7547b51dc83855f8a5f /mcs | |
parent | b055fa22dfaf8feb28c0ba4db9e5fb7c90b420b1 (diff) |
Better check for open generic types in probing expression. Fixes #15422
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/mcs/expression.cs | 2 | ||||
-rw-r--r-- | mcs/tests/gtest-579.cs | 11 | ||||
-rw-r--r-- | mcs/tests/ver-il-net_4_5.xml | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs index 790869c4cad..017af8618e3 100644 --- a/mcs/mcs/expression.cs +++ b/mcs/mcs/expression.cs @@ -1562,7 +1562,7 @@ namespace Mono.CSharp // // open generic type // - if (d is InflatedTypeSpec && InflatedTypeSpec.ContainsTypeParameter (d)) + if ((d is InflatedTypeSpec || d.IsArray) && InflatedTypeSpec.ContainsTypeParameter (d)) return this; } } diff --git a/mcs/tests/gtest-579.cs b/mcs/tests/gtest-579.cs index 9def4cd52c8..615312c36b2 100644 --- a/mcs/tests/gtest-579.cs +++ b/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 diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml index 44f9e2d9c27..dc38568b3f7 100644 --- a/mcs/tests/ver-il-net_4_5.xml +++ b/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">
|