April 07, 2021 [Issue 21808] New: Position format specifiers don't work for AAs | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21808 Issue ID: 21808 Summary: Position format specifiers don't work for AAs Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: qs.il.paperinik@gmail.com When formatting AAs, one can use %(..%|..%) where the left side formats key--value pairs using two format specifiers. Here, positional formatting of the form %1$..s does not do its job. Position arguments are ignored. Test case: import std.stdio; auto spelled = [ 1 : "one", 10 : "ten", 100 : "hundred" ]; // expected: prints, in any order, 1 (one), 10 (ten), 100 (hundred) // result: prints, in any order, 1 (one), 10 (ten), 100 (hundred) [ok] writefln("%-(%1$s (%2$s)%|, %)", spelled); // expected: prints, in any order, one (1), ten (10), hundred (100) // result: prints, in any order, 1 (one), 10 (ten), 100 (hundred) [fail] writefln("%-(%2$s (%1$s)%|, %)", spelled); -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply