Skip to content

Commit 560bc3f

Browse files
committed
Accepting new baselines
1 parent 9de0a5d commit 560bc3f

37 files changed

Lines changed: 2298 additions & 74 deletions

tests/baselines/reference/TypeGuardWithEnumUnion.types

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function f2(x: Color | string | string[]) {
5555
if (typeof x === "number") {
5656
>typeof x === "number" : boolean
5757
>typeof x : string
58-
>x : Color | string | string[]
58+
>x : string[] | Color | string
5959
>"number" : string
6060

6161
var z = x;
@@ -68,16 +68,16 @@ function f2(x: Color | string | string[]) {
6868
}
6969
else {
7070
var w = x;
71-
>w : string | string[]
72-
>x : string | string[]
71+
>w : string[] | string
72+
>x : string[] | string
7373

7474
var w: string | string[];
75-
>w : string | string[]
75+
>w : string[] | string
7676
}
7777
if (typeof x === "string") {
7878
>typeof x === "string" : boolean
7979
>typeof x : string
80-
>x : Color | string | string[]
80+
>x : Color | string[] | string
8181
>"string" : string
8282

8383
var a = x;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [controlFlowAssignmentExpression.ts]
2+
let x: string | boolean | number;
3+
let obj: any;
4+
5+
x = "";
6+
x = x.length;
7+
x; // number
8+
9+
x = true;
10+
(x = "", obj).foo = (x = x.length);
11+
x; // number
12+
13+
14+
//// [controlFlowAssignmentExpression.js]
15+
var x;
16+
var obj;
17+
x = "";
18+
x = x.length;
19+
x; // number
20+
x = true;
21+
(x = "", obj).foo = (x = x.length);
22+
x; // number
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts ===
2+
let x: string | boolean | number;
3+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
4+
5+
let obj: any;
6+
>obj : Symbol(obj, Decl(controlFlowAssignmentExpression.ts, 1, 3))
7+
8+
x = "";
9+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
10+
11+
x = x.length;
12+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
13+
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
14+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
15+
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
16+
17+
x; // number
18+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
19+
20+
x = true;
21+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
22+
23+
(x = "", obj).foo = (x = x.length);
24+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
25+
>obj : Symbol(obj, Decl(controlFlowAssignmentExpression.ts, 1, 3))
26+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
27+
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
28+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
29+
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
30+
31+
x; // number
32+
>x : Symbol(x, Decl(controlFlowAssignmentExpression.ts, 0, 3))
33+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts ===
2+
let x: string | boolean | number;
3+
>x : string | boolean | number
4+
5+
let obj: any;
6+
>obj : any
7+
8+
x = "";
9+
>x = "" : string
10+
>x : string | boolean | number
11+
>"" : string
12+
13+
x = x.length;
14+
>x = x.length : number
15+
>x : string | boolean | number
16+
>x.length : number
17+
>x : string
18+
>length : number
19+
20+
x; // number
21+
>x : number
22+
23+
x = true;
24+
>x = true : boolean
25+
>x : string | boolean | number
26+
>true : boolean
27+
28+
(x = "", obj).foo = (x = x.length);
29+
>(x = "", obj).foo = (x = x.length) : number
30+
>(x = "", obj).foo : any
31+
>(x = "", obj) : any
32+
>x = "", obj : any
33+
>x = "" : string
34+
>x : string | boolean | number
35+
>"" : string
36+
>obj : any
37+
>foo : any
38+
>(x = x.length) : number
39+
>x = x.length : number
40+
>x : string | boolean | number
41+
>x.length : number
42+
>x : string
43+
>length : number
44+
45+
x; // number
46+
>x : number
47+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [controlFlowBinaryAndExpression.ts]
2+
let x: string | number | boolean;
3+
let cond: boolean;
4+
5+
(x = "") && (x = 0);
6+
x; // string | number
7+
8+
x = "";
9+
cond && (x = 0);
10+
x; // string | number
11+
12+
13+
//// [controlFlowBinaryAndExpression.js]
14+
var x;
15+
var cond;
16+
(x = "") && (x = 0);
17+
x; // string | number
18+
x = "";
19+
cond && (x = 0);
20+
x; // string | number
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts ===
2+
let x: string | number | boolean;
3+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
4+
5+
let cond: boolean;
6+
>cond : Symbol(cond, Decl(controlFlowBinaryAndExpression.ts, 1, 3))
7+
8+
(x = "") && (x = 0);
9+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
10+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
11+
12+
x; // string | number
13+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
14+
15+
x = "";
16+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
17+
18+
cond && (x = 0);
19+
>cond : Symbol(cond, Decl(controlFlowBinaryAndExpression.ts, 1, 3))
20+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
21+
22+
x; // string | number
23+
>x : Symbol(x, Decl(controlFlowBinaryAndExpression.ts, 0, 3))
24+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowBinaryAndExpression.ts ===
2+
let x: string | number | boolean;
3+
>x : string | number | boolean
4+
5+
let cond: boolean;
6+
>cond : boolean
7+
8+
(x = "") && (x = 0);
9+
>(x = "") && (x = 0) : number
10+
>(x = "") : string
11+
>x = "" : string
12+
>x : string | number | boolean
13+
>"" : string
14+
>(x = 0) : number
15+
>x = 0 : number
16+
>x : string | number | boolean
17+
>0 : number
18+
19+
x; // string | number
20+
>x : string | number
21+
22+
x = "";
23+
>x = "" : string
24+
>x : string | number | boolean
25+
>"" : string
26+
27+
cond && (x = 0);
28+
>cond && (x = 0) : number
29+
>cond : boolean
30+
>(x = 0) : number
31+
>x = 0 : number
32+
>x : string | number | boolean
33+
>0 : number
34+
35+
x; // string | number
36+
>x : string | number
37+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [controlFlowBinaryOrExpression.ts]
2+
let x: string | number | boolean;
3+
let cond: boolean;
4+
5+
(x = "") || (x = 0);
6+
x; // string | number
7+
8+
x = "";
9+
cond || (x = 0);
10+
x; // string | number
11+
12+
13+
//// [controlFlowBinaryOrExpression.js]
14+
var x;
15+
var cond;
16+
(x = "") || (x = 0);
17+
x; // string | number
18+
x = "";
19+
cond || (x = 0);
20+
x; // string | number
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts ===
2+
let x: string | number | boolean;
3+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
4+
5+
let cond: boolean;
6+
>cond : Symbol(cond, Decl(controlFlowBinaryOrExpression.ts, 1, 3))
7+
8+
(x = "") || (x = 0);
9+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
10+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
11+
12+
x; // string | number
13+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
14+
15+
x = "";
16+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
17+
18+
cond || (x = 0);
19+
>cond : Symbol(cond, Decl(controlFlowBinaryOrExpression.ts, 1, 3))
20+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
21+
22+
x; // string | number
23+
>x : Symbol(x, Decl(controlFlowBinaryOrExpression.ts, 0, 3))
24+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
=== tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts ===
2+
let x: string | number | boolean;
3+
>x : string | number | boolean
4+
5+
let cond: boolean;
6+
>cond : boolean
7+
8+
(x = "") || (x = 0);
9+
>(x = "") || (x = 0) : string | number
10+
>(x = "") : string
11+
>x = "" : string
12+
>x : string | number | boolean
13+
>"" : string
14+
>(x = 0) : number
15+
>x = 0 : number
16+
>x : string | number | boolean
17+
>0 : number
18+
19+
x; // string | number
20+
>x : string | number
21+
22+
x = "";
23+
>x = "" : string
24+
>x : string | number | boolean
25+
>"" : string
26+
27+
cond || (x = 0);
28+
>cond || (x = 0) : boolean | number
29+
>cond : boolean
30+
>(x = 0) : number
31+
>x = 0 : number
32+
>x : string | number | boolean
33+
>0 : number
34+
35+
x; // string | number
36+
>x : string | number
37+

0 commit comments

Comments
 (0)