[Mono-bugs] [Bug 610240] New: Nested classes with generics: type parameters not considered equal (from same bindings)
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun May 30 23:34:54 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=610240
http://bugzilla.novell.com/show_bug.cgi?id=610240#c0
Summary: Nested classes with generics: type parameters not
considered equal (from same bindings)
Classification: Mono
Product: Mono: Compilers
Version: SVN
Platform: i386
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: chadwick at ccs.neu.edu
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10pre)
Gecko/20100410 Ubuntu/9.10 (karmic) Firefox/3.5.9
Nested classes that share a parent's type parameter are not considered equal...
Here's a minimized test-case, ("Gen.cs"):
// --------------- Gen.cs ------------------------
public class List<X>{
public class Comp<Y>{
public List<Y>.Comp<X> flip(Y y, X x){
return new Flip<Y>(this);
}
}
public class Flip<Z> : List<Z>.Comp<X>{
Comp<Z> c;
public Flip(Comp<Z> cc){ c = cc; }
}
}
// -----------------------------------------------
The nested classes refer to the same binding of the type parameter X. Yet the
call to the constructor of List<X>.Flip<Y> inside of List<X>.Comp<Y> is flagged
as not matching the constructor's parameter type (once renamed) of
List<X>.Comp<Y>, even though X and Y in both cases share bindings.
Fully expanding all types in the source (i.e., prefixing with List<X>) doesn't
affect the result.
Errors are:
Gen.cs(4,37): error CS1502: The best overloaded method match for
`List<X>.Flip<Y>.Flip(List<X>.Comp<Y>)' has some invalid arguments
Gen.cs(4,37): error CS1503: Argument `#1' cannot convert `List<X>.Comp<Y>'
expression to type `List<X>.Comp<Y>'
With a mention of:
Gen.cs(4,37): (equally named types possibly from different assemblies in
previous error)
Using a build from daily source:
http://mono.ximian.com/daily/mono-20100530.tar.bz2
If this is the expected behavior a suggestion for achieving this kind of
'equality' would be greatly appreciated.
Reproducible: Always
Steps to Reproduce:
1. Compile the test file GMCS
2.
3.
Actual Results:
Compile Errors
Expected Results:
Successful Compile
Older version (gmcs 2.4.3) was not so strict, not requiring the List<Y> and
List<Z> prefixes on lines 3 and 7, which were caught by Microsoft CSC.
--
Configure bugmail: http://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