www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18077] New: Documentation duplicated when example is inside

https://issues.dlang.org/show_bug.cgi?id=18077

          Issue ID: 18077
           Summary: Documentation duplicated when example is inside static
                    if or version
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

With either of these code samples

========
struct S(R)
{
    /// Something to say
    static if(is(R == string))
    {
        alias S = R;

        ///
        unittest
        {
            S s;
        }
    }
    else
        alias S = int;
========
///
struct S(R)
{
    /// Something to say
    version(Posix)
    {
        alias S = R;

        ///
        unittest
        {
            S s;
        }
    }
    else
        alias S = int;
}
========

the documentation comment on the alias gets duplicated immediately after
"Examples:" and before the code examples. So, you get

========
Something to say

Examples
Something to say
S s;
========

(though obviously, the second example would have to be compiled on a POSIX
system or have the version identifier changed in order to work).

I tried this as a way to work around
https://issues.dlang.org/show_bug.cgi?id=11133, and clearly, this doesn't work
as a workaround.

--
Dec 13 2017