[Mono-bugs] [Bug 567537] New: gmcs type compatibility error with generic type array and interface type argument

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 29 08:48:17 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=567537

http://bugzilla.novell.com/show_bug.cgi?id=567537#c0


           Summary: gmcs type compatibility error with generic type array
                    and interface type argument
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rodrigobamboo at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

gmcs fails to compile the following valid program:

    using System;
    using System.Collections.Generic;
    using NUnit.Framework;

    interface IFoo
    {
    }

    class ArrayEqualityComparer<T>: IEqualityComparer<T[]>
    {
        public bool Equals(T[] x, T[] y)
        {
            return false;
        }

        public int GetHashCode(T[] args)
        {
            return 0;
        }
    }

    public class Program
    {
        public static void Main(string[] args)
        {
            var d = new Dictionary<IFoo[], IFoo>(new
ArrayEqualityComparer<IFoo>());
        }
    }

gmcs says "gmcsequalitycomparerbug.cs(26,80): error CS1503: Argument `#1'
cannot convert `ArrayEqualityComparer<IFoo>' expression to type
`System.Collections.Generic.IEqualityComparer<IFoo[]>'" which is wrong for
ArrayEqualityComparer does implement IEqualityComparer<T[]>.

"mono --version" reports: Mono JIT compiler version 2.7 (/trunk/mono r148915
Mon Dec 28 15:29:31 BRST 2009)



Reproducible: Always

Steps to Reproduce:
Compile the source code provided in the details with gmcs.
Actual Results:  
gmcsequalitycomparerbug.cs(26,80): error CS1503: Argument `#1' cannot convert
`ArrayEqualityComparer<IFoo>' expression to type
`System.Collections.Generic.IEqualityComparer<IFoo[]>'

Expected Results:  
no errors

-- 
Configure bugmail: http://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.


More information about the mono-bugs mailing list