diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 7e4c3bc..5318e59 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -709,7 +709,8 @@ private: write(" "); break; case tok!"is": - if (!peekBackIsOneOf(false, tok!"!", tok!"(", tok!",", tok!"}", tok!"=") && !peekBackIsKeyword()) + if (!peekBackIsOneOf(false, tok!"!", tok!"(", tok!",", tok!"}", tok!"=", + tok!"&&", tok!"||") && !peekBackIsKeyword()) write(" "); writeToken(); if (!currentIs(tok!"(") && !currentIs(tok!"{")) diff --git a/tests/allman/issue0154.d.ref b/tests/allman/issue0154.d.ref new file mode 100644 index 0000000..5db8a6b --- /dev/null +++ b/tests/allman/issue0154.d.ref @@ -0,0 +1,7 @@ +class Foo(T) if (is(T : Bar) && is(T : Baz)) +{ +} + +class Foo(T) if (is(T : Bar) || is(T : Baz)) +{ +} diff --git a/tests/issue0154.d b/tests/issue0154.d new file mode 100644 index 0000000..3367290 --- /dev/null +++ b/tests/issue0154.d @@ -0,0 +1,6 @@ + +class Foo(T) if (is(T : Bar) && is(T : Baz)) +{} + +class Foo(T) if (is(T : Bar) || is(T : Baz)) +{} diff --git a/tests/otbs/issue0154.d.ref b/tests/otbs/issue0154.d.ref new file mode 100644 index 0000000..14d242d --- /dev/null +++ b/tests/otbs/issue0154.d.ref @@ -0,0 +1,5 @@ +class Foo(T) if (is(T : Bar) && is(T : Baz)) { +} + +class Foo(T) if (is(T : Bar) || is(T : Baz)) { +}