[Mono-bugs] [Bug 28407][Nor] New - inner class/interface problem.
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
31 Jul 2002 15:12:39 -0000
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 erik@bagfors.nu.
http://bugzilla.ximian.com/show_bug.cgi?id=28407
--- shadow/28407 Wed Jul 31 11:12:39 2002
+++ shadow/28407.tmp.24189 Wed Jul 31 11:12:39 2002
@@ -0,0 +1,54 @@
+Bug#: 28407
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: erik@bagfors.nu
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: inner class/interface problem.
+
+The following code doesn't compile with mcs but does with csc.
+
+------------------------------------
+using System;
+
+class Test {
+ public static void Main() {
+ Console.WriteLine("test");
+ TestClass tst = new TestClass();
+ tst.test("test");
+ TestInterface ti = (TestInterface)tst;
+ ti.test("test");
+
+ }
+
+ public interface TestInterface {
+ string test(string name);
+ }
+
+ public class TestClass: TestInterface {
+ public string test(string name) {
+ Console.WriteLine("test2");
+ return name + " testar";
+ }
+ }
+}
+------------------------------------
+: [bagfors@detrius]$ ; mcs --target library test.cs
+test.cs(9) error CS0117: `Test+TestInterface' does not contain a
+definition for `test'
+Compilation failed: 1 error(s), 0 warnings
+---------------------------------
+
+That doesn't work well at all. Moving the last "}" above "interface
+TestInterface" so that the interface and the class TestClass are
+declared outside of class Test it compiles (and runs) just fine.