From 071ee915ca0972301f5ca4499e65850038c8a50e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 10 Feb 2018 17:11:02 -0800 Subject: [PATCH] Accept new baselines --- .../reference/conditionalTypes1.errors.txt | 11 ++++ .../baselines/reference/conditionalTypes1.js | 15 +++++ .../reference/conditionalTypes1.symbols | 62 +++++++++++++++++ .../reference/conditionalTypes1.types | 66 +++++++++++++++++++ 4 files changed, 154 insertions(+) diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 111b74a830b..fd128c05322 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -393,4 +393,15 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 var z: T1; var z: T2; } + + // Repro from #21863 + + function f40() { + type Eq = T extends U ? U extends T ? true : false : false; + type If = S extends false ? U : T; + type Omit = { [P in keyof T]: If, never, P>; }[keyof T]; + type Omit2 = { [P in keyof T]: If, never, P>; }[keyof T]; + type A = Omit<{ a: void; b: never; }>; // 'a' + type B = Omit2<{ a: void; b: never; }>; // 'a' + } \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes1.js b/tests/baselines/reference/conditionalTypes1.js index 399ccb14fb3..6c9179a001e 100644 --- a/tests/baselines/reference/conditionalTypes1.js +++ b/tests/baselines/reference/conditionalTypes1.js @@ -250,6 +250,17 @@ function f33() { var z: T1; var z: T2; } + +// Repro from #21863 + +function f40() { + type Eq = T extends U ? U extends T ? true : false : false; + type If = S extends false ? U : T; + type Omit = { [P in keyof T]: If, never, P>; }[keyof T]; + type Omit2 = { [P in keyof T]: If, never, P>; }[keyof T]; + type A = Omit<{ a: void; b: never; }>; // 'a' + type B = Omit2<{ a: void; b: never; }>; // 'a' +} //// [conditionalTypes1.js] @@ -325,6 +336,9 @@ function f33() { var z; var z; } +// Repro from #21863 +function f40() { +} //// [conditionalTypes1.d.ts] @@ -495,3 +509,4 @@ declare const convert2: (value: Foo) => Foo; declare function f31(): void; declare function f32(): void; declare function f33(): void; +declare function f40(): void; diff --git a/tests/baselines/reference/conditionalTypes1.symbols b/tests/baselines/reference/conditionalTypes1.symbols index cef734c4c4b..969f6bfcb42 100644 --- a/tests/baselines/reference/conditionalTypes1.symbols +++ b/tests/baselines/reference/conditionalTypes1.symbols @@ -940,3 +940,65 @@ function f33() { >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 246, 25)) } +// Repro from #21863 + +function f40() { +>f40 : Symbol(f40, Decl(conditionalTypes1.ts, 250, 1)) + + type Eq = T extends U ? U extends T ? true : false : false; +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 254, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 255, 12)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 255, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 255, 12)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 255, 14)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 255, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 255, 12)) + + type If = S extends false ? U : T; +>If : Symbol(If, Decl(conditionalTypes1.ts, 255, 69)) +>S : Symbol(S, Decl(conditionalTypes1.ts, 256, 12)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 256, 14)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 256, 17)) +>S : Symbol(S, Decl(conditionalTypes1.ts, 256, 12)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 256, 17)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 256, 14)) + + type Omit = { [P in keyof T]: If, never, P>; }[keyof T]; +>Omit : Symbol(Omit, Decl(conditionalTypes1.ts, 256, 47)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 257, 14)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 257, 37)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 257, 14)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 255, 69)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 254, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 257, 14)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 257, 37)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 257, 37)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 257, 14)) + + type Omit2 = { [P in keyof T]: If, never, P>; }[keyof T]; +>Omit2 : Symbol(Omit2, Decl(conditionalTypes1.ts, 257, 94)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 258, 15)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 258, 32)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 258, 49)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 258, 15)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 255, 69)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 254, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 258, 15)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 258, 49)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 258, 32)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 258, 49)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 258, 15)) + + type A = Omit<{ a: void; b: never; }>; // 'a' +>A : Symbol(A, Decl(conditionalTypes1.ts, 258, 102)) +>Omit : Symbol(Omit, Decl(conditionalTypes1.ts, 256, 47)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 259, 19)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 259, 28)) + + type B = Omit2<{ a: void; b: never; }>; // 'a' +>B : Symbol(B, Decl(conditionalTypes1.ts, 259, 42)) +>Omit2 : Symbol(Omit2, Decl(conditionalTypes1.ts, 257, 94)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 260, 20)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 260, 29)) +} + diff --git a/tests/baselines/reference/conditionalTypes1.types b/tests/baselines/reference/conditionalTypes1.types index eb17cb31350..99c7e45f64d 100644 --- a/tests/baselines/reference/conditionalTypes1.types +++ b/tests/baselines/reference/conditionalTypes1.types @@ -1080,3 +1080,69 @@ function f33() { >T2 : Foo } +// Repro from #21863 + +function f40() { +>f40 : () => void + + type Eq = T extends U ? U extends T ? true : false : false; +>Eq : T extends U ? U extends T ? true : false : false +>T : T +>U : U +>T : T +>U : U +>U : U +>T : T +>true : true +>false : false +>false : false + + type If = S extends false ? U : T; +>If : S extends false ? U : T +>S : S +>T : T +>U : U +>S : S +>false : false +>U : U +>T : T + + type Omit = { [P in keyof T]: If, never, P>; }[keyof T]; +>Omit : { [P in keyof T]: (T[P] extends never ? boolean : false) extends false ? P : never; }[keyof T] +>T : T +>P : P +>T : T +>If : S extends false ? U : T +>Eq : T extends U ? U extends T ? true : false : false +>T : T +>P : P +>P : P +>T : T + + type Omit2 = { [P in keyof T]: If, never, P>; }[keyof T]; +>Omit2 : { [P in keyof T]: (T[P] extends U ? U extends T[P] ? true : false : false) extends false ? P : never; }[keyof T] +>T : T +>U : U +>P : P +>T : T +>If : S extends false ? U : T +>Eq : T extends U ? U extends T ? true : false : false +>T : T +>P : P +>U : U +>P : P +>T : T + + type A = Omit<{ a: void; b: never; }>; // 'a' +>A : "a" +>Omit : { [P in keyof T]: (T[P] extends never ? boolean : false) extends false ? P : never; }[keyof T] +>a : void +>b : never + + type B = Omit2<{ a: void; b: never; }>; // 'a' +>B : "a" +>Omit2 : { [P in keyof T]: (T[P] extends U ? U extends T[P] ? true : false : false) extends false ? P : never; }[keyof T] +>a : void +>b : never +} +