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

Issue 5988 - Template accepts instantiating an already-instantiated template type #2051

Merged
merged 1 commit into from Jun 25, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented May 18, 2013

@ghost
Copy link

ghost commented May 29, 2013

LGTM.

But: Since recently we can declare templates inside of functions. Test-cases would improve in readability if we tried to avoid encoding the bug name in the template names. Your test-case could become:

void test5988()
{
    template Templ(alias T)
    {
        alias T!int Templ;
    }

    class A(T) { Templ!A foo; }
    //Templ!A fooA;    // Commented version

    void testA()
    {
        A!int a; // Was error, now works
    }

    class B(T) { Templ!B foo; }
    Templ!B fooB;      // Uncomment version

    void testB()
    {
        B!int a; // Works
    }

    testA();
    testB();
}

Maybe this is a small issue because these test-cases are mostly used to avoid regressions, but it helps with reviewing. Currently the test-case is unreadable.

@9rnsr
Copy link
Contributor Author

9rnsr commented May 29, 2013

@AndrejMitrovic Such rewriting would not be correct always. Some test case will need to declare symbols in DeclDefs scope (e.g. forward reference bugs). I'll do it only when I'm sure that such rewriting is definitely unrelated to the testing bug.

@9rnsr
Copy link
Contributor Author

9rnsr commented May 29, 2013

So I'll care test code style, but don't care test code structure, even if readability is not good. If the test code would reproduce bug, that is enough good test case.

@ghost
Copy link

ghost commented May 29, 2013

Ok.

WalterBright added a commit that referenced this pull request Jun 25, 2013
Issue 5988 - Template accepts instantiating an already-instantiated template type
@WalterBright WalterBright merged commit 771c99c into dlang:master Jun 25, 2013
@CyberShadow
Copy link
Member

This pull request introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=15069

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