https://bugzilla.novell.com/show_bug.cgi?id=668652
https://bugzilla.novell.com/show_bug.cgi?id=668652#c0 Summary: Mono fails to compile class using LINQ query pattern Classification: Mono Product: Mono: Compilers Version: 2.8.x Platform: i686 OS/Version: Linux Status: NEW Severity: Major Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=411554) --> (http://bugzilla.novell.com/attachment.cgi?id=411554) Program.cs as described in the bug report. User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b10) Gecko/20100101 Firefox/4.0b10 The class below will compile fine with CSC, but not dmsc (or gmsc, or msc). The class implements the "query pattern pattern" for LINQ (described in section 7.15.3 of the C# 3.0 spec), so it's not anything too weird. Removing the "using System.Linq" import will get rid of one error, but it still doesn't fix the problem. Even so, the class compiles fine with Microsoft's compiler. Reproducible: Always Steps to Reproduce: 1. Save the following class in file named Program.cs: using System; using System.Linq; namespace MonoLinq { class Program { static void Main(string[] args) { var server = new Server<int>(); var outputExpr1 = from item in server where item.Is() select item; var foo = server.Where(p => p.Is()); Console.WriteLine("outputExpr1.GetType: {0}", outputExpr1.GetType().FullName); Console.WriteLine("foo.GetType: {0}", foo.GetType().FullName); } } class Server<T> { public Server() { } public string Where(Func<IDAccessor, string> idExpr) { return String.Empty; } } class IDAccessor { } static class IDAccessorExt { public static string Is(this IDAccessor __) { return null; } } } 2. Compile with this command line: dmcs Program.cs Actual Results: The compiler will give the following errors: Program.cs(12,33): error CS0411: The type arguments for method `System.Linq.Enumerable.Where<TSource>(this System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,bool>)' cannot be inferred from the usage. Try specifying the type arguments explicitly Program.cs(12,44): error CS0029: Cannot implicitly convert type `string' to `bool' Expected Results: The program should compile. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
