llvm-project/clang/unittests/Format
Martin Probst 325ff7c5e0 clang-format: [JS] wrap optional properties in type aliases.
Summary:
clang-format wraps object literal keys in an object literal if they are
marked as `TT_SelectorName`s and/or the colon is marked as
`TT_DictLiteral`. Previously, clang-format would accidentally work
because colons in type aliases were marked as `TT_DictLiteral`. r310367
fixed this to assing `TT_JsTypeColon`, which broke wrapping in certain
situations. However the root cause was that clang-format incorrectly
didn't skip questionmarks when detecting selector name.

This change fixes both locations to (1) assign `TT_SelectorName` and (2)
treat `TT_JsTypeColon` like `TT_DictLiteral`.

Previously:

    type X = {
      a: string, b?: string,
    };

Now:

    type X = {
      a: string,
      b?: string,
    };

Reviewers: djasper, sammccall

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D36684

llvm-svn: 310852
2017-08-14 16:09:08 +00:00
..
CMakeLists.txt [clang-format] Support text proto messages 2017-07-03 15:05:14 +00:00
CleanupTest.cpp clang-format: [JS] do not clean up duplicated commas. 2017-05-29 08:41:11 +00:00
FormatTest.cpp clang-format: Fix left pointer alignment after delctype/typeof 2017-08-14 11:06:07 +00:00
FormatTestComments.cpp [clang-format] Fix comment levels between '} else {' and PPDirective. 2017-07-24 14:51:59 +00:00
FormatTestJS.cpp clang-format: [JS] wrap optional properties in type aliases. 2017-08-14 16:09:08 +00:00
FormatTestJava.cpp [clang-format] Put '/**' and '*/' on own lines in multiline jsdocs 2017-07-20 22:29:39 +00:00
FormatTestObjC.cpp [clang-format] Remove unused using directive, NFC 2017-05-24 12:15:42 +00:00
FormatTestProto.cpp [clang-format] Fix indent of 'key <...>' and 'key {...}' in text protos 2017-08-03 14:17:29 +00:00
FormatTestSelective.cpp [clang-format] Handle trailing comment sections in import statement lines 2017-05-19 10:34:57 +00:00
FormatTestTextProto.cpp [clang-format] Fix indent of 'key <...>' and 'key {...}' in text protos 2017-08-03 14:17:29 +00:00
FormatTestUtils.h Header guard canonicalization, clang part. 2014-08-13 16:25:19 +00:00
NamespaceEndCommentsFixerTest.cpp clang-format: fix block OpeningLineIndex around preprocessor 2017-07-28 07:56:14 +00:00
SortImportsTestJS.cpp clang-format: [JS] support default imports. 2017-08-01 15:54:43 +00:00
SortIncludesTest.cpp [clang-format] Switch to case-insensitive header matching and use it to 2017-06-29 23:20:54 +00:00
UsingDeclarationsSorterTest.cpp [clang-format] Support sorting using declarations 2017-06-21 12:03:12 +00:00