Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Add constraints.
Fix test for ctfpMessage equality.
  • Loading branch information
ntrel committed Mar 18, 2017
1 parent f55d6b0 commit c6a7e3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion std/format.d
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ My friends are John, Nancy.
)
*/
uint formattedWrite(alias fmt, Writer, A...)(Writer w, A args)
if (isSomeString!(typeof(fmt)))
{
alias e = checkFormatException!(fmt, A);
static assert(!e, e.msg);
Expand Down Expand Up @@ -581,6 +582,7 @@ Throws:
An `Exception` if `S.length == 0` and `fmt` has format specifiers
*/
uint formattedRead(alias fmt, R, S...)(ref R r, auto ref S args)
if (isSomeString!(typeof(fmt)))
{
alias e = checkFormatException!(fmt, S);
static assert(!e, e.msg);
Expand Down Expand Up @@ -5483,7 +5485,7 @@ package static const checkFormatException(alias fmt, Args...) =
try
.format(fmt, Args.init);
catch (Exception e)
return (e.msg is ctfpMessage) ? null : e;
return (e.msg == ctfpMessage) ? null : e;
return null;
}();

Expand All @@ -5494,6 +5496,7 @@ package static const checkFormatException(alias fmt, Args...) =
* args = Variadic list of arguments to _format into returned string.
*/
typeof(fmt) format(alias fmt, Args...)(Args args)
if (isSomeString!(typeof(fmt)))
{
alias e = checkFormatException!(fmt, Args);
static assert(!e, e.msg);
Expand Down Expand Up @@ -5581,6 +5584,7 @@ if (isSomeChar!Char)
* than the number of format specifiers in `fmt`.
*/
char[] sformat(alias fmt, Args...)(char[] buf, Args args)
if (isSomeString!(typeof(fmt)))
{
alias e = checkFormatException!(fmt, Args);
static assert(!e, e.msg);
Expand Down

0 comments on commit c6a7e3e

Please sign in to comment.