diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 12bd8fe..5a9f896 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -224,7 +224,7 @@ private: else if (currentIs(tok!"return")) { writeToken(); - if (!currentIs(tok!";") && !currentIs(tok!")")) + if (!currentIs(tok!";") && !currentIs(tok!")") && !currentIs(tok!"{")) write(" "); } else if (currentIs(tok!"with")) diff --git a/tests/allman/issue0515.d.ref b/tests/allman/issue0515.d.ref new file mode 100644 index 0000000..55d01d9 --- /dev/null +++ b/tests/allman/issue0515.d.ref @@ -0,0 +1,7 @@ +struct S +{ + ref S foo() return + { + return this; + } +} diff --git a/tests/issue0515.d b/tests/issue0515.d new file mode 100644 index 0000000..55d01d9 --- /dev/null +++ b/tests/issue0515.d @@ -0,0 +1,7 @@ +struct S +{ + ref S foo() return + { + return this; + } +} diff --git a/tests/otbs/issue0515.d.ref b/tests/otbs/issue0515.d.ref new file mode 100644 index 0000000..05d4164 --- /dev/null +++ b/tests/otbs/issue0515.d.ref @@ -0,0 +1,5 @@ +struct S { + ref S foo() return { + return this; + } +}