Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[clang-format] Java string literal concatenation does not respect BreakBeforeBinaryOperators option #30561

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR31588
Status NEW
Importance P normal
Reported by jwalczak@opera.com
Reported on 2017-01-09 14:36:26 -0800
Last modified on 2017-01-18 06:06:52 -0800
Version 3.8
Hardware PC Linux
CC djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
*Format settings (.clang-format)*
---
Language: Java
BreakBeforeBinaryOperators: Always
...

*Input:*

// operator+ used with string literals (BUG)
String foo = "aaaaaaaaaaa" + "bbbbbbbbb" + "ccccccccccc" + "ddddddddd" +
"eeeeeeeeeeeeee" + "ffffffffff";

// operator+ used with string literals and variables (BUG)
String foo = aaaaaaaaaaa + "bbbbbbbbb" + ccccccccccc + "ddddddddd" +
"eeeeeeeeeeeeee" + "ffffffffff";

// operator+ used with variables (OK)
String bar = aaaaaaaaaaa + bbbbbbbbb + ccccccccccc + ddddddddd + eeeeeeeeeeeeee
+ ffffffffff;

*Output:*

// operator+ used with string literals (BUG)
String foo = "aaaaaaaaaaa"
             + "bbbbbbbbb"
             + "ccccccccccc"
             + "ddddddddd"
             + "eeeeeeeeeeeeee"
             + "ffffffffff";

// operator+ used with string literals and variables (BUG)
String foo = aaaaaaaaaaa + "bbbbbbbbb" + ccccccccccc + "ddddddddd"
             + "eeeeeeeeeeeeee"
             + "ffffffffff";

// operator+ used with variables (OK)
String bar = aaaaaaaaaaa + bbbbbbbbb + ccccccccccc + ddddddddd +
             eeeeeeeeeeeeee + ffffffffff;
Quuxplusone commented 7 years ago

There should be:

BreakBeforeBinaryOperators: None