From 856961b84ceb96098fba52ddac76c9d3ed0b0032 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Oct 2017 17:20:10 -0700 Subject: [PATCH] Add regression test for #18668 (#19085) --- .../castFunctionExpressionShouldBeParenthesized.js | 5 +++++ ...astFunctionExpressionShouldBeParenthesized.symbols | 4 ++++ .../castFunctionExpressionShouldBeParenthesized.types | 11 +++++++++++ .../castFunctionExpressionShouldBeParenthesized.ts | 1 + 4 files changed, 21 insertions(+) create mode 100644 tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.js create mode 100644 tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.symbols create mode 100644 tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.types create mode 100644 tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts diff --git a/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.js b/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.js new file mode 100644 index 00000000000..e96b93bae85 --- /dev/null +++ b/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.js @@ -0,0 +1,5 @@ +//// [castFunctionExpressionShouldBeParenthesized.ts] +(function a() { } as any)().foo() + +//// [castFunctionExpressionShouldBeParenthesized.js] +(function a() { }().foo()); diff --git a/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.symbols b/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.symbols new file mode 100644 index 00000000000..975a9480c3c --- /dev/null +++ b/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts === +(function a() { } as any)().foo() +>a : Symbol(a, Decl(castFunctionExpressionShouldBeParenthesized.ts, 0, 1)) + diff --git a/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.types b/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.types new file mode 100644 index 00000000000..337c5163ff2 --- /dev/null +++ b/tests/baselines/reference/castFunctionExpressionShouldBeParenthesized.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts === +(function a() { } as any)().foo() +>(function a() { } as any)().foo() : any +>(function a() { } as any)().foo : any +>(function a() { } as any)() : any +>(function a() { } as any) : any +>function a() { } as any : any +>function a() { } : () => void +>a : () => void +>foo : any + diff --git a/tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts b/tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts new file mode 100644 index 00000000000..3fb1aaf7079 --- /dev/null +++ b/tests/cases/compiler/castFunctionExpressionShouldBeParenthesized.ts @@ -0,0 +1 @@ +(function a() { } as any)().foo() \ No newline at end of file