[Mono-bugs] [Bug 396530] New: incorrect CS0029 for some combination of lambda expression and generic delegate
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Jun 2 16:41:53 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=396530
User atsushi at ximian.com 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: mono-bugs at lists.ximian.com
ReportedBy: atsushi at ximian.com
QAContact: mono-bugs at lists.ximian.com
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.
More information about the mono-bugs
mailing list