From d040db42f51593ee5695a6a24a3ae595ee8aec1d Mon Sep 17 00:00:00 2001 From: Marius Schulz Date: Sun, 20 Nov 2016 22:26:32 +0100 Subject: [PATCH] Add test for proper tuple type handling --- .../reference/intersectionTypeWithLeadingOperator.js | 2 ++ .../reference/intersectionTypeWithLeadingOperator.symbols | 7 +++++++ .../reference/intersectionTypeWithLeadingOperator.types | 7 +++++++ tests/baselines/reference/unionTypeWithLeadingOperator.js | 2 ++ .../reference/unionTypeWithLeadingOperator.symbols | 3 +++ .../baselines/reference/unionTypeWithLeadingOperator.types | 3 +++ .../cases/compiler/intersectionTypeWithLeadingOperator.ts | 2 ++ tests/cases/compiler/unionTypeWithLeadingOperator.ts | 2 ++ 8 files changed, 28 insertions(+) diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.js b/tests/baselines/reference/intersectionTypeWithLeadingOperator.js index 03f17c08788..61b034f1e03 100644 --- a/tests/baselines/reference/intersectionTypeWithLeadingOperator.js +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.js @@ -3,6 +3,8 @@ type A = & string; type B = & { foo: string } & { bar: number }; + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; //// [intersectionTypeWithLeadingOperator.js] diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols b/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols index 43e0db684dc..f6648183bb6 100644 --- a/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols @@ -11,3 +11,10 @@ type B = & { bar: number }; >bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 3, 5)) +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; +>C : Symbol(C, Decl(intersectionTypeWithLeadingOperator.ts, 3, 20)) +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 13)) +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 26)) +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 40)) +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 53)) + diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.types b/tests/baselines/reference/intersectionTypeWithLeadingOperator.types index f2fad709dce..9961f051f7f 100644 --- a/tests/baselines/reference/intersectionTypeWithLeadingOperator.types +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.types @@ -11,3 +11,10 @@ type B = & { bar: number }; >bar : number +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; +>C : [{ foo: 1; } & { bar: 2; }, { foo: 3; } & { bar: 4; }] +>foo : 1 +>bar : 2 +>foo : 3 +>bar : 4 + diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.js b/tests/baselines/reference/unionTypeWithLeadingOperator.js index b6a40440a48..0fb366d538e 100644 --- a/tests/baselines/reference/unionTypeWithLeadingOperator.js +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.js @@ -3,6 +3,8 @@ type A = | string; type B = | { type: "INCREMENT" } | { type: "DECREMENT" }; + +type C = [| 0 | 1, | "foo" | "bar"]; //// [unionTypeWithLeadingOperator.js] diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.symbols b/tests/baselines/reference/unionTypeWithLeadingOperator.symbols index 97fdcdda8e0..8c15d299c48 100644 --- a/tests/baselines/reference/unionTypeWithLeadingOperator.symbols +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.symbols @@ -11,3 +11,6 @@ type B = | { type: "DECREMENT" }; >type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 3, 5)) +type C = [| 0 | 1, | "foo" | "bar"]; +>C : Symbol(C, Decl(unionTypeWithLeadingOperator.ts, 3, 26)) + diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.types b/tests/baselines/reference/unionTypeWithLeadingOperator.types index db92c6e8eb6..2ca15fb54a2 100644 --- a/tests/baselines/reference/unionTypeWithLeadingOperator.types +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.types @@ -11,3 +11,6 @@ type B = | { type: "DECREMENT" }; >type : "DECREMENT" +type C = [| 0 | 1, | "foo" | "bar"]; +>C : [0 | 1, "foo" | "bar"] + diff --git a/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts b/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts index 9f64cad38dc..4138dee4261 100644 --- a/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts +++ b/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts @@ -2,3 +2,5 @@ type A = & string; type B = & { foo: string } & { bar: number }; + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; diff --git a/tests/cases/compiler/unionTypeWithLeadingOperator.ts b/tests/cases/compiler/unionTypeWithLeadingOperator.ts index 08a876493d0..9f6d272ce7c 100644 --- a/tests/cases/compiler/unionTypeWithLeadingOperator.ts +++ b/tests/cases/compiler/unionTypeWithLeadingOperator.ts @@ -2,3 +2,5 @@ type A = | string; type B = | { type: "INCREMENT" } | { type: "DECREMENT" }; + +type C = [| 0 | 1, | "foo" | "bar"];