[Mono-bugs] [Bug 355145] New: Type inference doesn't work with lambda expressions.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 21 14:02:44 EST 2008


           Summary: Type inference doesn't work with lambda expressions.
           Product: Mono: Compilers
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: jan.oravec at 6com.sk
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Hi Marek,

I know this is currently under heavy development, but this code can't compile
and compiler returns bogus errors (I am used to see NotImplementedException
when something is not implemented, so this is probably not a known bug):

using System;
using System.Linq;
using System.Linq.Expressions;

class M
  public static void Foo<T> (Expression<Func<T, T>> x)

  public static void Main ()
    Foo<int> ((i) => i);
//  test.cs(13,5): error CS0308: The non-generic method
`M.Foo<int>(System.Linq.Expressions.Expression<System.Func<int,int>>)' cannot
be used with the type arguments

    Foo ((int i) => i);
//  test.cs(16,5): error CS0411: The type arguments for method
`M.Foo<T>(System.Linq.Expressions.Expression<System.Func<T,T>>)' cannot be
inferred from the usage. Try specifying the type arguments explicitly

    Expression<Func<int, int>> func = (i) => i;
    Foo (func);
//  compiles fine

Configure bugmail: https://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