PATCH: mcs: better type matching for anonymous methods
2008-02-01 00:58:24 GMT
Hi. The attached patch to mcs seems to fix bug 357047 (which I also
filed). The issue is that the compiler can't tell that:
enumerable.Average(o => op on o that returns a double);
or
enumerable.Average(delegate(T o) { return (op on o that returns a
double); });
Means Average<T>(IEnumerable<T>,Func<T,double>) or
Average<T>(IEnumerable<T>,Func<T,double?>). This means that you get an
error that the method call is ambiguous.
The patch works by inferring the return type of the argument, then
testing if that return value is an exact match for the return value of
the Func parameter. If so, it breaks ties with the exact match.
This is the first hacking I've done on mcs, so I'm not sure about how
correct this is. Comments are welcome.
Thanks.
_______________________________________________ Mono-devel-list mailing list Mono-devel-list <at> lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
RSS Feed