Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for: register does not match any template declaration #31

Closed
andre2007 opened this issue Jul 14, 2020 · 1 comment

Comments

@andre2007
Copy link

In case you register an interface with a class and you forgot to add the interface to the class definition,
there is an error message:

sample2.d(23,18): Error: template poodinis.container.DependencyContainer.register does not match any template declaration

Execute with dub sample2

/+ dub.sdl:
    name "sample2"
    dependency "poodinis" version="8.0.3"
+/

import std;
import poodinis;

interface IfFileSystem
{
    string readTextFile(string filePath);
}

class FileSystem
{
    string readTextFile(string filePath) {return readText(filePath);}
}

class DefaultApplicationContext : ApplicationContext
{
    public override void registerDependencies(shared(DependencyContainer) container)
    {
        container.register!(IfFileSystem, FileSystem);
    }
}

void main() 
{
    auto dc = new shared DependencyContainer();
    dc.registerContext!DefaultApplicationContext;
}
@mbierlee
Copy link
Owner

This is implemented now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants