Skip to content

Commit

Permalink
Remove helpful compilation warning in favor of supporting more edge-c…
Browse files Browse the repository at this point in the history
…ases out of the box
  • Loading branch information
Mike Bierlee committed Jul 3, 2021
1 parent d7dc57e commit 70b4c9e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Poodinis Changelog
==================
**Version 8.1.0-beta.7**
* REVERT fix for issue #31. It broke too many valid cases.

**Version 8.1.0-beta.6**
* FIX multiple template arguments not allowed on constructor argument injection (PR #37)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Poodinis Dependency Injection Framework
=======================================
Version 8.1.0-beta.6
Version 8.1.0-beta.7
Copyright 2014-2021 Mike Bierlee
Licensed under the terms of the MIT license - See [LICENSE.txt](LICENSE.txt)

Expand Down
10 changes: 0 additions & 10 deletions source/poodinis/container.d
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,6 @@ synchronized class DependencyContainer
return newRegistration;
}

public Registration register(SuperType, ConcreteType)(
RegistrationOption options = RegistrationOption.none)
if (!is(SuperType == ConcreteType) && !is(BaseTypeTuple!ConcreteType == AliasSeq!(Object,
SuperType)) && !is(BaseTypeTuple!ConcreteType == AliasSeq!(SuperType)))
{
pragma(msg, "Cannot register dependency: ", ConcreteType,
" is not derived from ", SuperType);
static assert(0, "Cannot register dependency");
}

private bool hasOption(OptionType)(OptionType options,
OptionType persistentOptions, OptionType option)
{
Expand Down
10 changes: 10 additions & 0 deletions test/poodinis/containertest.d
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,14 @@ version (unittest)

assert(instance.preDestroyWasCalled == true);
}

// Test register class by ancestor type
unittest
{
auto container = new shared DependencyContainer();
container.register!(Grandma, Kid);
auto instance = container.resolve!Grandma;

assert(instance !is null);
}
}
15 changes: 15 additions & 0 deletions test/poodinis/testclasses.d
Original file line number Diff line number Diff line change
Expand Up @@ -789,4 +789,19 @@ version (unittest)
this.dependency = assignedDependency;
}
}

class Grandma
{

}

class Mommy : Grandma
{

}

class Kid : Mommy
{

}
}

0 comments on commit 70b4c9e

Please sign in to comment.