www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17266] New: pragma msg not condensing wstrings

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

          Issue ID: 17266
           Summary: pragma msg not condensing wstrings
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: TeddyBear12311 gmail.com

when printing out a manifest constant using pragma(msg, c) the output is ugly:

[Tuple(['w', 'c', 'h', 'a', 'r'])]


The following exhibits the issue:

import std.typecons, std.string, std.conv;

enum x = [tuple(to!wstring(strip(" wchar")))];
pragma(msg, x);

enum y = [tuple(to!wstring(strip(" wchar"))~"")];
pragma(msg, y);

enum z = [tuple(to!wstring(strip(" wchar"))~""w)];
pragma(msg, z);

void main()
{
}


[Tuple(['w', 'c', 'h', 'a', 'r'])] 
[Tuple("wchar")] 
[Tuple("wchar")]

Maybe pragma should treat array's of wchars/chars, etc as a string. Or check if
all the values are "printable" and then print it was a string.

--
Mar 18