Accept new baselines

This commit is contained in:
Anders Hejlsberg
2019-07-26 13:17:06 -07:00
parent ec38799e2a
commit 1ea4008120
3 changed files with 103 additions and 0 deletions

View File

@@ -38,6 +38,20 @@ declare let g2: <U>(x: Foo2<U> | Bar2<U>) => Promise<U>;
g1 = g2;
g2 = g1;
// Repro from #32572
declare function foo1<T>(obj: string[] & Iterable<T>): T;
declare function foo2<T>(obj: string[] & T): T;
declare let sa: string[];
declare let sx: string[] & { extra: number };
let x1 = foo1(sa); // string
let y1 = foo1(sx); // string
let x2 = foo2(sa); // unknown
let y2 = foo2(sx); // { extra: number }
//// [unionAndIntersectionInference3.js]
@@ -52,3 +66,7 @@ f1 = f2;
f2 = f1;
g1 = g2;
g2 = g1;
let x1 = foo1(sa); // string
let y1 = foo1(sx); // string
let x2 = foo2(sa); // unknown
let y2 = foo2(sx); // { extra: number }

View File

@@ -161,3 +161,47 @@ g2 = g1;
>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11))
>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11))
// Repro from #32572
declare function foo1<T>(obj: string[] & Iterable<T>): T;
>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
>obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 42, 25))
>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
declare function foo2<T>(obj: string[] & T): T;
>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
>obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 43, 25))
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
declare let sa: string[];
>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
declare let sx: string[] & { extra: number };
>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
>extra : Symbol(extra, Decl(unionAndIntersectionInference3.ts, 46, 28))
let x1 = foo1(sa); // string
>x1 : Symbol(x1, Decl(unionAndIntersectionInference3.ts, 48, 3))
>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
let y1 = foo1(sx); // string
>y1 : Symbol(y1, Decl(unionAndIntersectionInference3.ts, 49, 3))
>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
let x2 = foo2(sa); // unknown
>x2 : Symbol(x2, Decl(unionAndIntersectionInference3.ts, 51, 3))
>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
let y2 = foo2(sx); // { extra: number }
>y2 : Symbol(y2, Decl(unionAndIntersectionInference3.ts, 52, 3))
>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))

View File

@@ -94,3 +94,44 @@ g2 = g1;
>g2 : <U>(x: Foo2<U> | Bar2<U>) => Promise<U>
>g1 : <T>(x: Foo2<T> | Bar2<T>) => Promise<T>
// Repro from #32572
declare function foo1<T>(obj: string[] & Iterable<T>): T;
>foo1 : <T>(obj: string[] & Iterable<T>) => T
>obj : string[] & Iterable<T>
declare function foo2<T>(obj: string[] & T): T;
>foo2 : <T>(obj: string[] & T) => T
>obj : string[] & T
declare let sa: string[];
>sa : string[]
declare let sx: string[] & { extra: number };
>sx : string[] & { extra: number; }
>extra : number
let x1 = foo1(sa); // string
>x1 : string
>foo1(sa) : string
>foo1 : <T>(obj: string[] & Iterable<T>) => T
>sa : string[]
let y1 = foo1(sx); // string
>y1 : string
>foo1(sx) : string
>foo1 : <T>(obj: string[] & Iterable<T>) => T
>sx : string[] & { extra: number; }
let x2 = foo2(sa); // unknown
>x2 : unknown
>foo2(sa) : unknown
>foo2 : <T>(obj: string[] & T) => T
>sa : string[]
let y2 = foo2(sx); // { extra: number }
>y2 : { extra: number; }
>foo2(sx) : { extra: number; }
>foo2 : <T>(obj: string[] & T) => T
>sx : string[] & { extra: number; }