Accept new baselines

This commit is contained in:
Anders Hejlsberg
2019-10-24 10:14:15 -04:00
parent 3d4c14c5f8
commit 7362545e8c
3 changed files with 129 additions and 1 deletions
@@ -38,10 +38,36 @@ const cc4 = c4 ?? true;
const dd1 = d1 ?? {b: 1};
const dd2 = d2 ?? {b: 1};
const dd3 = d3 ?? {b: 1};
const dd4 = d4 ?? {b: 1};
const dd4 = d4 ?? {b: 1};
// Repro from #34635
declare function foo(): void;
const maybeBool = false;
if (!(maybeBool ?? true)) {
foo();
}
if (maybeBool ?? true) {
foo();
}
else {
foo();
}
if (false ?? true) {
foo();
}
else {
foo();
}
//// [nullishCoalescingOperator1.js]
"use strict";
var _a;
var aa1 = (a1 !== null && a1 !== void 0 ? a1 : 'whatever');
var aa2 = (a2 !== null && a2 !== void 0 ? a2 : 'whatever');
var aa3 = (a3 !== null && a3 !== void 0 ? a3 : 'whatever');
@@ -58,3 +84,19 @@ var dd1 = (d1 !== null && d1 !== void 0 ? d1 : { b: 1 });
var dd2 = (d2 !== null && d2 !== void 0 ? d2 : { b: 1 });
var dd3 = (d3 !== null && d3 !== void 0 ? d3 : { b: 1 });
var dd4 = (d4 !== null && d4 !== void 0 ? d4 : { b: 1 });
var maybeBool = false;
if (!((maybeBool !== null && maybeBool !== void 0 ? maybeBool : true))) {
foo();
}
if ((maybeBool !== null && maybeBool !== void 0 ? maybeBool : true)) {
foo();
}
else {
foo();
}
if (_a = false, (_a !== null && _a !== void 0 ? _a : true)) {
foo();
}
else {
foo();
}
@@ -123,3 +123,38 @@ const dd4 = d4 ?? {b: 1};
>d4 : Symbol(d4, Decl(nullishCoalescingOperator1.ts, 19, 13))
>b : Symbol(b, Decl(nullishCoalescingOperator1.ts, 39, 19))
// Repro from #34635
declare function foo(): void;
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
const maybeBool = false;
>maybeBool : Symbol(maybeBool, Decl(nullishCoalescingOperator1.ts, 45, 5))
if (!(maybeBool ?? true)) {
>maybeBool : Symbol(maybeBool, Decl(nullishCoalescingOperator1.ts, 45, 5))
foo();
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
}
if (maybeBool ?? true) {
>maybeBool : Symbol(maybeBool, Decl(nullishCoalescingOperator1.ts, 45, 5))
foo();
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
}
else {
foo();
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
}
if (false ?? true) {
foo();
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
}
else {
foo();
>foo : Symbol(foo, Decl(nullishCoalescingOperator1.ts, 39, 25))
}
@@ -170,3 +170,54 @@ const dd4 = d4 ?? {b: 1};
>b : number
>1 : 1
// Repro from #34635
declare function foo(): void;
>foo : () => void
const maybeBool = false;
>maybeBool : false
>false : false
if (!(maybeBool ?? true)) {
>!(maybeBool ?? true) : true
>(maybeBool ?? true) : false
>maybeBool ?? true : false
>maybeBool : false
>true : true
foo();
>foo() : void
>foo : () => void
}
if (maybeBool ?? true) {
>maybeBool ?? true : false
>maybeBool : false
>true : true
foo();
>foo() : void
>foo : () => void
}
else {
foo();
>foo() : void
>foo : () => void
}
if (false ?? true) {
>false ?? true : false
>false : false
>true : true
foo();
>foo() : void
>foo : () => void
}
else {
foo();
>foo() : void
>foo : () => void
}