From 3c736255e407f75a0faa6b70ad8b290d084f948e Mon Sep 17 00:00:00 2001 From: Joost Koehoorn Date: Thu, 10 Dec 2020 03:33:51 +0100 Subject: [PATCH] Properly cache types for shared control flow nodes (#41665) (#41906) * Properly cache shared flow node types * Add test Co-authored-by: Anders Hejlsberg --- src/compiler/checker.ts | 6 +- ...rolFlowManyCallExpressionStatementsPerf.js | 127 +++++ ...owManyCallExpressionStatementsPerf.symbols | 293 +++++++++++ ...FlowManyCallExpressionStatementsPerf.types | 462 ++++++++++++++++++ ...rolFlowManyCallExpressionStatementsPerf.ts | 64 +++ 5 files changed, 950 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js create mode 100644 tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.symbols create mode 100644 tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.types create mode 100644 tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c3643a7f7f0ee..1ac7a4475fdc4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21702,6 +21702,7 @@ namespace ts { return errorType; } flowDepth++; + let sharedFlow: FlowNode | undefined; while (true) { const flags = flow.flags; if (flags & FlowFlags.Shared) { @@ -21714,6 +21715,7 @@ namespace ts { return sharedFlowTypes[i]; } } + sharedFlow = flow; } let type: FlowType | undefined; if (flags & FlowFlags.Assignment) { @@ -21777,9 +21779,9 @@ namespace ts { // simply return the non-auto declared type to reduce follow-on errors. type = convertAutoToAny(declaredType); } - if (flags & FlowFlags.Shared) { + if (sharedFlow) { // Record visited node and the associated type in the cache. - sharedFlowNodes[sharedFlowCount] = flow; + sharedFlowNodes[sharedFlowCount] = sharedFlow; sharedFlowTypes[sharedFlowCount] = type; sharedFlowCount++; } diff --git a/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js new file mode 100644 index 0000000000000..0198ae5327e85 --- /dev/null +++ b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js @@ -0,0 +1,127 @@ +//// [controlFlowManyCallExpressionStatementsPerf.ts] +function test(x: boolean): boolean { return x; } + +let state = true; + +if (state) { + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); +} + + +//// [controlFlowManyCallExpressionStatementsPerf.js] +"use strict"; +function test(x) { return x; } +var state = true; +if (state) { + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); + test(state && state); +} diff --git a/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.symbols b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.symbols new file mode 100644 index 0000000000000..0f0f3124e7b36 --- /dev/null +++ b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.symbols @@ -0,0 +1,293 @@ +=== tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts === +function test(x: boolean): boolean { return x; } +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>x : Symbol(x, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 14)) +>x : Symbol(x, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 14)) + +let state = true; +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + +if (state) { +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) + + test(state as any && state); +>test : Symbol(test, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 0, 0)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +>state : Symbol(state, Decl(controlFlowManyCallExpressionStatementsPerf.ts, 2, 3)) +} + diff --git a/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.types b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.types new file mode 100644 index 0000000000000..bbc68ee76c870 --- /dev/null +++ b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.types @@ -0,0 +1,462 @@ +=== tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts === +function test(x: boolean): boolean { return x; } +>test : (x: boolean) => boolean +>x : boolean +>x : boolean + +let state = true; +>state : boolean +>true : true + +if (state) { +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true + + test(state as any && state); +>test(state as any && state) : boolean +>test : (x: boolean) => boolean +>state as any && state : any +>state as any : any +>state : true +>state : true +} + diff --git a/tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts b/tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts new file mode 100644 index 0000000000000..670f8c05d16a7 --- /dev/null +++ b/tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts @@ -0,0 +1,64 @@ +// @strict: true + +function test(x: boolean): boolean { return x; } + +let state = true; + +if (state) { + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); + test(state as any && state); +}