[Mono-bugs] [Bug 439125] CS0309 with generic methods where constraints have generic parameters

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 11 14:02:34 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=439125

User eugene.shalygin at gmail.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=439125#c2


Eugene Shalygin <eugene.shalygin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW
                 CC|                            |eugene.shalygin at gmail.com
      Info Provider|gael at fraiteur.net           |




--- Comment #2 from Eugene Shalygin <eugene.shalygin at gmail.com>  2009-03-11 12:02:33 MST ---
I guess that I'm able to provide required information.

Here is sample program:

using System;
namespace test
{
    interface I<T>
    {
        T Get();
    }

    class G<A,C>
        where C:struct, I<A>
    {

        public void M<CA>(G<A, CA> g)
            where CA:struct, I<A>
        {
        }
    }

    struct Iint1:I<int>
    {
        public int Get()
        {
            return 0;
        }
    }

    struct Iint2:I<int>
    {
        public int Get()
        {
            return 0;
        }
    }

    class MainClass
    {
        public static void Main (string[] args)
        {
            G<int, Iint1> gint1 = new G<int, Iint1>();
            G<int, Iint2> gint2 = new G<int, Iint2>();
            gint1.M<Iint2>(gint2);
        }
    }
}

compiler output:
/home/eugene/Projects/test/test/Main.cs(46,31): error CS0309: The type
`test.Iint2' must be convertible to `test.I<test.Iint2>' in order to use it as
parameter `CA' in the generic type or method `test.G<A,C>.M<CA>(test.G<A,CA>)'
/home/eugene/Projects/test/test/Main.cs(18,29): (Location of the symbol related
to previous error)
/home/eugene/Projects/test/test/Main.cs(32,16): (Location of the symbol related
to previous error)


$ mono --version
Mono JIT compiler version 2.2 (tarball Tue Jan 27 22:46:36 EET 2009)

$ uname -srmi
Linux 2.6.28-tuxonice-r4 x86_64 GenuineIntel

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


More information about the mono-bugs mailing list