[Mono-bugs] [Bug 689593] New: Generic type does not get inferred correctly with anonymous method

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 25 09:32:44 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=689593

https://bugzilla.novell.com/show_bug.cgi?id=689593#c0


           Summary: Generic type does not get inferred correctly with
                    anonymous method
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.10.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: b.vries at afas.nl
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)

The following code correctly compiles under MS .NET 4.0, but fails under mono
2.10.1. 

class MainClass
{
    public static void Main (string[] args)
    {
        var x = WaitForItems((i) => i.GetItems());
    }

    private static T[] WaitForItems<T>(Func<IService, T[]> query)
    {
        return null;
    }

}

interface IService
{
    string[] GetItems();
}

Reproducible: Always

Steps to Reproduce:
Compile the code mentioned in the details.
Actual Results:  
C:\Users\bvr\Documents\Projects\Repro\Repro\Main.cs(21,21): Error CS0411: The
type arguments for method
`Repro.MainClass.WaitForItems<T>(System.Func<Repro.IService,T[]>)' cannot be
inferred from the usage. Try specifying the type arguments explicitly (CS0411)
(Repro)

Expected Results:  
Compile successfully.

Monodevelop correctly detects that the type could be inferred.

-- 
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