https://bugzilla.novell.com/show_bug.cgi?id=396530
User [EMAIL PROTECTED] added comment https://bugzilla.novell.com/show_bug.cgi?id=396530#c392448 Summary: incorrect CS0029 for some combination of lambda expression and generic delegate Product: Mono: Compilers Version: SVN Platform: i586 OS/Version: Windows Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] QAContact: [email protected] Found By: Community of Practice The following code does not compile due to some problem around lambda expression and generic delegate: -------- using System; static class Test { public static void Foo<T1, T2, TResult>( T1 arg1, T2 arg2, Func<T1, T2, TResult> func) { Bar(arg1, arg2, (a, b, _) => func(a, b)); } public static void Bar<T1, T2, TResult>( T1 arg1, T2 arg2, Func<T1, T2, int, TResult> func) { } public static void Main(string[] args) { } } -------- Actual result: $ gmcs nyaruru2.cs nyaruru2.cs(8,38): error CS0029: Cannot implicitly convert type `TResult' to `TR esult' nyaruru2.cs(8,38): The generic parameter `TResult' of `Test.Foo<T1,T2,TResult>(T1, T2, System.Func<T1,T2,TResult>)' cannot be converted to the generic parameter `TResult' of `Test.<>c__CompilerGenerated0<T1,T2,TResult>' (in the previous error) nyaruru2.cs(8,38): error CS1662: Cannot convert `lambda expression' to delegate type `System.Func<T1,T2,int,TResult>' because some of the return types in the block are not implicitly convertible to the delegate return type Compilation failed: 2 error(s), 0 warnings It may be the same reason for bug #392448 but I'm not sure. -- 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
