diff options
-rw-r--r-- | clang/lib/Format/UnwrappedLineFormatter.cpp | 3 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 888c69176ec..fb1e8dd6842 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -239,7 +239,8 @@ private: } else if (Limit != 0 && Line.First->isNot(tok::kw_namespace) && !startsExternCBlock(Line)) { // We don't merge short records. - if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct)) + if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct, + Keywords.kw_interface)) return 0; // Check that we still have three lines and they fit into the limit. diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index a7d8dd3effa..0c36dce93dd 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -547,6 +547,12 @@ TEST_F(FormatTestJS, ClassDeclarations) { verifyFormat("class C extends p.P implements i.I {}"); } +TEST_F(FormatTestJS, InterfaceDeclarations) { + verifyFormat("interface I {\n" + " x: string;\n" + "}"); +} + TEST_F(FormatTestJS, MetadataAnnotations) { verifyFormat("@A\nclass C {\n}"); verifyFormat("@A({arg: 'value'})\nclass C {\n}"); |