[Mono-bugs] [Bug 501052] New: Generic inheritance not recognised

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 5 11:48:38 EDT 2009


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


           Summary: Generic inheritance not recognised
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: lytico at users.sourceforge.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1)
Gecko/2008070208 Firefox/3.0.1

Trying to compile the following code fails with:

error CS0309: The type
`System.Collections.Generic.Dictionary<int,System.Collections.Generic.ICollection<int>>'
must be convertible to
`System.Collections.Generic.IDictionary<int,System.Collections.Generic.ICollection<V>>'
in order to use it as parameter `TDictionary' in the generic type or method
`Limada.MonoTests.Generics.MultiDictionary<K,V,TDictionary>'



Reproducible: Always

Steps to Reproduce:
Testcase:

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

namespace Limada.MonoTests.Generics {
    public class MultiDictionary<K, V, TDictionary>
        where TDictionary : IDictionary<K, ICollection<V>>
    { }

    [TestFixture]
    public class Test {
        [Test]
        public  void Main() {
            // this fails:
            var c = new MultiDictionary<int, int, Dictionary<int,
ICollection<int>>>();
    }

}



in ms-net, the code compiles fine.
in mono, ms-net-compiled code RUNS fine.

// this works:
            IDictionary<int, ICollection<int>> d =
                new Dictionary<int, ICollection<int>> ();

            Type expr_type = typeof(Dictionary<int, ICollection<int>>);
            Type target_type = typeof(IDictionary<int, ICollection<int>>);

            System.Console.Out.WriteLine(
                target_type.IsInterface.ToString() + 
                target_type.IsAssignableFrom (expr_type).ToString());

-- 
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