diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 83bbb549a504b..e946b8dde0b8c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21673,6 +21673,12 @@ namespace ts { } } + function addSharedFlowType(flow: FlowNode, type: FlowType): void { + sharedFlowNodes[sharedFlowCount] = flow; + sharedFlowTypes[sharedFlowCount] = type; + sharedFlowCount++; + } + function getFlowTypeOfReference(reference: Node, declaredType: Type, initialType = declaredType, flowContainer?: Node, couldBeUninitialized?: boolean) { let key: string | undefined; let isKeySet = false; @@ -21715,6 +21721,7 @@ namespace ts { return errorType; } flowDepth++; + let sharedFlow: FlowNode | undefined; while (true) { const flags = flow.flags; if (flags & FlowFlags.Shared) { @@ -21727,6 +21734,12 @@ namespace ts { return sharedFlowTypes[i]; } } + + // Keep track of the shared flow that is seen first to ensure that the + // computed type is saved in the shared flow type cache. + if (!sharedFlow) { + sharedFlow = flow; + } } let type: FlowType | undefined; if (flags & FlowFlags.Assignment) { @@ -21790,11 +21803,15 @@ namespace ts { // simply return the non-auto declared type to reduce follow-on errors. type = convertAutoToAny(declaredType); } - if (flags & FlowFlags.Shared) { - // Record visited node and the associated type in the cache. - sharedFlowNodes[sharedFlowCount] = flow; - sharedFlowTypes[sharedFlowCount] = type; - sharedFlowCount++; + if (sharedFlow) { + // If the type for a shared flow was computed, record the associated type in the cache. + addSharedFlowType(sharedFlow, type); + + // If a shared flow was iterated over and the current flow is also shared, + // then also record the associated type with the current flow. + if (flow !== sharedFlow && flags & FlowFlags.Shared) { + addSharedFlowType(flow, type); + } } flowDepth--; return type; diff --git a/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js new file mode 100644 index 0000000000000..67d874126ea07 --- /dev/null +++ b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.js @@ -0,0 +1,125 @@ +//// [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] +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..913da921c38dc --- /dev/null +++ b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.symbols @@ -0,0 +1,292 @@ +=== 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..f6241fb55e0d4 --- /dev/null +++ b/tests/baselines/reference/controlFlowManyCallExpressionStatementsPerf.types @@ -0,0 +1,461 @@ +=== 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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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 : boolean +>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..00805a485f618 --- /dev/null +++ b/tests/cases/compiler/controlFlowManyCallExpressionStatementsPerf.ts @@ -0,0 +1,62 @@ +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); +} \ No newline at end of file