Bugzilla – Bug 318772
[GMCS] gmcs incorrectly chooses non-generic GetEnumerator () method
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by vargaz@gmail.com 2005-08-19 11:45:12 MST ---- Test case: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< using System; using System.Threading; using System.Collections; using System.Collections.Generic; public class Dict : Dictionary <object, object> { } public class Foo { public static void Main () { IDictionary<object, object> dict = new Dict (); dict.Add (new Object (), new Object ()); foreach (object kv in dict) Console.WriteLine (kv.GetType ()); } } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< When compiling this with gmcs, it prints: System.Collections.DictionaryEntry When compiling it with csc, it prints: System.Collections.Generic.KeyValuePair`2 This is because gmcs generates a call to : callvirt instance class[mscorlib]System.Collections.IEnumerator class [mscorlib]System.Collections.IEnumerable::GetEnumerator() while csc generates a call to the generic GetEnumerator () method. ---- Additional Comments From vargaz@gmail.com 2005-08-19 18:25:33 MST ---- This prevents IronPython-0.9 from working on mono. ---- Additional Comments From miguel@ximian.com 2005-08-23 22:08:11 MST ---- Another important one ---- Additional Comments From atsushi@ximian.com 2005-08-30 15:19:36 MST ---- Created an attachment (id=168386) proposed fix ---- Additional Comments From martin@ximian.com 2005-08-30 15:36:39 MST ---- I already had a short look at this on Friday and this is most likely NOTABUG - so let's wait with any gmcs patches until I get to work tomorrow. ---- Additional Comments From martin@ximian.com 2005-08-31 05:32:46 MST ---- Stupid bugzilla ---- Additional Comments From martin@ximian.com 2005-08-31 07:36:59 MST ---- It's a different issue this time, patch looks fine. ---- Additional Comments From martin@ximian.com 2005-08-31 08:17:34 MST ---- Fixed in SVN. Imported an attachment (id=168386) Unknown operating system unknown. Setting to default OS "Other".