From ec36326d85c7ba2332e508f7dc55fdbb1757c576 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Tue, 1 Aug 2017 17:19:32 +0000 Subject: clang-format: [JS] handle union types in arrow functions. Summary: clang-format would previously fail to detect that an arrow functions parameter block is not an expression, and thus insert whitespace around the `|` and `&` type operators in it. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36147 llvm-svn: 309707 --- clang/unittests/Format/FormatTestJS.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 54e2c8fbe95..231026b7c61 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -988,6 +988,9 @@ TEST_F(FormatTestJS, ArrowFunctions) { " .doSomethingElse(\n" " // break\n" " );"); + verifyFormat("const f = (x: string|null): string|null => {\n" + " return x;\n" + "}\n"); } TEST_F(FormatTestJS, ReturnStatements) { -- cgit v1.2.3