Before, this couldn't be formatted at all:
class X {
subs = {
'b': {
'c': 1,
},
};
}
llvm-svn: 238907
!Line.First->isOneOf(tok::kw_enum, tok::kw_case)) ||
Contexts.back().ContextKind == tok::l_paren || // function params
Contexts.back().ContextKind == tok::l_square || // array type
- Line.MustBeDeclaration) { // method/property declaration
+ (Contexts.size() == 1 &&
+ Line.MustBeDeclaration)) { // method/property declaration
Tok->Type = TT_JsTypeColon;
break;
}
verifyFormat("class C {\n static x(): string { return 'asd'; }\n}");
verifyFormat("class C extends P implements I {}");
verifyFormat("class C extends p.P implements i.I {}");
+
+ // ':' is not a type declaration here.
+ verifyFormat("class X {\n"
+ " subs = {\n"
+ " 'b': {\n"
+ " 'c': 1,\n"
+ " },\n"
+ " };\n"
+ "}");
}
TEST_F(FormatTestJS, InterfaceDeclarations) {