diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2023-12-22 14:41:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-22 14:41:38 +0100 |
commit | d03beb94195ae6889d3075dabe64d58c9ab5d1d2 (patch) | |
tree | e73db5c19ccab602b9d3e3ca8478318724ad4db4 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 48b9106656870912dd68f3b3f24012f6f8dbee52 (diff) | |
download | llvm-d03beb94195ae6889d3075dabe64d58c9ab5d1d2.zip llvm-d03beb94195ae6889d3075dabe64d58c9ab5d1d2.tar.gz llvm-d03beb94195ae6889d3075dabe64d58c9ab5d1d2.tar.bz2 |
[clang-format] Do not break on JS fields like on goto labels (#76233)
This regressions was introduced in
70d7ea0cebcf363cd0ddcfb76375fb5fada87dd5.
The commit moved some code and correctly picked up an explicit check for
not running on Verilog.
However, the moved code also never ran for JavaScript and after the
commit we run it there and
this causes the wrong formatting of:
```js
export type Params = Config&{
columns: Column[];
};
```
into
```js
export type Params = Config&{
columns:
Column[];
};
```
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index e185ece..3aded8f 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -2836,5 +2836,11 @@ TEST_F(FormatTestJS, AlignConsecutiveAssignmentsAndDeclarations) { Style); } +TEST_F(FormatTestJS, DontBreakFieldsAsGoToLabels) { + verifyFormat("export type Params = Config&{\n" + " columns: Column[];\n" + "};"); +} + } // namespace format } // end namespace clang |