[Mono-list] Possible bug in mcs.

Erik Bagfors erik@bagfors.nu
31 Jul 2002 16:18:27 +0200


Hi!  I assume that this is a bug but I'm not 100% sure because I don't
know C# that well and I can't test it under windows with the ms-tools.


------------------------------------
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.

Can anyone comment on this?

/Erik

-- 
Erik Bågfors               | erik@bagfors.nu
Supporter of free software | GSM +46 733 279 273
fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32