From cad0200904f54d802b83f9dbbfcd7a48348873b7 Mon Sep 17 00:00:00 2001 From: heromyth Date: Wed, 25 Mar 2020 18:37:27 +0800 Subject: [PATCH] ConcreteType should be a class --- source/poodinis/container.d | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/poodinis/container.d b/source/poodinis/container.d index bf88ec0..f555a77 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -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(); } };