Skip to content

Commit 48d343b

Browse files
committed
Accept new baselines
1 parent 86040e0 commit 48d343b

File tree

3 files changed

+203
-8
lines changed

3 files changed

+203
-8
lines changed

tests/baselines/reference/destructuringAssignmentWithDefault.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,27 @@ let x = 0;
88
function f1(options?: { color?: string, width?: number }) {
99
let { color, width } = options || {};
1010
({ color, width } = options || {});
11+
let x1 = (options || {}).color;
12+
let x2 = (options || {})["color"];
1113
}
1214

1315
function f2(options?: [string?, number?]) {
1416
let [str, num] = options || [];
1517
[str, num] = options || [];
18+
let x1 = (options || {})[0];
19+
}
20+
21+
function f3(options?: { color: string, width: number }) {
22+
let { color, width } = options || {};
23+
({ color, width } = options || {});
24+
let x1 = (options || {}).color;
25+
let x2 = (options || {})["color"];
26+
}
27+
28+
function f4(options?: [string, number]) {
29+
let [str, num] = options || [];
30+
[str, num] = options || [];
31+
let x1 = (options || {})[0];
1632
}
1733

1834

@@ -26,9 +42,25 @@ function f1(options) {
2642
var _a;
2743
var _b = options || {}, color = _b.color, width = _b.width;
2844
(_a = options || {}, color = _a.color, width = _a.width);
45+
var x1 = (options || {}).color;
46+
var x2 = (options || {})["color"];
2947
}
3048
function f2(options) {
3149
var _a;
3250
var _b = options || [], str = _b[0], num = _b[1];
3351
_a = options || [], str = _a[0], num = _a[1];
52+
var x1 = (options || {})[0];
53+
}
54+
function f3(options) {
55+
var _a;
56+
var _b = options || {}, color = _b.color, width = _b.width;
57+
(_a = options || {}, color = _a.color, width = _a.width);
58+
var x1 = (options || {}).color;
59+
var x2 = (options || {})["color"];
60+
}
61+
function f4(options) {
62+
var _a;
63+
var _b = options || [], str = _b[0], num = _b[1];
64+
_a = options || [], str = _a[0], num = _a[1];
65+
var x1 = (options || {})[0];
3466
}

tests/baselines/reference/destructuringAssignmentWithDefault.symbols

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,84 @@ function f1(options?: { color?: string, width?: number }) {
2727
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 8, 6))
2828
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 8, 13))
2929
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12))
30+
31+
let x1 = (options || {}).color;
32+
>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 9, 7))
33+
>(options || {}).color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23))
34+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12))
35+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23))
36+
37+
let x2 = (options || {})["color"];
38+
>x2 : Symbol(x2, Decl(destructuringAssignmentWithDefault.ts, 10, 7))
39+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12))
40+
>"color" : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23))
3041
}
3142

3243
function f2(options?: [string?, number?]) {
33-
>f2 : Symbol(f2, Decl(destructuringAssignmentWithDefault.ts, 9, 1))
34-
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12))
44+
>f2 : Symbol(f2, Decl(destructuringAssignmentWithDefault.ts, 11, 1))
45+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12))
3546

3647
let [str, num] = options || [];
37-
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9))
38-
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13))
39-
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12))
48+
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 14, 9))
49+
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 14, 13))
50+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12))
4051

4152
[str, num] = options || [];
42-
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9))
43-
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13))
44-
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12))
53+
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 14, 9))
54+
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 14, 13))
55+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12))
56+
57+
let x1 = (options || {})[0];
58+
>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 16, 7))
59+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12))
60+
>0 : Symbol(0)
61+
}
62+
63+
function f3(options?: { color: string, width: number }) {
64+
>f3 : Symbol(f3, Decl(destructuringAssignmentWithDefault.ts, 17, 1))
65+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12))
66+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23))
67+
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 19, 38))
68+
69+
let { color, width } = options || {};
70+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 20, 9))
71+
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 20, 16))
72+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12))
73+
74+
({ color, width } = options || {});
75+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 21, 6))
76+
>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 21, 13))
77+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12))
78+
79+
let x1 = (options || {}).color;
80+
>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 22, 7))
81+
>(options || {}).color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23))
82+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12))
83+
>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23))
84+
85+
let x2 = (options || {})["color"];
86+
>x2 : Symbol(x2, Decl(destructuringAssignmentWithDefault.ts, 23, 7))
87+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12))
88+
>"color" : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23))
89+
}
90+
91+
function f4(options?: [string, number]) {
92+
>f4 : Symbol(f4, Decl(destructuringAssignmentWithDefault.ts, 24, 1))
93+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12))
94+
95+
let [str, num] = options || [];
96+
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 27, 9))
97+
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 27, 13))
98+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12))
99+
100+
[str, num] = options || [];
101+
>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 27, 9))
102+
>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 27, 13))
103+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12))
104+
105+
let x1 = (options || {})[0];
106+
>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 29, 7))
107+
>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12))
108+
>0 : Symbol(0)
45109
}
46110

tests/baselines/reference/destructuringAssignmentWithDefault.types

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,24 @@ function f1(options?: { color?: string, width?: number }) {
4040
>options || {} : { color?: string | undefined; width?: number | undefined; }
4141
>options : { color?: string | undefined; width?: number | undefined; } | undefined
4242
>{} : {}
43+
44+
let x1 = (options || {}).color;
45+
>x1 : string | undefined
46+
>(options || {}).color : string | undefined
47+
>(options || {}) : { color?: string | undefined; width?: number | undefined; }
48+
>options || {} : { color?: string | undefined; width?: number | undefined; }
49+
>options : { color?: string | undefined; width?: number | undefined; } | undefined
50+
>{} : {}
51+
>color : string | undefined
52+
53+
let x2 = (options || {})["color"];
54+
>x2 : string | undefined
55+
>(options || {})["color"] : string | undefined
56+
>(options || {}) : { color?: string | undefined; width?: number | undefined; }
57+
>options || {} : { color?: string | undefined; width?: number | undefined; }
58+
>options : { color?: string | undefined; width?: number | undefined; } | undefined
59+
>{} : {}
60+
>"color" : "color"
4361
}
4462

4563
function f2(options?: [string?, number?]) {
@@ -61,5 +79,86 @@ function f2(options?: [string?, number?]) {
6179
>options || [] : [(string | undefined)?, (number | undefined)?]
6280
>options : [(string | undefined)?, (number | undefined)?] | undefined
6381
>[] : []
82+
83+
let x1 = (options || {})[0];
84+
>x1 : string | undefined
85+
>(options || {})[0] : string | undefined
86+
>(options || {}) : [(string | undefined)?, (number | undefined)?] | {}
87+
>options || {} : [(string | undefined)?, (number | undefined)?] | {}
88+
>options : [(string | undefined)?, (number | undefined)?] | undefined
89+
>{} : {}
90+
>0 : 0
91+
}
92+
93+
function f3(options?: { color: string, width: number }) {
94+
>f3 : (options?: { color: string; width: number; } | undefined) => void
95+
>options : { color: string; width: number; } | undefined
96+
>color : string
97+
>width : number
98+
99+
let { color, width } = options || {};
100+
>color : string | undefined
101+
>width : number | undefined
102+
>options || {} : { color: string; width: number; } | {}
103+
>options : { color: string; width: number; } | undefined
104+
>{} : {}
105+
106+
({ color, width } = options || {});
107+
>({ color, width } = options || {}) : { color: string; width: number; } | {}
108+
>{ color, width } = options || {} : { color: string; width: number; } | {}
109+
>{ color, width } : { color: string | undefined; width: number | undefined; }
110+
>color : string | undefined
111+
>width : number | undefined
112+
>options || {} : { color: string; width: number; } | {}
113+
>options : { color: string; width: number; } | undefined
114+
>{} : {}
115+
116+
let x1 = (options || {}).color;
117+
>x1 : string | undefined
118+
>(options || {}).color : string | undefined
119+
>(options || {}) : { color: string; width: number; } | {}
120+
>options || {} : { color: string; width: number; } | {}
121+
>options : { color: string; width: number; } | undefined
122+
>{} : {}
123+
>color : string | undefined
124+
125+
let x2 = (options || {})["color"];
126+
>x2 : string | undefined
127+
>(options || {})["color"] : string | undefined
128+
>(options || {}) : { color: string; width: number; } | {}
129+
>options || {} : { color: string; width: number; } | {}
130+
>options : { color: string; width: number; } | undefined
131+
>{} : {}
132+
>"color" : "color"
133+
}
134+
135+
function f4(options?: [string, number]) {
136+
>f4 : (options?: [string, number] | undefined) => void
137+
>options : [string, number] | undefined
138+
139+
let [str, num] = options || [];
140+
>str : string | undefined
141+
>num : number | undefined
142+
>options || [] : [] | [string, number]
143+
>options : [string, number] | undefined
144+
>[] : []
145+
146+
[str, num] = options || [];
147+
>[str, num] = options || [] : [] | [string, number]
148+
>[str, num] : [string | undefined, number | undefined]
149+
>str : string | undefined
150+
>num : number | undefined
151+
>options || [] : [] | [string, number]
152+
>options : [string, number] | undefined
153+
>[] : []
154+
155+
let x1 = (options || {})[0];
156+
>x1 : string | undefined
157+
>(options || {})[0] : string | undefined
158+
>(options || {}) : [string, number] | {}
159+
>options || {} : [string, number] | {}
160+
>options : [string, number] | undefined
161+
>{} : {}
162+
>0 : 0
64163
}
65164

0 commit comments

Comments
 (0)