[Mono-bugs] [Bug 74904][Nor] New - gmcs does not unify return types in overridden methods
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 11 May 2005 04:00:35 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dsilva@ccs.neu.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=74904
--- shadow/74904 2005-05-11 04:00:35.000000000 -0400
+++ shadow/74904.tmp.22610 2005-05-11 04:00:35.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 74904
+Product: Mono: Compilers
+Version: 1.0
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dsilva@ccs.neu.edu
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: gmcs does not unify return types in overridden methods
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+The two 'map' methods here have the same return type:
+
+ public abstract class List <T> {
+ public delegate U mapping<U>(T obj);
+
+ public abstract List<U> map<U>(mapping<U> f);
+ }
+
+ public class Nil<T> : List<T> {
+ public static Nil<T> nil = new Nil<T>();
+ private Nil() {}
+
+ public override List<U> map<U>(mapping<U> f) {
+ return Nil<U>.nil;
+ }
+ }
+
+but gmcs says:
+
+$ gmcs --version
+Mono C# compiler version 1.1.3.0
+$ gmcs -target:library Test.cs
+Test.cs(12) error CS0508: Nil`1.map(List`1.mapping`1): cannot change return
+type when overriding inherited member
+Test.cs(5): 'List`1.map(List`1.mapping`1)' (name of symbol related to
+previous error
+Compilation failed: 1 error(s), 0 warnings