Accept new baselines

This commit is contained in:
Anders Hejlsberg 2018-09-26 11:09:28 -07:00
parent 32ea3b2cb0
commit 735f166f4e
3 changed files with 62 additions and 11 deletions

View file

@ -95,7 +95,17 @@ function goo(x: X) {
x.y;
}
x;
}
}
// Repro from #27282
declare const x: (() => void)|null;
declare const ctor: Function;
if (x instanceof ctor) {
x();
}
//// [controlFlowInstanceof.js]
// Repros from #10167
@ -181,3 +191,6 @@ function goo(x) {
}
x;
}
if (x instanceof ctor) {
x();
}

View file

@ -229,3 +229,21 @@ function goo(x: X) {
x;
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 90, 13))
}
// Repro from #27282
declare const x: (() => void)|null;
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 100, 13))
declare const ctor: Function;
>ctor : Symbol(ctor, Decl(controlFlowInstanceof.ts, 101, 13))
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
if (x instanceof ctor) {
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 100, 13))
>ctor : Symbol(ctor, Decl(controlFlowInstanceof.ts, 101, 13))
x();
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 100, 13))
}

View file

@ -130,31 +130,31 @@ class C extends A { c: string }
>c : string
function foo(x: A | undefined) {
>foo : (x: A) => void
>x : A
>foo : (x: A | undefined) => void
>x : A | undefined
x; // A | undefined
>x : A
>x : A | undefined
if (x instanceof B || x instanceof C) {
>x instanceof B || x instanceof C : boolean
>x instanceof B : boolean
>x : A
>x : A | undefined
>B : typeof B
>x instanceof C : boolean
>x : A
>x : A | undefined
>C : typeof C
x; // B | C
>x : B | C
}
x; // A | undefined
>x : A
>x : A | undefined
if (x instanceof B && x instanceof C) {
>x instanceof B && x instanceof C : boolean
>x instanceof B : boolean
>x : A
>x : A | undefined
>B : typeof B
>x instanceof C : boolean
>x : B
@ -164,11 +164,11 @@ function foo(x: A | undefined) {
>x : B & C
}
x; // A | undefined
>x : A
>x : A | undefined
if (!x) {
>!x : boolean
>x : A
>x : A | undefined
return;
}
@ -211,7 +211,7 @@ function foo(x: A | undefined) {
interface X {
x?: string;
>x : string
>x : string | undefined
}
class Y {
@ -241,3 +241,23 @@ function goo(x: X) {
x;
>x : X
}
// Repro from #27282
declare const x: (() => void)|null;
>x : (() => void) | null
>null : null
declare const ctor: Function;
>ctor : Function
if (x instanceof ctor) {
>x instanceof ctor : boolean
>x : (() => void) | null
>ctor : Function
x();
>x() : void
>x : () => void
}