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


           Summary: gmcs requires void-returning invocation in lambda
                    expression
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs@lists.ximian.com
        ReportedBy: [EMAIL PROTECTED]
         QAContact: mono-bugs@lists.ximian.com
          Found By: ---


I can't think up a better summary. This code fails to compile:

>>>>
using System;
using System.Collections;
using System.Collections.Generic;

public static class ext
{
        static public void Apply<T>(IEnumerable<T> a, Action<T> fn)
        {
                foreach (T ai in a)
                        fn(ai);
        }
}

public class action
{
        public static void Main(string[] argv)
        {
                ArrayList list = new ArrayList();
                ext.Apply(argv, str => list.Add(str));
        }
}
<<<<

Failing with:

action.cs(19,21): error CS1502: The best overloaded method match for
`ext.Apply<string>(System.Collections.Generic.IEnumerable<string>,
System.Action<string>)' has some invalid arguments
action.cs(7,28): (Location of the symbol related to previous error)
action.cs(19,21): error CS1503: Argument 2: Cannot convert type `lambda
expression' to `System.Action<string>'
Compilation failed: 2 error(s), 0 warnings

It looks like it was this change:
http://anonsvn.mono-project.com/viewcvs/trunk/mcs/mcs/lambda.cs?rev=99156&r1=98957&r2=99156

..which confuses me. Why can't an invocation that returns a non-void type be
used here?


-- 
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.
_______________________________________________
mono-bugs maillist  -  mono-bugs@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to