Skip to content

Commit d8ec857

Browse files
committed
Add tests
1 parent 1c39cdc commit d8ec857

File tree

2 files changed

+239
-0
lines changed

2 files changed

+239
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// @strictNullChecks: true
2+
3+
declare let cond: boolean;
4+
5+
function f1() {
6+
let x;
7+
if (cond) {
8+
x = 1;
9+
}
10+
if (cond) {
11+
x = "hello";
12+
}
13+
const y = x;
14+
}
15+
16+
function f2() {
17+
let x = undefined;
18+
if (cond) {
19+
x = 1;
20+
}
21+
if (cond) {
22+
x = "hello";
23+
}
24+
const y = x;
25+
}
26+
27+
function f3() {
28+
let x = null;
29+
if (cond) {
30+
x = 1;
31+
}
32+
if (cond) {
33+
x = "hello";
34+
}
35+
const y = x;
36+
}
37+
38+
function f4() {
39+
let x: any;
40+
if (cond) {
41+
x = 1;
42+
}
43+
if (cond) {
44+
x = "hello";
45+
}
46+
const y = x;
47+
}
48+
49+
function f5() {
50+
var x;
51+
if (cond) {
52+
x = 1;
53+
}
54+
if (cond) {
55+
x = "hello";
56+
}
57+
const y = x;
58+
}
59+
60+
function f6() {
61+
var x = undefined;
62+
if (cond) {
63+
x = 1;
64+
}
65+
if (cond) {
66+
x = "hello";
67+
}
68+
const y = x;
69+
}
70+
71+
function f7() {
72+
var x = null;
73+
if (cond) {
74+
x = 1;
75+
}
76+
if (cond) {
77+
x = "hello";
78+
}
79+
const y = x;
80+
}
81+
82+
function f8() {
83+
var x: any;
84+
if (cond) {
85+
x = 1;
86+
}
87+
if (cond) {
88+
x = "hello";
89+
}
90+
const y = x;
91+
}
92+
93+
function f9() {
94+
let x;
95+
if (cond) {
96+
x = 1;
97+
}
98+
if (cond) {
99+
x = "hello";
100+
}
101+
const y = x;
102+
function f() {
103+
const z = x;
104+
}
105+
}
106+
107+
function f10() {
108+
let x;
109+
if (cond) {
110+
x = 1;
111+
}
112+
if (cond) {
113+
x = "hello";
114+
}
115+
const y = x;
116+
const f = () => {
117+
const z = x;
118+
};
119+
}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
// @strictNullChecks: true
2+
// @noImplicitAny: true
3+
4+
declare let cond: boolean;
5+
6+
function f1() {
7+
let x;
8+
if (cond) {
9+
x = 1;
10+
}
11+
if (cond) {
12+
x = "hello";
13+
}
14+
const y = x;
15+
}
16+
17+
function f2() {
18+
let x = undefined;
19+
if (cond) {
20+
x = 1;
21+
}
22+
if (cond) {
23+
x = "hello";
24+
}
25+
const y = x;
26+
}
27+
28+
function f3() {
29+
let x = null;
30+
if (cond) {
31+
x = 1;
32+
}
33+
if (cond) {
34+
x = "hello";
35+
}
36+
const y = x;
37+
}
38+
39+
function f4() {
40+
let x: any;
41+
if (cond) {
42+
x = 1;
43+
}
44+
if (cond) {
45+
x = "hello";
46+
}
47+
const y = x;
48+
}
49+
50+
function f5() {
51+
var x;
52+
if (cond) {
53+
x = 1;
54+
}
55+
if (cond) {
56+
x = "hello";
57+
}
58+
const y = x;
59+
}
60+
61+
function f6() {
62+
var x = undefined;
63+
if (cond) {
64+
x = 1;
65+
}
66+
if (cond) {
67+
x = "hello";
68+
}
69+
const y = x;
70+
}
71+
72+
function f7() {
73+
var x = null;
74+
if (cond) {
75+
x = 1;
76+
}
77+
if (cond) {
78+
x = "hello";
79+
}
80+
const y = x;
81+
}
82+
83+
function f8() {
84+
var x: any;
85+
if (cond) {
86+
x = 1;
87+
}
88+
if (cond) {
89+
x = "hello";
90+
}
91+
const y = x;
92+
}
93+
94+
function f9() {
95+
let x;
96+
if (cond) {
97+
x = 1;
98+
}
99+
if (cond) {
100+
x = "hello";
101+
}
102+
const y = x;
103+
function f() {
104+
const z = x;
105+
}
106+
}
107+
108+
function f10() {
109+
let x;
110+
if (cond) {
111+
x = 1;
112+
}
113+
if (cond) {
114+
x = "hello";
115+
}
116+
const y = x;
117+
const f = () => {
118+
const z = x;
119+
};
120+
}

0 commit comments

Comments
 (0)