I'm having trouble calling a method on one of my .NET objects.

if you compile the following repro into a "test.dll":


namespace Test {
        public interface ISomeInterface {
                string Greet();
        }

        public abstract class Base {}
        
        public static class SomeFactory {
                public static object Get() {
                        return new Concrete();
                }
        }

        internal class Concrete : Base, ISomeInterface {
                public string Greet() {
                        return "Hello world!";
                }
        }
}


and try to use them:

>>> import clr
>>> clr.AddReference("test")
>>> from Test import *
>>> o = SomeFactory.Get()
>>> print("Greet" in dir(o))
True
>>> print(o.Greet())

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected ISomeInterface, got Base


To me it looks like a bug regarding collection of polymorphic
information on .NET types;
or am I missing something?


Thanks,
Helmut



---------------------------------------------------------------------------

 An- und Abmeldung zur SCHEMA Mailingliste unter http://www.schema.de/mail

---------------------------------------------------------------------------


_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to