Reviewers: krasimir
Reviewed By: krasimir
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D75984
// interpolated strings. Interpolated strings are merged into a single token
// so cannot have spaces inserted by this function.
+ // No space between 'this' and '['
+ if (Left.is(tok::kw_this) && Right.is(tok::l_square))
+ return false;
+
+ // No space between 'new' and '('
+ if (Left.is(tok::kw_new) && Right.is(tok::l_paren))
+ return false;
+
// Space before { (including space within '{ {').
if (Right.is(tok::l_brace))
return true;
verifyFormat(R"(taskContext.Factory.Run(async () => doThing(args);)", Style);
verifyFormat(R"(catch (TestException) when (innerFinallyExecuted))", Style);
verifyFormat(R"(private float[,] Values;)", Style);
+ verifyFormat(R"(Result this[Index x] => Foo(x);)", Style);
+ verifyFormat(R"(class ItemFactory<T> where T : new() {})", Style);
Style.SpacesInSquareBrackets = true;
verifyFormat(R"(private float[ , ] Values;)", Style);