diff options
author | Martin Probst <martin@probst.io> | 2018-05-22 10:39:07 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2018-05-22 10:39:07 +0000 |
commit | 7ebad4ea81f7481521c01488734fc4962d380d78 (patch) | |
tree | d7c7b24c54b542b6526525b530de93b1c78d88d4 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 2cfcc01b22f292efc42803d888a12ec356505d6f (diff) | |
download | bcm5719-llvm-7ebad4ea81f7481521c01488734fc4962d380d78.tar.gz bcm5719-llvm-7ebad4ea81f7481521c01488734fc4962d380d78.zip |
clang-format: [JS] do not wrap before any `is`.
Summary:
`is` type annotations can occur at any nesting level. For example:
function x() {
return function y(): a is B { ... };
}
Breaking before the `is` above breaks TypeScript parsing the code. This
change prevents the wrap.
Reviewers: krasimir
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D47193
llvm-svn: 332968
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 0a5c991b36d..1d610555778 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1164,7 +1164,15 @@ TEST_F(FormatTestJS, WrapRespectsAutomaticSemicolonInsertion) { verifyFormat("await theReckoning;", getGoogleJSStyleWithColumns(10)); verifyFormat("some['a']['b']", getGoogleJSStyleWithColumns(10)); verifyFormat("x = (a['a']\n" - " ['b']);", getGoogleJSStyleWithColumns(10)); + " ['b']);", + getGoogleJSStyleWithColumns(10)); + verifyFormat("function f() {\n" + " return foo.bar(\n" + " (param): param is {\n" + " a: SomeType\n" + " }&ABC => 1)\n" + "}", + getGoogleJSStyleWithColumns(25)); } TEST_F(FormatTestJS, AutomaticSemicolonInsertionHeuristic) { |