Accept new baselines

This commit is contained in:
Anders Hejlsberg 2016-09-19 17:06:53 -07:00
parent 7b1ca047d5
commit 798048963c
3 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,53 @@
//// [controlFlowWithIncompleteTypes.ts]
// Repro from #11000
declare var cond: boolean;
function foo1() {
let x: string | number | boolean = 0;
while (cond) {
if (typeof x === "string") {
x = x.slice();
}
else {
x = "abc";
}
}
}
function foo2() {
let x: string | number | boolean = 0;
while (cond) {
if (typeof x === "number") {
x = "abc";
}
else {
x = x.slice();
}
}
}
//// [controlFlowWithIncompleteTypes.js]
// Repro from #11000
function foo1() {
var x = 0;
while (cond) {
if (typeof x === "string") {
x = x.slice();
}
else {
x = "abc";
}
}
}
function foo2() {
var x = 0;
while (cond) {
if (typeof x === "number") {
x = "abc";
}
else {
x = x.slice();
}
}
}

View File

@ -0,0 +1,55 @@
=== tests/cases/compiler/controlFlowWithIncompleteTypes.ts ===
// Repro from #11000
declare var cond: boolean;
>cond : Symbol(cond, Decl(controlFlowWithIncompleteTypes.ts, 2, 11))
function foo1() {
>foo1 : Symbol(foo1, Decl(controlFlowWithIncompleteTypes.ts, 2, 26))
let x: string | number | boolean = 0;
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 5, 7))
while (cond) {
>cond : Symbol(cond, Decl(controlFlowWithIncompleteTypes.ts, 2, 11))
if (typeof x === "string") {
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 5, 7))
x = x.slice();
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 5, 7))
>x.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 5, 7))
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
}
else {
x = "abc";
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 5, 7))
}
}
}
function foo2() {
>foo2 : Symbol(foo2, Decl(controlFlowWithIncompleteTypes.ts, 14, 1))
let x: string | number | boolean = 0;
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 17, 7))
while (cond) {
>cond : Symbol(cond, Decl(controlFlowWithIncompleteTypes.ts, 2, 11))
if (typeof x === "number") {
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 17, 7))
x = "abc";
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 17, 7))
}
else {
x = x.slice();
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 17, 7))
>x.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(controlFlowWithIncompleteTypes.ts, 17, 7))
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
}
}
}

View File

@ -0,0 +1,71 @@
=== tests/cases/compiler/controlFlowWithIncompleteTypes.ts ===
// Repro from #11000
declare var cond: boolean;
>cond : boolean
function foo1() {
>foo1 : () => void
let x: string | number | boolean = 0;
>x : string | number | boolean
>0 : 0
while (cond) {
>cond : boolean
if (typeof x === "string") {
>typeof x === "string" : boolean
>typeof x : string
>x : string | number
>"string" : "string"
x = x.slice();
>x = x.slice() : string
>x : string | number | boolean
>x.slice() : string
>x.slice : (start?: number, end?: number) => string
>x : string
>slice : (start?: number, end?: number) => string
}
else {
x = "abc";
>x = "abc" : "abc"
>x : string | number | boolean
>"abc" : "abc"
}
}
}
function foo2() {
>foo2 : () => void
let x: string | number | boolean = 0;
>x : string | number | boolean
>0 : 0
while (cond) {
>cond : boolean
if (typeof x === "number") {
>typeof x === "number" : boolean
>typeof x : string
>x : string | number
>"number" : "number"
x = "abc";
>x = "abc" : "abc"
>x : string | number | boolean
>"abc" : "abc"
}
else {
x = x.slice();
>x = x.slice() : string
>x : string | number | boolean
>x.slice() : string
>x.slice : (start?: number, end?: number) => string
>x : string
>slice : (start?: number, end?: number) => string
}
}
}