Skip to content

Commit bfa4197

Browse files
committed
Update tests
1 parent bf301e9 commit bfa4197

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

tests/cases/compiler/controlFlowArrayErrors.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
declare function cond(): boolean;
44

55
function f1() {
6-
let x = [];
7-
let y = x; // Implicit any[] error
6+
let x = []; // Implicit any[] error in some locations
7+
let y = x; // Implicit any[] error
88
x.push(5);
99
let z = x;
1010
}
1111

1212
function f2() {
13-
let x;
13+
let x; // Implicit any[] error in some locations
1414
x = [];
15-
let y = x; // Implicit any[] error
15+
let y = x; // Implicit any[] error
1616
x.push(5);
1717
let z = x;
1818
}
@@ -21,7 +21,7 @@ function f3() {
2121
let x = []; // Implicit any[] error in some locations
2222
x.push(5);
2323
function g() {
24-
x; // Implicit any[] error
24+
x; // Implicit any[] error
2525
}
2626
}
2727

tests/cases/compiler/controlFlowArrays.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,19 @@ function f10() {
115115

116116
function f11() {
117117
let x = [];
118-
return x; // never[]
118+
if (x.length === 0) { // x.length ok on implicit any[]
119+
x.push("hello");
120+
}
121+
return x;
119122
}
120123

121124
function f12() {
122125
let x;
123126
x = [];
124-
return x; // never[]
127+
if (x.length === 0) { // x.length ok on implicit any[]
128+
x.push("hello");
129+
}
130+
return x;
125131
}
126132

127133
function f13() {

0 commit comments

Comments
 (0)