[Mono-bugs] [Bug 643456] New: gmcs fails to infer generic type arguments when the "source" type is a generic constraint
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Oct 4 05:38:29 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=643456
https://bugzilla.novell.com/show_bug.cgi?id=643456#c0
Summary: gmcs fails to infer generic type arguments when the
"source" type is a generic constraint
Classification: Mono
Product: Mono: Compilers
Version: 2.6.x
Platform: x86-64
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: david at dasz.at
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
using System.Collections.Generic;
using System.Linq;
class ListWrapper<TEntry, TEntryCollection>
where TEntry : class
where TEntryCollection : IList<TEntry>
{
public IEnumerable<TEntry> Fail(TEntryCollection subject) {
return subject.Where(e => e != null); // error CS0411: The type
arguments for method `System.Linq.Enumerable.Where<TSource>(this
System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,int,bool>)' cannot be inferred from the usage. Try
specifying the type arguments explicitly
}
public IEnumerable<TEntry> NoFail(IList<TEntry> subject) {
return subject.Where(e => e != null);
}
}
Reproducible: Always
Steps to Reproduce:
1. try to build the included source
Actual Results:
The code fails to compile. gmcs fails to infer the type argument for the
Where() in Fail(TEntryCollection):
error CS0411: The type arguments for method
`System.Linq.Enumerable.Where<TSource>(this
System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,int,bool>)' cannot be inferred from the usage. Try
specifying the type arguments explicitly
Expected Results:
The code compiles under MS' CSC.exe from VS2010 (both using langversion=3 and
with default settings)
This seems to be a continuation of bug 599449.
--
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