1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 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, --, --))
}
}
}
|