https://bugzilla.novell.com/show_bug.cgi?id=635720
https://bugzilla.novell.com/show_bug.cgi?id=635720#c0 Summary: gmcs fails to compile nested classes with generics Classification: Mono Product: Mono: Compilers Version: 2.6.x Platform: x86 OS/Version: Windows 7 Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 using System; using System.Collections.Generic; namespace ConsoleApplication1 { static class Program { static void Main(string[] args) { // // NOTE: This code probably doesn't really matter. // Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("foo", "foo"); dictionary.Add("bar", "bar"); Console.WriteLine(OuterGeneric<string>.Equals("test", "test")); Console.WriteLine(Nothing1.InnerGeneric<string>.Equals("test", "test")); string key = null; if (OuterGeneric<string, string>.TryGetKeyAtIndex(dictionary, 0, ref key)) Console.WriteLine(key); if (Nothing2.InnerGeneric<string, string>.TryGetKeyAtIndex(dictionary, 0, ref key)) Console.WriteLine(key); Console.ReadKey(); } } /////////////////////////////////////////////////////////////////////////// public static class OuterGeneric<T> { public static bool Equals( T x, T y ) { if ((x != null) && (y != null)) return x.Equals(y); else return (x == null) && (y == null); } } /////////////////////////////////////////////////////////////////////////// public static class OuterGeneric<T1, T2> { public static bool TryGetKeyAtIndex( IDictionary<T1, T2> dictionary, int index, ref T1 key ) { bool result = false; if (dictionary != null) { List<T1> keys = new List<T1>(dictionary.Keys); if (keys != null) { if ((index >= 0) && (index < keys.Count)) { key = keys[index]; result = true; } } } return result; } } /////////////////////////////////////////////////////////////////////////// public static class Nothing1 { public static class InnerGeneric<T> { public static bool Equals( T x, T y ) { if ((x != null) && (y != null)) return x.Equals(y); else return (x == null) && (y == null); } } } /////////////////////////////////////////////////////////////////////////// public static class Nothing2 { public static class InnerGeneric<T1, T2> { public static bool TryGetKeyAtIndex( IDictionary<T1, T2> dictionary, int index, ref T1 key ) { bool result = false; if (dictionary != null) { List<T1> keys = new List<T1>(dictionary.Keys); if (keys != null) { if ((index >= 0) && (index < keys.Count)) { key = keys[index]; result = true; } } } return result; } } } } // end of file Reproducible: Always Steps to Reproduce: 1. Compile and run the code above. 2. The code fails to compile with an error message. Actual Results: Fails to compile the code producing the following error messages: Program.cs(27,55): error CS1502: The best overloaded method match for `ConsoleApplication1.Nothing2.InnerGeneric<T1,T2>.TryGetKeyAtIndex(System.Collections.Generic.IDictionary<T1,T2>, int, ref T1)' has some invalid arguments Program.cs(105,32): (Location of the symbol related to previous error) Program.cs(27,55): error CS1503: Argument `#1' cannot convert `System.Collections.Generic.Dictionary<string,string>' expression to type `System.Collections.Generic.IDictionary<T1,T2>' Compilation failed: 2 error(s), 0 warnings Expected Results: The code should successfully compile and when run output the following: True True foo foo -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
