Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -1852,6 +1852,10 @@ if (Style.Language == FormatStyle::LK_JavaScript) return TT_BinaryOperator; + // && in C# must be a binary operator. + if (Style.isCSharp() && Tok.is(tok::ampamp)) + return TT_BinaryOperator; + const FormatToken *PrevToken = Tok.getPreviousNonComment(); if (!PrevToken) return TT_UnaryOperator; Index: clang/unittests/Format/FormatTestCSharp.cpp =================================================================== --- clang/unittests/Format/FormatTestCSharp.cpp +++ clang/unittests/Format/FormatTestCSharp.cpp @@ -706,6 +706,9 @@ verifyFormat(R"(char[,,] rawCharArray = MakeCharacterGrid();)", Style); verifyFormat(R"(var (key, value))", Style); + // `&&` is not seen as a reference. + verifyFormat(R"(A == typeof(X) && someBool)", Style); + // Not seen as a C-style cast. verifyFormat(R"(// foreach ((A a, B b) in someList) {