Skip to content

Commit 7362545

Browse files
committed
Accept new baselines
1 parent 3d4c14c commit 7362545

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed

tests/baselines/reference/nullishCoalescingOperator1.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,36 @@ const cc4 = c4 ?? true;
3838
const dd1 = d1 ?? {b: 1};
3939
const dd2 = d2 ?? {b: 1};
4040
const dd3 = d3 ?? {b: 1};
41-
const dd4 = d4 ?? {b: 1};
41+
const dd4 = d4 ?? {b: 1};
42+
43+
// Repro from #34635
44+
45+
declare function foo(): void;
46+
47+
const maybeBool = false;
48+
49+
if (!(maybeBool ?? true)) {
50+
foo();
51+
}
52+
53+
if (maybeBool ?? true) {
54+
foo();
55+
}
56+
else {
57+
foo();
58+
}
59+
60+
if (false ?? true) {
61+
foo();
62+
}
63+
else {
64+
foo();
65+
}
66+
4267

4368
//// [nullishCoalescingOperator1.js]
4469
"use strict";
70+
var _a;
4571
var aa1 = (a1 !== null && a1 !== void 0 ? a1 : 'whatever');
4672
var aa2 = (a2 !== null && a2 !== void 0 ? a2 : 'whatever');
4773
var aa3 = (a3 !== null && a3 !== void 0 ? a3 : 'whatever');
@@ -58,3 +84,19 @@ var dd1 = (d1 !== null && d1 !== void 0 ? d1 : { b: 1 });
5884
var dd2 = (d2 !== null && d2 !== void 0 ? d2 : { b: 1 });
5985
var dd3 = (d3 !== null && d3 !== void 0 ? d3 : { b: 1 });
6086
var dd4 = (d4 !== null && d4 !== void 0 ? d4 : { b: 1 });
87+
var maybeBool = false;
88+
if (!((maybeBool !== null && maybeBool !== void 0 ? maybeBool : true))) {
89+
foo();
90+
}
91+
if ((maybeBool !== null && maybeBool !== void 0 ? maybeBool : true)) {
92+
foo();
93+
}
94+
else {
95+
foo();
96+
}
97+
if (_a = false, (_a !== null && _a !== void 0 ? _a : true)) {
98+
foo();
99+
}
100+
else {
101+
foo();
102+
}

tests/baselines/reference/nullishCoalescingOperator1.symbols

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,38 @@ const dd4 = d4 ?? {b: 1};
123123
>d4 : Symbol(d4, Decl(nullishCoalescingOperator1.ts, 19, 13))
124124
>b : Symbol(b, Decl(nullishCoalescingOperator1.ts, 39, 19))
125125

126+
// Repro from #34635
127+
128+
declare function foo(): void;
129+
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
130+
131+
const maybeBool = false;
132+
>maybeBool : Symbol(maybeBool, Decl(nullishCoalescingOperator1.ts, 45, 5))
133+
134+
if (!(maybeBool ?? true)) {
135+
>maybeBool : Symbol(maybeBool, Decl(nullishCoalescingOperator1.ts, 45, 5))
136+
137+
foo();
138+
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
139+
}
140+
141+
if (maybeBool ?? true) {
142+
>maybeBool : Symbol(maybeBool, Decl(nullishCoalescingOperator1.ts, 45, 5))
143+
144+
foo();
145+
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
146+
}
147+
else {
148+
foo();
149+
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
150+
}
151+
152+
if (false ?? true) {
153+
foo();
154+
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
155+
}
156+
else {
157+
foo();
158+
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
159+
}
160+

tests/baselines/reference/nullishCoalescingOperator1.types

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,54 @@ const dd4 = d4 ?? {b: 1};
170170
>b : number
171171
>1 : 1
172172

173+
// Repro from #34635
174+
175+
declare function foo(): void;
176+
>foo : () => void
177+
178+
const maybeBool = false;
179+
>maybeBool : false
180+
>false : false
181+
182+
if (!(maybeBool ?? true)) {
183+
>!(maybeBool ?? true) : true
184+
>(maybeBool ?? true) : false
185+
>maybeBool ?? true : false
186+
>maybeBool : false
187+
>true : true
188+
189+
foo();
190+
>foo() : void
191+
>foo : () => void
192+
}
193+
194+
if (maybeBool ?? true) {
195+
>maybeBool ?? true : false
196+
>maybeBool : false
197+
>true : true
198+
199+
foo();
200+
>foo() : void
201+
>foo : () => void
202+
}
203+
else {
204+
foo();
205+
>foo() : void
206+
>foo : () => void
207+
}
208+
209+
if (false ?? true) {
210+
>false ?? true : false
211+
>false : false
212+
>true : true
213+
214+
foo();
215+
>foo() : void
216+
>foo : () => void
217+
}
218+
else {
219+
foo();
220+
>foo() : void
221+
>foo : () => void
222+
}
223+

0 commit comments

Comments
 (0)