Bug 318772 (MONO75850) - [GMCS] gmcs incorrectly chooses non-generic GetEnumerator () method
Summary: [GMCS] gmcs incorrectly chooses non-generic GetEnumerator () method
Status: RESOLVED FIXED
Alias: MONO75850
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-19 18:45 UTC by Forgotten User vxPDddArjq
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
proposed fix (2.58 KB, patch)
2005-08-30 22:19 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:27:53 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".