[Mono-bugs] [Bug 507473] Generic type variance problems

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jun 2 10:12:06 EDT 2009


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

User msafar at novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=507473#c1





--- Comment #1 from Marek Safar <msafar at novell.com>  2009-06-02 08:12:05 MDT ---
Test #2

using System;

interface IIn<in T>
{
}

interface IOut<out T>
{
}

class A<T> : IIn<T>, IOut<T>
{
}

class C
{
    public static int Main ()
    {
        IIn<string> a_string = new A<string> ();
        IIn<object> a_object = new A<object> ();

        Console.WriteLine (a_string is IIn<string>);
        Console.WriteLine (a_string is IIn<object>);
        Console.WriteLine (a_object is IIn<string>);
        Console.WriteLine (a_object is IIn<object>);

        IOut<string> b_string = new A<string> ();
        IOut<object> b_object = new A<object> ();

        Console.WriteLine (b_string is IOut<string>);
        Console.WriteLine (b_string is IOut<object>);
        Console.WriteLine (b_object is IOut<string>);
        Console.WriteLine (b_object is IOut<object>);

        return 0;
    }
}

Expected:

True
False
True
True
True
True
False
True

Actual:

True
False
False
True
True
False
False
True

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list