diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -3191,11 +3191,6 @@ if (Left.is(TT_CSharpNullCoalescing) || Right.is(TT_CSharpNullCoalescing)) return true; - // Space before and after '??='. - if (Left.is(TT_CSharpNullCoalescingAssignment) || - Right.is(TT_CSharpNullCoalescingAssignment)) - return true; - // No space before null forgiving '!'. if (Right.is(TT_JsNonNullAssertion)) return false; diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp --- a/clang/unittests/Format/FormatTestCSharp.cpp +++ b/clang/unittests/Format/FormatTestCSharp.cpp @@ -359,8 +359,16 @@ } TEST_F(FormatTestCSharp, CSharpNullCoalescingAssignment) { - verifyFormat("test \?\?= ABC;"); - verifyFormat("test \?\?= true;"); + FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); + Style.SpaceBeforeAssignmentOperators = true; + + verifyFormat("test \?\?= ABC;", Style); + verifyFormat("test \?\?= true;", Style); + + Style.SpaceBeforeAssignmentOperators = false; + + verifyFormat("test\?\?= ABC;", Style); + verifyFormat("test\?\?= true;", Style); } TEST_F(FormatTestCSharp, CSharpNullForgiving) {