Bug 16462 – mixin template ddoc doesn't appear in docs

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-02T10:55:00Z
Last change time
2017-06-26T14:35:03Z
Assigned to
nobody
Creator
turkeyman

Comments

Comment #0 by turkeyman — 2016-09-02T10:55:35Z
I have a mixin template, which I mixin to various structs. The mixin introduces a member, and there is ddoc for the member present inside the mixin template. Sadly, this doesn't seem to do anything. Expect: ddoc for the member declared inside mixin template should appear in the documentation of the type that mixes it in. It is after all a member of that type.
Comment #1 by turkeyman — 2016-09-02T11:05:13Z
eg: mixin template Test(T) { /** doco */ T member; } /** My struct */ struct S { mixin Test!int; } 'member' is not documented.
Comment #2 by andrej.mitrovich — 2016-09-04T17:29:13Z
It looks like an edge-case. The workaround is to make the mixin itself also documented. So just add `///` to Test, e.g. /// mixin template Test(T) The mixin's body being documented was fixed as part of Issue 648. I think your bug report is legit though and should be fixed.
Comment #3 by dlang-bugzilla — 2017-06-26T14:35:03Z
It's the same as with any other composite declaration - you have to document the top-level declaration so that the nested declarations are rendered. E.g. here the documentation will be blank: struct S { /// foo int foo; } So, it's not specific to mixin templates. Not sure if it's by design or not, but in any case, having a composite declaration without documentation with members that do have documentation in it might look weird at least in some DDoc themes. Closing this seeing as there was some confusion as to the nature of the bug and a workaround has been fonud; please reopen or file a new bug if you have a use case for doing the above.