[Mono-bugs] [Bug 659536] New: The compiler fails to infer lambda array type

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 14 23:28:35 EST 2010


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

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


           Summary: The compiler fails to infer lambda array type
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: x86-64
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: p.bludov at wi2geo.ru
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:


Steps to reproduce the problem:
Compile this snippet:

using System;
using System.Linq.Expressions;

namespace MonoTest
{
    public static class InferArrayType
    {
        public static void foo(Func<Expression,bool>[] args)
        {
        }

        public static void bar(Action<Expression> seq, Func<Expression,bool>
action)
        {
            foo(new [] { p => { seq(p); return true; }, action }); // cannot
convert `object' expression to type `Func<Expression,bool>[]'

        }
    }
} 


Actual Results:
Compilation fails with
test.cs(14,25): error CS1503: Argument `#1' cannot convert `object' expression
to type `System.Func<System.Linq.Expressions.Expression,bool>[]'


Expected Results:
Compilation suceeded


Additional Information:
As a workaround, the type must be specified explicitly:

        public static void bar(Action<Expression> seq, Func<Expression,bool>
action)
        {
            foo(new Func<Expression,bool>[] { p => { seq(p); return true; },
action }); 

        }

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