<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54974>54974</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] CompactNamespaces not working as expected when BraceWrapping.AfterNamespace is true
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tcs-devel
      </td>
    </tr>
</table>

<pre>
    Option `CompactNamespaces` does not work as expected when also using `BraceWrapping.AfterNamespace`

output with `CompactNamespaces: true` and `BraceWrapping.AfterNamespace: false` (OK):
```
namespace A { namespace B { namespace C {

}}} // namespace A::B::C
```


output with `CompactNamespaces: true` and `BraceWrapping.AfterNamespace: true` (NOK?):
```
namespace A
{
namespace B
{
   namespace C
   {

   }
} // namespace B
} // namespace A
```

expected output with `CompactNamespaces: true` and `BraceWrapping.AfterNamespace: true`: (only the last opening brace is wrapped)
```
namespace A { namespace B { namespace C
{

}}} // namespace A::B::C
```

....using clang-format.exe 14.0.0.0
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VEuPmzAQ_jXmMgoCQxZy4ACJcqm0e-zZ4OHROhhhs9n99x1Dk41ItK3ULljG8_A3M58Hl1q-Zy-D7XQP7CnY69MgKvssTmhogYZ0IDUa6LWFsx5_gjCAbwNWFiWcW-xBKKNhMl3fOIRipG3fRzEMpPDz2uJ4RSMzCw4syJdZT3aYCLWz7ePYUQ52nNw2EL38Izq515TM7M94-vKN8R0pf4ek2MuYxf6yC3JgSQEfcrGS906-TZslh2VQkCONG9_chYvyYvnsH0b-YgYu7kTAMzEQHf-OhEtpxdpSrCwAt9xcdSuOZs3hytc9U8UntsfJLvO19b6OOrck9nSv3sG2CEoYC3rA3nV46TCgM3B2OCgdu__YXyuC_2OT-fQsP2alRN9saj2ehPXxDSGM_cC9nswiuYt2wrOdVZixbXHry7YHuKP2ehc45Lvr4DOWHXGOZW8aVdZaO7hjWgps6CCn0q_0iQSlXi-fzTDqHwRPYmfMRAfLj9t4l8Rem5WB3IZVjLyOS6zCVAgRVhVyGW3ToI6Fp0SJyriiGOc9nmGGoDXV5XUZDzgP4nAXpFESJn4i6zRIklKWkj9FVcriAE-iU77Lw9dj443ZnFI5NYaMqjPWfBiFMV3T48yhwxeTbfWY2cpsJL6i8ubg2Zz8L6Gnpdo">