[Mono-bugs] [Bug 357047] New: Invalid ambiguous method error with extension methods
    bugzilla_noreply at novell.com 
    bugzilla_noreply at novell.com
       
    Tue Jan 29 14:25:41 EST 2008
    
    
  
https://bugzilla.novell.com/show_bug.cgi?id=357047
           Summary: Invalid ambiguous method error with extension methods
           Product: Mono: Compilers
           Version: SVN
          Platform: i686
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cmarshall at pacificbiosciences.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
Created an attachment (id=192207)
 --> (https://bugzilla.novell.com/attachment.cgi?id=192207)
Test case.
gmcs seems to have trouble inferring the type of the function passed to an
extension method, whether it's a lambda expression or a plain anonymous
function. From my reading, the type of the function should be inferable by the
return value.
The attached test case illustrates what's going on.
Steps to reproduce:
$ gmcs -target:library -out:test.dll test.cs
Expected results:
Compilation succeeds.
Actual results:
Compilation fails with:
test.cs(27,19): error CS0121: The call is ambiguous between the following
methods or properties:
`System.Linq.Enumerable.Average<point>(System.Collections.Generic.IEnumerable<point>,
System.Func<point,double>)' and
`System.Linq.Enumerable.Average<point>(System.Collections.Generic.IEnumerable<point>,
System.Func<point,double?>)'
/opt/mono/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
(Location of the symbol related to previous error)
/opt/mono/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
(Location of the symbol related to previous error)
test.cs(27,5): error CS0266: Cannot implicitly convert type `double?' to
`double'. An explicit conversion exists (are you missing a cast?)
test.cs(38,19): error CS0121: The call is ambiguous between the following
methods or properties:
`System.Linq.Enumerable.Average<point>(System.Collections.Generic.IEnumerable<point>,
System.Func<point,double>)' and
`System.Linq.Enumerable.Average<point>(System.Collections.Generic.IEnumerable<point>,
System.Func<point,double?>)'
/opt/mono/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
(Location of the symbol related to previous error)
/opt/mono/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
(Location of the symbol related to previous error)
test.cs(38,5): error CS0266: Cannot implicitly convert type `double?' to
`double'. An explicit conversion exists (are you missing a cast?)
Compilation failed: 4 error(s), 0 warnings
-- 
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