mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 11:50:54 -06:00
Add tests
This commit is contained in:
parent
bea20a997b
commit
0b5284d77e
45
tests/baselines/reference/intersectionsAndEmptyObjects.js
Normal file
45
tests/baselines/reference/intersectionsAndEmptyObjects.js
Normal file
@ -0,0 +1,45 @@
|
||||
//// [intersectionsAndEmptyObjects.ts]
|
||||
// Empty object type literals are removed from intersections types
|
||||
// that contain other object types
|
||||
|
||||
type A = { a: number };
|
||||
type B = { b: string };
|
||||
type C = {};
|
||||
|
||||
let x01: A & B;
|
||||
let x02: A & C;
|
||||
let x03: B & C;
|
||||
let x04: A & B & C;
|
||||
let x05: string & C;
|
||||
let x06: C & string;
|
||||
let x07: C;
|
||||
let x08: C & {};
|
||||
let x09: {} & A & {} & B & {} & C & {};
|
||||
|
||||
interface D {}
|
||||
interface E {}
|
||||
|
||||
let x10: A & D;
|
||||
let x11: C & D;
|
||||
let x12: A & B & C & D;
|
||||
let x13: D & E;
|
||||
let x14: A & B & C & D & E;
|
||||
|
||||
|
||||
//// [intersectionsAndEmptyObjects.js]
|
||||
// Empty object type literals are removed from intersections types
|
||||
// that contain other object types
|
||||
var x01;
|
||||
var x02;
|
||||
var x03;
|
||||
var x04;
|
||||
var x05;
|
||||
var x06;
|
||||
var x07;
|
||||
var x08;
|
||||
var x09;
|
||||
var x10;
|
||||
var x11;
|
||||
var x12;
|
||||
var x13;
|
||||
var x14;
|
||||
@ -0,0 +1,94 @@
|
||||
=== tests/cases/conformance/types/intersection/intersectionsAndEmptyObjects.ts ===
|
||||
// Empty object type literals are removed from intersections types
|
||||
// that contain other object types
|
||||
|
||||
type A = { a: number };
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(intersectionsAndEmptyObjects.ts, 3, 10))
|
||||
|
||||
type B = { b: string };
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
>b : Symbol(b, Decl(intersectionsAndEmptyObjects.ts, 4, 10))
|
||||
|
||||
type C = {};
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x01: A & B;
|
||||
>x01 : Symbol(x01, Decl(intersectionsAndEmptyObjects.ts, 7, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
|
||||
let x02: A & C;
|
||||
>x02 : Symbol(x02, Decl(intersectionsAndEmptyObjects.ts, 8, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x03: B & C;
|
||||
>x03 : Symbol(x03, Decl(intersectionsAndEmptyObjects.ts, 9, 3))
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x04: A & B & C;
|
||||
>x04 : Symbol(x04, Decl(intersectionsAndEmptyObjects.ts, 10, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x05: string & C;
|
||||
>x05 : Symbol(x05, Decl(intersectionsAndEmptyObjects.ts, 11, 3))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x06: C & string;
|
||||
>x06 : Symbol(x06, Decl(intersectionsAndEmptyObjects.ts, 12, 3))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x07: C;
|
||||
>x07 : Symbol(x07, Decl(intersectionsAndEmptyObjects.ts, 13, 3))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x08: C & {};
|
||||
>x08 : Symbol(x08, Decl(intersectionsAndEmptyObjects.ts, 14, 3))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
let x09: {} & A & {} & B & {} & C & {};
|
||||
>x09 : Symbol(x09, Decl(intersectionsAndEmptyObjects.ts, 15, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
|
||||
interface D {}
|
||||
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
|
||||
|
||||
interface E {}
|
||||
>E : Symbol(E, Decl(intersectionsAndEmptyObjects.ts, 17, 14))
|
||||
|
||||
let x10: A & D;
|
||||
>x10 : Symbol(x10, Decl(intersectionsAndEmptyObjects.ts, 20, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
|
||||
|
||||
let x11: C & D;
|
||||
>x11 : Symbol(x11, Decl(intersectionsAndEmptyObjects.ts, 21, 3))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
|
||||
|
||||
let x12: A & B & C & D;
|
||||
>x12 : Symbol(x12, Decl(intersectionsAndEmptyObjects.ts, 22, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
|
||||
|
||||
let x13: D & E;
|
||||
>x13 : Symbol(x13, Decl(intersectionsAndEmptyObjects.ts, 23, 3))
|
||||
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
|
||||
>E : Symbol(E, Decl(intersectionsAndEmptyObjects.ts, 17, 14))
|
||||
|
||||
let x14: A & B & C & D & E;
|
||||
>x14 : Symbol(x14, Decl(intersectionsAndEmptyObjects.ts, 24, 3))
|
||||
>A : Symbol(A, Decl(intersectionsAndEmptyObjects.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(intersectionsAndEmptyObjects.ts, 3, 23))
|
||||
>C : Symbol(C, Decl(intersectionsAndEmptyObjects.ts, 4, 23))
|
||||
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
|
||||
>E : Symbol(E, Decl(intersectionsAndEmptyObjects.ts, 17, 14))
|
||||
|
||||
94
tests/baselines/reference/intersectionsAndEmptyObjects.types
Normal file
94
tests/baselines/reference/intersectionsAndEmptyObjects.types
Normal file
@ -0,0 +1,94 @@
|
||||
=== tests/cases/conformance/types/intersection/intersectionsAndEmptyObjects.ts ===
|
||||
// Empty object type literals are removed from intersections types
|
||||
// that contain other object types
|
||||
|
||||
type A = { a: number };
|
||||
>A : A
|
||||
>a : number
|
||||
|
||||
type B = { b: string };
|
||||
>B : B
|
||||
>b : string
|
||||
|
||||
type C = {};
|
||||
>C : C
|
||||
|
||||
let x01: A & B;
|
||||
>x01 : A & B
|
||||
>A : A
|
||||
>B : B
|
||||
|
||||
let x02: A & C;
|
||||
>x02 : A
|
||||
>A : A
|
||||
>C : C
|
||||
|
||||
let x03: B & C;
|
||||
>x03 : B
|
||||
>B : B
|
||||
>C : C
|
||||
|
||||
let x04: A & B & C;
|
||||
>x04 : A & B
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
|
||||
let x05: string & C;
|
||||
>x05 : string & {}
|
||||
>C : C
|
||||
|
||||
let x06: C & string;
|
||||
>x06 : string & {}
|
||||
>C : C
|
||||
|
||||
let x07: C;
|
||||
>x07 : C
|
||||
>C : C
|
||||
|
||||
let x08: C & {};
|
||||
>x08 : {}
|
||||
>C : C
|
||||
|
||||
let x09: {} & A & {} & B & {} & C & {};
|
||||
>x09 : A & B
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
|
||||
interface D {}
|
||||
>D : D
|
||||
|
||||
interface E {}
|
||||
>E : E
|
||||
|
||||
let x10: A & D;
|
||||
>x10 : A & D
|
||||
>A : A
|
||||
>D : D
|
||||
|
||||
let x11: C & D;
|
||||
>x11 : D
|
||||
>C : C
|
||||
>D : D
|
||||
|
||||
let x12: A & B & C & D;
|
||||
>x12 : A & B & D
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
>D : D
|
||||
|
||||
let x13: D & E;
|
||||
>x13 : D & E
|
||||
>D : D
|
||||
>E : E
|
||||
|
||||
let x14: A & B & C & D & E;
|
||||
>x14 : A & B & D & E
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
>D : D
|
||||
>E : E
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
// Empty object type literals are removed from intersections types
|
||||
// that contain other object types
|
||||
|
||||
type A = { a: number };
|
||||
type B = { b: string };
|
||||
type C = {};
|
||||
|
||||
let x01: A & B;
|
||||
let x02: A & C;
|
||||
let x03: B & C;
|
||||
let x04: A & B & C;
|
||||
let x05: string & C;
|
||||
let x06: C & string;
|
||||
let x07: C;
|
||||
let x08: C & {};
|
||||
let x09: {} & A & {} & B & {} & C & {};
|
||||
|
||||
interface D {}
|
||||
interface E {}
|
||||
|
||||
let x10: A & D;
|
||||
let x11: C & D;
|
||||
let x12: A & B & C & D;
|
||||
let x13: D & E;
|
||||
let x14: A & B & C & D & E;
|
||||
Loading…
x
Reference in New Issue
Block a user