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

Allow getting type from template declarations. #7973

Merged
merged 1 commit into from Mar 12, 2018

Conversation

skl131313
Copy link
Contributor

struct TypeObj
{
    alias This = typeof(this);

    mixin template MixinTempl()
    {
        int value;
    }
}

ref TypeObj Obj()
{
    static TypeObj a;
    return a;
}

void main()
{
    mixin Obj.This.MixinTempl; // ok
    mixin Obj.MixinTempl;      // error: "MixinTempl!()" is not defined
}

Couldn't access templates like in the above example, though other symbols such as types are accessible. This allows the second line to be usable.

@dlang-bot
Copy link
Contributor

dlang-bot commented Mar 1, 2018

Thanks for your pull request and interest in making D better, @skl131313! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
18591 enhancement DMD should allow access to mixin template declarations

@@ -2798,6 +2798,10 @@ extern (C++) abstract class Type : RootObject
s = getDsymbol(e);
break;

case TOK.dotTemplateDeclaration:
s = (cast(DotTemplateExp)e).td;
break;
Copy link
Member

@wilzbach wilzbach Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

edit: covered now. Thanks!

@WalterBright
Copy link
Member

Thanks for your contribution. This needs an issue raised in Bugzilla which this PR can then resolve.

@wilzbach
Copy link
Member

In the interest of moving quickly, I created a Bugzilla issue, referenced it in the commit message and squashed your commits.

@dlang-bot dlang-bot merged commit a10a834 into dlang:master Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants