[Mono-dev] Mono 2.8 regression

Federico Di Gregorio fog at initd.org
Mon Dec 20 04:01:30 EST 2010


Hi *,

I guess it's my fault, not Mono's, but some code that compiled well on
2.6 doesn't work anymore on 2.8. I suppose this is somewhat related to
covariance/contravariance of delegates but I'd like to have someone tell
me «Eck! Whay did you do that? That's wrong!». Here is the error:

test.cs(15,16): error CS0030: Cannot convert type
`System.Func<string,int,T>' to `System.Func<string,int,S>'

And here is the code:

using System;
using System.Collections.Generic;

public abstract class A
{
    public abstract Func<string,int,T> GetXXX<T>();
}

public class C<T> : A
{
    Func<string,int,T> xxx;

    public override Func<string,int,S> GetXXX<S>()
    {
        return (Func<string,int,S>)xxx;
    }
}

-- 
Federico Di Gregorio                                       fog at initd.org
 To prepare such test data, I get into the meaniest, nastiest frame of
  mind that I can manage, and I write the cruelest code I can think of;
  then I turn around and I embed that in even nastier constructions
  that are almost obscene.                                  -- D.E.Knuth


More information about the Mono-devel-list mailing list