Fix if constraints indentation

This commit is contained in:
Sebastian Wilzbach 2018-03-24 13:17:53 +01:00
parent 47aa7db188
commit 8f86a0d734
10 changed files with 90 additions and 76 deletions

View file

@ -1378,8 +1378,8 @@ if (isInputRange!Range && !isInfinite!Range &&
}
private auto extremum(alias selector = "a < b", Range)(Range r)
if (isInputRange!Range && !isInfinite!Range &&
!is(typeof(unaryFun!selector(ElementType!(Range).init))))
if (isInputRange!Range && !isInfinite!Range &&
!is(typeof(unaryFun!selector(ElementType!(Range).init))))
{
return extremum!(a => a, selector)(r);
}
@ -1388,9 +1388,9 @@ private auto extremum(alias selector = "a < b", Range)(Range r)
private auto extremum(alias selector = "a < b", Range,
RangeElementType = ElementType!Range)
(Range r, RangeElementType seedElement)
if (isInputRange!Range && !isInfinite!Range &&
!is(CommonType!(ElementType!Range, RangeElementType) == void) &&
!is(typeof(unaryFun!selector(ElementType!(Range).init))))
if (isInputRange!Range && !isInfinite!Range &&
!is(CommonType!(ElementType!Range, RangeElementType) == void) &&
!is(typeof(unaryFun!selector(ElementType!(Range).init))))
{
return extremum!(a => a, selector)(r, seedElement);
}

View file

@ -430,7 +430,8 @@ private template isSpawnable(F, T...)
* pointer indirection. This is necessary for enforcing isolation among
* threads.
*/
Tid spawn(F, T...)(F fn, T args) if (isSpawnable!(F, T))
Tid spawn(F, T...)(F fn, T args)
if (isSpawnable!(F, T))
{
static assert(!hasLocalAliasing!(T), "Aliases to mutable thread-local data not allowed.");
return _spawn(false, fn, args);
@ -504,7 +505,8 @@ Tid spawn(F, T...)(F fn, T args) if (isSpawnable!(F, T))
* Returns:
* A Tid representing the new thread.
*/
Tid spawnLinked(F, T...)(F fn, T args) if (isSpawnable!(F, T))
Tid spawnLinked(F, T...)(F fn, T args)
if (isSpawnable!(F, T))
{
static assert(!hasLocalAliasing!(T), "Aliases to mutable thread-local data not allowed.");
return _spawn(true, fn, args);
@ -513,7 +515,8 @@ Tid spawnLinked(F, T...)(F fn, T args) if (isSpawnable!(F, T))
/*
*
*/
private Tid _spawn(F, T...)(bool linked, F fn, T args) if (isSpawnable!(F, T))
private Tid _spawn(F, T...)(bool linked, F fn, T args)
if (isSpawnable!(F, T))
{
// TODO: MessageList and &exec should be shared.
auto spawnTid = Tid(new MessageBox);

View file

@ -5974,7 +5974,8 @@ if (isIntegral!T)
Returns the representation of an enumerated value, i.e. the value converted to
the base type of the enumeration.
*/
OriginalType!E asOriginalType(E)(E value) if (is(E == enum))
OriginalType!E asOriginalType(E)(E value)
if (is(E == enum))
{
return value;
}

View file

@ -159,7 +159,8 @@ alias CRC64ISO = CRC!(64, 0xD800000000000000);
*
* See $(D std.digest.digest) for differences between template and OOP API.
*/
struct CRC(uint N, ulong P) if (N == 32 || N == 64)
struct CRC(uint N, ulong P)
if (N == 32 || N == 64)
{
private:
static if (N == 32)

View file

@ -608,8 +608,8 @@ version(unittest)
}
package void testAllocatorObject(RCAllocInterface)(RCAllocInterface a)
if (is(RCAllocInterface == RCIAllocator)
|| is (RCAllocInterface == shared RCISharedAllocator))
if (is(RCAllocInterface == RCIAllocator)
|| is (RCAllocInterface == shared RCISharedAllocator))
{
import std.conv : text;
import std.math : isPowerOf2;

View file

@ -2610,7 +2610,7 @@ Returns:
The greatest common divisor of the given arguments.
*/
T gcd(T)(T a, T b)
if (isIntegral!T)
if (isIntegral!T)
{
static if (is(T == const) || is(T == immutable))
{
@ -2667,7 +2667,7 @@ T gcd(T)(T a, T b)
// user-defined types.
/// ditto
T gcd(T)(T a, T b)
if (!isIntegral!T &&
if (!isIntegral!T &&
is(typeof(T.init % T.init)) &&
is(typeof(T.init == 0 || T.init > 0)))
{

View file

@ -7808,7 +7808,7 @@ See_Also: $(LREF chunks)
*/
auto slide(Flag!"withPartial" f = Yes.withPartial,
Source)(Source source, size_t windowSize, size_t stepSize = 1)
if (isForwardRange!Source)
if (isForwardRange!Source)
{
return Slides!(f, Source)(source, windowSize, stepSize);
}
@ -7871,7 +7871,7 @@ auto slide(Flag!"withPartial" f = Yes.withPartial,
}
private struct Slides(Flag!"withPartial" withPartial = Yes.withPartial, Source)
if (isForwardRange!Source)
if (isForwardRange!Source)
{
private:
Source source;

View file

@ -14,7 +14,7 @@ import std.regex.internal.ir;
regular expressions.
+/
@trusted class BacktrackingMatcher(Char, Stream = Input!Char) : Matcher!Char
if (is(Char : dchar))
if (is(Char : dchar))
{
alias DataIndex = Stream.DataIndex;
struct State

View file

@ -601,7 +601,7 @@ static assert(fullyQualifiedName!(const MyStruct[]) == "const(myModule.MyStruct[
-----------------
*/
template fullyQualifiedName(T...)
if (T.length == 1)
if (T.length == 1)
{
static if (is(T))
@ -1027,7 +1027,7 @@ private template fqnType(T,
* (see template $(LREF functionAttributes)).
*/
template ReturnType(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
static if (is(FunctionTypeOf!func R == return))
alias ReturnType = R;
@ -1086,7 +1086,7 @@ to function, a delegate, a struct with an $(D opCall), a pointer to a
struct with an $(D opCall), or a class with an $(D opCall).
*/
template Parameters(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
static if (is(FunctionTypeOf!func P == function))
alias Parameters = P;
@ -1136,8 +1136,8 @@ Returns the number of arguments of function $(D func).
arity is undefined for variadic functions.
*/
template arity(func...)
if (func.length == 1 && isCallable!func &&
variadicFunctionStyle!func == Variadic.no)
if (func.length == 1 && isCallable!func &&
variadicFunctionStyle!func == Variadic.no)
{
enum size_t arity = Parameters!func.length;
}
@ -1182,7 +1182,7 @@ enum ParameterStorageClass : uint
/// ditto
template ParameterStorageClassTuple(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
alias Func = FunctionTypeOf!func;
@ -1338,7 +1338,7 @@ template extractParameterStorageClassFlags(Attribs...)
Get, as a tuple, the identifiers of the parameters to a function symbol.
*/
template ParameterIdentifierTuple(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
static if (is(FunctionTypeOf!func PT == __parameters))
{
@ -1425,7 +1425,7 @@ Get, as a tuple, the default value of the parameters to a function symbol.
If a parameter doesn't have the default value, $(D void) is returned instead.
*/
template ParameterDefaults(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
alias param_names = ParameterIdentifierTuple!func;
static if (is(FunctionTypeOf!(func[0]) PT == __parameters))
@ -1573,7 +1573,7 @@ enum FunctionAttribute : uint
/// ditto
template functionAttributes(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
// @bug: workaround for opCall
alias FuncSym = Select!(is(typeof(__traits(getFunctionAttributes, func))),
@ -1749,8 +1749,8 @@ See_Also:
$(LREF functionAttributes)
*/
template hasFunctionAttributes(args...)
if (args.length > 0 && isCallable!(args[0])
&& allSatisfy!(isSomeString, typeof(args[1 .. $])))
if (args.length > 0 && isCallable!(args[0])
&& allSatisfy!(isSomeString, typeof(args[1 .. $])))
{
enum bool hasFunctionAttributes = {
import std.algorithm.searching : canFind;
@ -1933,7 +1933,7 @@ template hasFunctionAttributes(args...)
$(D true) if $(D func) is $(D @safe) or $(D @trusted).
*/
template isSafe(alias func)
if (isCallable!func)
if (isCallable!func)
{
enum isSafe = (functionAttributes!func & FunctionAttribute.safe) != 0 ||
(functionAttributes!func & FunctionAttribute.trusted) != 0;
@ -2092,7 +2092,7 @@ Returns:
one of the strings "D", "C", "Windows", "Pascal", or "Objective-C"
*/
template functionLinkage(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
enum string functionLinkage = __traits(getLinkage, FunctionTypeOf!func);
}
@ -2146,7 +2146,7 @@ enum Variadic
/// ditto
template variadicFunctionStyle(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
enum string varargs = __traits(getFunctionVariadicStyle, FunctionTypeOf!func);
enum Variadic variadicFunctionStyle =
@ -2196,7 +2196,7 @@ Do not confuse function types with function pointer types; function types are
usually used for compile-time reflection purposes.
*/
template FunctionTypeOf(func...)
if (func.length == 1 && isCallable!func)
if (func.length == 1 && isCallable!func)
{
static if (is(typeof(& func[0]) Fsym : Fsym*) && is(Fsym == function) || is(typeof(& func[0]) Fsym == delegate))
{
@ -2301,7 +2301,7 @@ template FunctionTypeOf(func...)
* attrs = The desired $(LREF FunctionAttribute)s of the result type.
*/
template SetFunctionAttributes(T, string linkage, uint attrs)
if (isFunctionPointer!T || isDelegate!T)
if (isFunctionPointer!T || isDelegate!T)
{
mixin({
import std.algorithm.searching : canFind;
@ -2376,7 +2376,7 @@ template SetFunctionAttributes(T, string linkage, uint attrs)
/// Ditto
template SetFunctionAttributes(T, string linkage, uint attrs)
if (is(T == function))
if (is(T == function))
{
// To avoid a lot of syntactic headaches, we just use the above version to
// operate on the corresponding function pointer type and then remove the
@ -2390,7 +2390,7 @@ template SetFunctionAttributes(T, string linkage, uint attrs)
alias ExternC(T) = SetFunctionAttributes!(T, "C", functionAttributes!T);
auto assumePure(T)(T t)
if (isFunctionPointer!T || isDelegate!T)
if (isFunctionPointer!T || isDelegate!T)
{
enum attrs = functionAttributes!T | FunctionAttribute.pure_;
return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t;
@ -2471,7 +2471,7 @@ Returns:
`false` otherwise
*/
template isInnerClass(T)
if (is(T == class))
if (is(T == class))
{
import std.meta : staticIndexOf;
@ -2517,7 +2517,7 @@ Determines whether $(D T) has its own context pointer.
$(D T) must be either $(D class), $(D struct), or $(D union).
*/
template isNested(T)
if (is(T == class) || is(T == struct) || is(T == union))
if (is(T == class) || is(T == struct) || is(T == union))
{
enum isNested = __traits(isNested, T);
}
@ -4003,7 +4003,7 @@ int[] abc = cast(int[]) [ EnumMembers!E ];
example below.
*/
template EnumMembers(E)
if (is(E == enum))
if (is(E == enum))
{
import std.meta : AliasSeq;
// Supply the specified identifier to an constant value.
@ -4213,7 +4213,7 @@ template BaseTypeTuple(A)
* BaseClassesTuple!Object) yields the empty type tuple.
*/
template BaseClassesTuple(T)
if (is(T == class))
if (is(T == class))
{
static if (is(T == Object))
{
@ -4364,7 +4364,7 @@ class or interface $(D C). Covariant duplicates are shrunk into the most
derived one.
*/
template MemberFunctionsTuple(C, string name)
if (is(C == class) || is(C == interface))
if (is(C == class) || is(C == interface))
{
static if (__traits(hasMember, C, name))
{
@ -4647,7 +4647,8 @@ template TemplateArgsOf(T : Base!Args, alias Base, Args...)
}
private template maxAlignment(U...) if (isTypeTuple!U)
private template maxAlignment(U...)
if (isTypeTuple!U)
{
import std.meta : staticMap;
static if (U.length == 0)
@ -4665,7 +4666,8 @@ private template maxAlignment(U...) if (isTypeTuple!U)
/**
Returns class instance alignment.
*/
template classInstanceAlignment(T) if (is(T == class))
template classInstanceAlignment(T)
if (is(T == class))
{
alias classInstanceAlignment = maxAlignment!(void*, typeof(T.tupleof));
}
@ -5072,9 +5074,9 @@ Determines whether the function type $(D F) is covariant with $(D G), i.e.,
functions of the type $(D F) can override ones of the type $(D G).
*/
template isCovariantWith(F, G)
if (is(F == function) && is(G == function) ||
is(F == delegate) && is(G == delegate) ||
isFunctionPointer!F && isFunctionPointer!G)
if (is(F == function) && is(G == function) ||
is(F == delegate) && is(G == delegate) ||
isFunctionPointer!F && isFunctionPointer!G)
{
static if (is(F : G))
enum isCovariantWith = true;
@ -5331,7 +5333,8 @@ Note: Trying to use returned value will result in a
// SomethingTypeOf
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
private template AliasThisTypeOf(T) if (isAggregateType!T)
private template AliasThisTypeOf(T)
if (isAggregateType!T)
{
alias members = AliasSeq!(__traits(getAliasThis, T));
@ -6874,7 +6877,7 @@ template isTypeTuple(T...)
Detect whether symbol or type $(D T) is a function pointer.
*/
template isFunctionPointer(T...)
if (T.length == 1)
if (T.length == 1)
{
static if (is(T[0] U) || is(typeof(T[0]) U))
{
@ -6910,7 +6913,7 @@ template isFunctionPointer(T...)
Detect whether symbol or type $(D T) is a delegate.
*/
template isDelegate(T...)
if (T.length == 1)
if (T.length == 1)
{
static if (is(typeof(& T[0]) U : U*) && is(typeof(& T[0]) U == delegate))
{
@ -6953,7 +6956,7 @@ Returns:
A `bool`
*/
template isSomeFunction(T...)
if (T.length == 1)
if (T.length == 1)
{
static if (is(typeof(& T[0]) U : U*) && is(U == function) || is(typeof(& T[0]) U == delegate))
{
@ -7017,7 +7020,7 @@ Detect whether $(D T) is a callable object, which can be called with the
function call operator $(D $(LPAREN)...$(RPAREN)).
*/
template isCallable(T...)
if (T.length == 1)
if (T.length == 1)
{
static if (is(typeof(& T[0].opCall) == delegate))
// T is a object which has a member function opCall().
@ -7051,7 +7054,7 @@ template isCallable(T...)
* Detect whether $(D T) is an abstract function.
*/
template isAbstractFunction(T...)
if (T.length == 1)
if (T.length == 1)
{
enum bool isAbstractFunction = __traits(isAbstractFunction, T[0]);
}
@ -7071,7 +7074,7 @@ template isAbstractFunction(T...)
* Detect whether $(D T) is a final function.
*/
template isFinalFunction(T...)
if (T.length == 1)
if (T.length == 1)
{
enum bool isFinalFunction = __traits(isFinalFunction, T[0]);
}
@ -7113,7 +7116,7 @@ template isNestedFunction(alias f)
* Detect whether $(D T) is an abstract class.
*/
template isAbstractClass(T...)
if (T.length == 1)
if (T.length == 1)
{
enum bool isAbstractClass = __traits(isAbstractClass, T[0]);
}
@ -7137,7 +7140,7 @@ template isAbstractClass(T...)
* Detect whether $(D T) is a final class.
*/
template isFinalClass(T...)
if (T.length == 1)
if (T.length == 1)
{
enum bool isFinalClass = __traits(isFinalClass, T[0]);
}
@ -7500,7 +7503,8 @@ Returns the largest type, i.e. T such that T.sizeof is the largest. If more
than one type is of the same size, the leftmost argument of these in will be
returned.
*/
template Largest(T...) if (T.length >= 1)
template Largest(T...)
if (T.length >= 1)
{
static if (T.length == 1)
{
@ -7595,7 +7599,7 @@ template Signed(T)
Returns the most negative value of the numeric type T.
*/
template mostNegative(T)
if (isNumeric!T || isSomeChar!T || isBoolean!T)
if (isNumeric!T || isSomeChar!T || isBoolean!T)
{
static if (is(typeof(T.min_normal)))
enum mostNegative = -T.max;
@ -7631,7 +7635,7 @@ Get the type that a scalar type `T` will $(LINK2 $(ROOT_DIR)spec/type.html#integ
to in multi-term arithmetic expressions.
*/
template Promoted(T)
if (isScalarType!T)
if (isScalarType!T)
{
alias Promoted = CopyTypeQualifiers!(T, typeof(T.init + T.init));
}
@ -7677,7 +7681,7 @@ might be more convenient in generic code, e.g. as a template argument
when invoking staticMap.
*/
template mangledName(sth...)
if (sth.length == 1)
if (sth.length == 1)
{
enum string mangledName = sth[0].mangleof;
}
@ -7731,7 +7735,8 @@ version(unittest) void freeFunc(string);
Aliases itself to $(D T[0]) if the boolean $(D condition) is $(D true)
and to $(D T[1]) otherwise.
*/
template Select(bool condition, T...) if (T.length == 2)
template Select(bool condition, T...)
if (T.length == 2)
{
import std.meta : Alias;
alias Select = Alias!(T[!condition]);
@ -8259,7 +8264,8 @@ enum ifTestable(T, alias pred = a => a) = __traits(compiles, { if (pred(T.init))
* Returns:
* `true` if `X` is a type, `false` otherwise
*/
template isType(X...) if (X.length == 1)
template isType(X...)
if (X.length == 1)
{
enum isType = is(X[0]);
}
@ -8302,7 +8308,8 @@ template isType(X...) if (X.length == 1)
* Use $(LREF isFunctionPointer) or $(LREF isDelegate) for detecting those types
* respectively.
*/
template isFunction(X...) if (X.length == 1)
template isFunction(X...)
if (X.length == 1)
{
static if (is(typeof(&X[0]) U : U*) && is(U == function) ||
is(typeof(&X[0]) U == delegate))
@ -8338,7 +8345,8 @@ template isFunction(X...) if (X.length == 1)
* Returns:
* `true` if `X` is final, `false` otherwise
*/
template isFinal(X...) if (X.length == 1)
template isFinal(X...)
if (X.length == 1)
{
static if (is(X[0] == class))
enum isFinal = __traits(isFinalClass, X[0]);

View file

@ -419,13 +419,13 @@ private:
// Used in Tuple.toString
private template sharedToString(alias field)
if (is(typeof(field) == shared))
if (is(typeof(field) == shared))
{
static immutable sharedToString = typeof(field).stringof;
}
private template sharedToString(alias field)
if (!is(typeof(field) == shared))
if (!is(typeof(field) == shared))
{
alias sharedToString = field;
}
@ -1326,7 +1326,7 @@ if (distinctFieldNames!(Specs))
A new `Tuple`.
*/
auto reverse(T)(T t)
if (isTuple!T)
if (isTuple!T)
{
import std.meta : Reverse;
// @@@BUG@@@ Cannot be an internal function due to forward reference issues.
@ -1349,7 +1349,7 @@ auto reverse(T)(T t)
/* Get a Tuple type with the reverse specification of Tuple T. */
private template ReverseTupleType(T)
if (isTuple!T)
if (isTuple!T)
{
static if (is(T : Tuple!A, A...))
alias ReverseTupleType = Tuple!(ReverseTupleSpecs!A);
@ -1946,7 +1946,7 @@ enum isTuple(T) = __traits(compiles,
// used by both Rebindable and UnqualRef
private mixin template RebindableCommon(T, U, alias This)
if (is(T == class) || is(T == interface) || isAssociativeArray!T)
if (is(T == class) || is(T == interface) || isAssociativeArray!T)
{
private union
{
@ -2005,7 +2005,7 @@ Params:
T = An object, interface, array slice type, or associative array type.
*/
template Rebindable(T)
if (is(T == class) || is(T == interface) || isDynamicArray!T || isAssociativeArray!T)
if (is(T == class) || is(T == interface) || isDynamicArray!T || isAssociativeArray!T)
{
static if (is(T == const U, U) || is(T == immutable U, U))
{
@ -2076,7 +2076,7 @@ Returns:
A newly constructed `Rebindable` initialized with the given reference.
*/
Rebindable!T rebindable(T)(T obj)
if (is(T == class) || is(T == interface) || isDynamicArray!T || isAssociativeArray!T)
if (is(T == class) || is(T == interface) || isDynamicArray!T || isAssociativeArray!T)
{
typeof(return) ret;
ret = obj;
@ -2199,7 +2199,7 @@ Rebindable!T rebindable(T)(Rebindable!T obj)
T = A class or interface type.
*/
template UnqualRef(T)
if (is(T == class) || is(T == interface))
if (is(T == class) || is(T == interface))
{
static if (is(T == const U, U)
|| is(T == immutable U, U)
@ -3235,7 +3235,7 @@ $(D this) must not be in the null state.
/// ditto
auto nullable(alias nullValue, T)(T t)
if (is (typeof(nullValue) == T))
if (is (typeof(nullValue) == T))
{
return Nullable!(T, nullValue)(t);
}
@ -3948,7 +3948,7 @@ $(UL
)
*/
class AutoImplement(Base, alias how, alias what = isAbstractFunction) : Base
if (!is(how == class))
if (!is(how == class))
{
private alias autoImplement_helper_ =
AutoImplement_Helper!("autoImplement_helper_", "Base", Base, typeof(this), how, what);
@ -3959,7 +3959,7 @@ class AutoImplement(Base, alias how, alias what = isAbstractFunction) : Base
class AutoImplement(
Interface, BaseClass, alias how,
alias what = isAbstractFunction) : BaseClass, Interface
if (is(Interface == interface) && is(BaseClass == class))
if (is(Interface == interface) && is(BaseClass == class))
{
private alias autoImplement_helper_ = AutoImplement_Helper!(
"autoImplement_helper_", "Interface", Interface, typeof(this), how, what);
@ -7028,7 +7028,7 @@ It's illegal to move a class instance even if you are sure there
are no pointers to it. As such, it is illegal to move a scoped object.
*/
template scoped(T)
if (is(T == class))
if (is(T == class))
{
// _d_newclass now use default GC alignment (looks like (void*).sizeof * 2 for
// small objects). We will just use the maximum of filed alignments.
@ -7166,7 +7166,7 @@ template scoped(T)
}
private uintptr_t _alignUp(uintptr_t alignment)(uintptr_t n)
if (alignment > 0 && !((alignment - 1) & alignment))
if (alignment > 0 && !((alignment - 1) & alignment))
{
enum badEnd = alignment - 1; // 0b11, 0b111, ...
return (n + badEnd) & ~badEnd;
@ -7624,7 +7624,8 @@ final switch (e)
}
----
*/
struct BitFlags(E, Flag!"unsafe" unsafe = No.unsafe) if (unsafe || isBitFlagEnum!(E))
struct BitFlags(E, Flag!"unsafe" unsafe = No.unsafe)
if (unsafe || isBitFlagEnum!(E))
{
@safe @nogc pure nothrow:
private: