diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index 79d5c76..e449afc 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -96,8 +96,8 @@ private void printDebugAutowiringCandidate(TypeInfo candidateInstanceType, void* private void autowireMember(string member, Type)(DependencyContainer container, Type instance) { // For the love of god, refactor this! <-- Doing it, bro! - static if(__traits(compiles, __traits(getMember, Type, member)) && __traits(compiles, __traits(getAttributes, __traits(getMember, Type, member)))) { - foreach(autowireAttribute; __traits(getAttributes, __traits(getMember, Type, member))) { + static if(__traits(compiles, __traits(getMember, instance, member)) && __traits(compiles, __traits(getAttributes, __traits(getMember, instance, member)))) { + foreach(autowireAttribute; __traits(getAttributes, __traits(getMember, instance, member))) { static if (__traits(isSame, autowireAttribute, Autowire) || is(autowireAttribute == Autowire!T, T)) { if (__traits(getMember, instance, member) is null) { alias memberReference = TypeTuple!(__traits(getMember, instance, member));