ConcreteType should be a class

This commit is contained in:
heromyth 2020-03-25 18:37:27 +08:00 committed by Mike Bierlee
parent e26be1f439
commit cad0200904

View file

@ -204,8 +204,9 @@ synchronized class DependencyContainer {
/**
*
*/
Registration register(SuperType, ConcreteType : SuperType)(InjectionInitializer!ConcreteType creator,
RegistrationOption options = RegistrationOption.none) if (!is(ConcreteType == struct)) {
Registration register(SuperType, ConcreteType : SuperType)(InjectionInitializer!SuperType creator,
RegistrationOption options = RegistrationOption.none)
if (is(ConcreteType == class)) {
TypeInfo registeredType = typeid(SuperType);
TypeInfo_Class concreteType = typeid(ConcreteType);
@ -221,7 +222,7 @@ synchronized class DependencyContainer {
InstanceFactory instanceFactory = new class InstanceFactory {
protected override Object createInstance() {
return creator();
return cast(Object)creator();
}
};