From bfa4197ffe610354efb382a5ef772ed3bf70c3c1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 13 Oct 2016 13:29:08 -0700 Subject: [PATCH] Update tests --- tests/cases/compiler/controlFlowArrayErrors.ts | 10 +++++----- tests/cases/compiler/controlFlowArrays.ts | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/cases/compiler/controlFlowArrayErrors.ts b/tests/cases/compiler/controlFlowArrayErrors.ts index aab3a974cd8..08107ff3659 100644 --- a/tests/cases/compiler/controlFlowArrayErrors.ts +++ b/tests/cases/compiler/controlFlowArrayErrors.ts @@ -3,16 +3,16 @@ declare function cond(): boolean; function f1() { - let x = []; - let y = x; // Implicit any[] error + let x = []; // Implicit any[] error in some locations + let y = x; // Implicit any[] error x.push(5); let z = x; } function f2() { - let x; + let x; // Implicit any[] error in some locations x = []; - let y = x; // Implicit any[] error + let y = x; // Implicit any[] error x.push(5); let z = x; } @@ -21,7 +21,7 @@ function f3() { let x = []; // Implicit any[] error in some locations x.push(5); function g() { - x; // Implicit any[] error + x; // Implicit any[] error } } diff --git a/tests/cases/compiler/controlFlowArrays.ts b/tests/cases/compiler/controlFlowArrays.ts index 160f0efed17..646c85f069f 100644 --- a/tests/cases/compiler/controlFlowArrays.ts +++ b/tests/cases/compiler/controlFlowArrays.ts @@ -115,13 +115,19 @@ function f10() { function f11() { let x = []; - return x; // never[] + if (x.length === 0) { // x.length ok on implicit any[] + x.push("hello"); + } + return x; } function f12() { let x; x = []; - return x; // never[] + if (x.length === 0) { // x.length ok on implicit any[] + x.push("hello"); + } + return x; } function f13() {