[Issue 20125] New: Different .stringof format for CT Sequences depending on content

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 12 12:29:27 UTC 2019


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

          Issue ID: 20125
           Summary: Different .stringof format for CT Sequences depending
                    on content
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

import std.meta;
static assert(AliasSeq!().stringof                 == "()");
static assert(AliasSeq!(1).stringof                == "tuple(1)");
static assert(AliasSeq!(1,2).stringof              == "tuple(1, 2)");
static assert(AliasSeq!(int).stringof              == "(int)");
static assert(AliasSeq!(int, int).stringof         == "(int, int)");
static assert(AliasSeq!(int, 2).stringof           == "tuple((int), 2)");
static assert(AliasSeq!(int, 2, int, int).stringof == "tuple((int), 2, (int),
(int))");

As we can see above, CT sequences containing at least one value has a "tuple"
prefix, while others don't. Not only that, but mixed sequences wrap every type
in (brackets).

--


More information about the Digitalmars-d-bugs mailing list