Fix Issue 930 - Templates inside templates used as mixins#10192
Fix Issue 930 - Templates inside templates used as mixins#10192dlang-bot merged 1 commit intodlang:stablefrom
Conversation
|
Thanks for your pull request and interest in making D better, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "stable + dmd#10192" |
|
This is a pretty simple fix, might as well target stable. |
|
Fair enough. |
test/compilable/test930.d
Outdated
| --- | ||
| */ | ||
|
|
||
| import core.stdc.stdio; |
There was a problem hiding this comment.
You can declare a dummy function with the same signature as printf.
There was a problem hiding this comment.
I could delete it altogether, I just wanted to preserve the initial bug report as is.
There was a problem hiding this comment.
and get ridof the import in case it was not clear
There was a problem hiding this comment.
I could delete it altogether, I just wanted to preserve the initial bug report as is
yes sorry crossed post. Remove the import and use local dummy please and it's good.
There was a problem hiding this comment.
I deleted the printf; it's a compilable test anyway.
When a template is instantiated, the template parameters are declared as aliases to the instantiation types in the scope of the template instance. In this situation, the mixin simply syntax copies the
Atemplate()without any knowledge of its parent scope, therefore the alias for theTtype is lost.My patch checks for this particular case and the lost types are brought in the mixin scope.