Skip to content

Commit ff108c0

Browse files
committed
Adding regression test
1 parent b88269b commit ff108c0

File tree

4 files changed

+142
-0
lines changed

4 files changed

+142
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//// [controlFlowIteration.ts]
2+
3+
let cond: boolean;
4+
5+
function ff() {
6+
let x: string | undefined;
7+
while (true) {
8+
if (cond) {
9+
x = "";
10+
}
11+
else {
12+
if (x) {
13+
x.length;
14+
}
15+
if (x) {
16+
x.length;
17+
}
18+
}
19+
}
20+
}
21+
22+
23+
//// [controlFlowIteration.js]
24+
var cond;
25+
function ff() {
26+
var x;
27+
while (true) {
28+
if (cond) {
29+
x = "";
30+
}
31+
else {
32+
if (x) {
33+
x.length;
34+
}
35+
if (x) {
36+
x.length;
37+
}
38+
}
39+
}
40+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowIteration.ts ===
2+
3+
let cond: boolean;
4+
>cond : Symbol(cond, Decl(controlFlowIteration.ts, 1, 3))
5+
6+
function ff() {
7+
>ff : Symbol(ff, Decl(controlFlowIteration.ts, 1, 18))
8+
9+
let x: string | undefined;
10+
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
11+
12+
while (true) {
13+
if (cond) {
14+
>cond : Symbol(cond, Decl(controlFlowIteration.ts, 1, 3))
15+
16+
x = "";
17+
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
18+
}
19+
else {
20+
if (x) {
21+
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
22+
23+
x.length;
24+
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
25+
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
26+
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
27+
}
28+
if (x) {
29+
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
30+
31+
x.length;
32+
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
33+
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
34+
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
35+
}
36+
}
37+
}
38+
}
39+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowIteration.ts ===
2+
3+
let cond: boolean;
4+
>cond : boolean
5+
6+
function ff() {
7+
>ff : () => void
8+
9+
let x: string | undefined;
10+
>x : string | undefined
11+
12+
while (true) {
13+
>true : boolean
14+
15+
if (cond) {
16+
>cond : boolean
17+
18+
x = "";
19+
>x = "" : string
20+
>x : string | undefined
21+
>"" : string
22+
}
23+
else {
24+
if (x) {
25+
>x : string | undefined
26+
27+
x.length;
28+
>x.length : number
29+
>x : string
30+
>length : number
31+
}
32+
if (x) {
33+
>x : string | undefined
34+
35+
x.length;
36+
>x.length : number
37+
>x : string
38+
>length : number
39+
}
40+
}
41+
}
42+
}
43+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @strictNullChecks: true
2+
3+
let cond: boolean;
4+
5+
function ff() {
6+
let x: string | undefined;
7+
while (true) {
8+
if (cond) {
9+
x = "";
10+
}
11+
else {
12+
if (x) {
13+
x.length;
14+
}
15+
if (x) {
16+
x.length;
17+
}
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)