clang-format: [JS] Support semicolons in TypeScript's TypeMemberLists.
Before:
var x: {
a: string;
b: number;
}
= {};
After:
var x: {a: string; b: number;} = {};
llvm-svn: 257255
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 7514c43..a35a86e 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -731,10 +731,14 @@
TEST_F(FormatTestJS, TypeAnnotations) {
verifyFormat("var x: string;");
+ verifyFormat("var x: {a: string; b: number;} = {};");
verifyFormat("function x(): string {\n return 'x';\n}");
verifyFormat("function x(): {x: string} {\n return {x: 'x'};\n}");
verifyFormat("function x(y: string): string {\n return 'x';\n}");
verifyFormat("for (var y: string in x) {\n x();\n}");
+ verifyFormat("function x(y: {a?: number;} = {}): number {\n"
+ " return 12;\n"
+ "}");
verifyFormat("((a: string, b: number): string => a + b);");
verifyFormat("var x: (y: number) => string;");
verifyFormat("var x: P<string, (a: number) => string>;");
@@ -764,6 +768,10 @@
verifyFormat("foo = class {\n"
" constructor() {}\n"
"};");
+ verifyFormat("class C {\n"
+ " x: {y: Z;} = {};\n"
+ " private y: {y: Z;} = {};\n"
+ "}");
// ':' is not a type declaration here.
verifyFormat("class X {\n"