summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp10
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 2fe1e24709c..56f1841222c 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2958,7 +2958,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
return false;
if (Left.is(TT_JsTypeColon))
return true;
- if (Right.NestingLevel == 0 && Right.is(Keywords.kw_is))
+ if (Right.is(Keywords.kw_is))
return false;
if (Left.is(Keywords.kw_in))
return Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None;
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) {
OpenPOWER on IntegriCloud