[Mono-bugs] [Bug 392448] New: gmcs issue with lambda expression passed as delegates

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 20 05:12:14 EDT 2008


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


           Summary: gmcs issue with lambda expression passed as delegates
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: jbevain at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Repro:

--
using System;
using System.Collections;

class Test {
        public static IList Foo (Action<IList> action)
        {
                ArrayList l = new ArrayList ();
                action (l);
                return l;
        }

        public static IList Populator (IList list, IEnumerable items)
        {
                foreach (object item in items)
                        list.Add (item);

                return list;
        }

        public static void Main (string [] args)
        {
                var list = Foo (l => Populator (l, args));

                foreach (object item in list)
                        Console.WriteLine (item);
        }
}
--

Fails with:

[mono] ~/Desktop @ gmcs test.cs 
test.cs(22,28): error CS1502: The best overloaded method match for
`Test.Foo(System.Action<System.Collections.IList>)' has some invalid arguments
test.cs(5,29): (Location of the symbol related to previous error)
test.cs(22,28): error CS1503: Argument 1: Cannot convert type `lambda
expression' to `System.Action<System.Collections.IList>'
test.cs(24,17): error CS1579: foreach statement cannot operate on variables of
type `object' because it does not contain a definition for `GetEnumerator' or
is not accessible

That should compile and print to stdout all arguments passed to the executable.


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