diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 12bd8fe..a364831 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -1401,7 +1401,8 @@ private: break; case tok!".": regenLineBreakHintsIfNecessary(index); - immutable bool ufcsWrap = astInformation.ufcsHintLocations.canFindIndex(current.index); + immutable bool ufcsWrap = config.dfmt_keep_line_breaks == OptionalBoolean.f + && astInformation.ufcsHintLocations.canFindIndex(current.index); if (ufcsWrap || linebreakHints.canFind(index) || onNextLine || (linebreakHints.length == 0 && currentLineLength + nextTokenLength() > config.max_line_length)) { diff --git a/tests/allman/issue0503.d.ref b/tests/allman/issue0503.d.ref new file mode 100644 index 0000000..a939b68 --- /dev/null +++ b/tests/allman/issue0503.d.ref @@ -0,0 +1,15 @@ +string f() +{ + return duration.total!"seconds".to!string; +} + +string g() +{ + return duration.total!"seconds"().to!string; +} + +string h() +{ + return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string + .to!string.to!string.to!string; +} diff --git a/tests/issue0503.args b/tests/issue0503.args new file mode 100644 index 0000000..7e7e52d --- /dev/null +++ b/tests/issue0503.args @@ -0,0 +1 @@ +--keep_line_breaks=true diff --git a/tests/issue0503.d b/tests/issue0503.d new file mode 100644 index 0000000..1025464 --- /dev/null +++ b/tests/issue0503.d @@ -0,0 +1,14 @@ +string f() +{ + return duration.total!"seconds".to!string; +} + +string g() +{ + return duration.total!"seconds"().to!string; +} + +string h() +{ + return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string.to!string.to!string.to!string; +} diff --git a/tests/otbs/issue0503.d.ref b/tests/otbs/issue0503.d.ref new file mode 100644 index 0000000..b27874e --- /dev/null +++ b/tests/otbs/issue0503.d.ref @@ -0,0 +1,12 @@ +string f() { + return duration.total!"seconds".to!string; +} + +string g() { + return duration.total!"seconds"().to!string; +} + +string h() { + return duration.total!"seconds"().to!string.to!string.to!string.to!string.to!string.to!string + .to!string.to!string.to!string; +}