From 929808ef07eb6b394a1a8ea5802f31ed4c7eff7e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 28 Oct 2015 17:09:27 -0700 Subject: [PATCH] Accepted baselines. --- .../reference/castingTuple.errors.txt | 23 +----- .../equalityWithUnionTypes01.errors.txt | 47 ------------- .../equalityWithUnionTypes01.symbols | 55 +++++++++++++++ .../reference/equalityWithUnionTypes01.types | 70 +++++++++++++++++++ .../switchCaseWithUnionTypes01.errors.txt | 9 +-- .../typeAssertionsWithUnionTypes01.errors.txt | 14 +--- 6 files changed, 128 insertions(+), 90 deletions(-) delete mode 100644 tests/baselines/reference/equalityWithUnionTypes01.errors.txt create mode 100644 tests/baselines/reference/equalityWithUnionTypes01.symbols create mode 100644 tests/baselines/reference/equalityWithUnionTypes01.types diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 62a36c9c156..128ee5b5bb4 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -1,7 +1,3 @@ -tests/cases/conformance/types/tuple/castingTuple.ts(13,23): error TS2352: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other. - Property '2' is missing in type '[number, string]'. -tests/cases/conformance/types/tuple/castingTuple.ts(16,21): error TS2352: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other. - Property '2' is missing in type '[C, D]'. tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Neither type '[number, string]' nor type '[number, number]' is assignable to the other. Types of property '1' are incompatible. Type 'string' is not assignable to type 'number'. @@ -10,15 +6,10 @@ tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Neithe Type 'C' is not assignable to type 'A'. Property 'a' is missing in type 'C'. tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. -tests/cases/conformance/types/tuple/castingTuple.ts(30,14): error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. - Types of property 'pop' are incompatible. - Type '() => number | string' is not assignable to type '() => number'. - Type 'number | string' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'. -==== tests/cases/conformance/types/tuple/castingTuple.ts (7 errors) ==== +==== tests/cases/conformance/types/tuple/castingTuple.ts (4 errors) ==== interface I { } class A { a = 10; } class C implements I { c }; @@ -32,15 +23,9 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot var numStrTuple: [number, string] = [5, "foo"]; var emptyObjTuple = <[{}, {}]>numStrTuple; var numStrBoolTuple = <[number, string, boolean]>numStrTuple; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other. -!!! error TS2352: Property '2' is missing in type '[number, string]'. var classCDTuple: [C, D] = [new C(), new D()]; var interfaceIITuple = <[I, I]>classCDTuple; var classCDATuple = <[C, D, A]>classCDTuple; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other. -!!! error TS2352: Property '2' is missing in type '[C, D]'. var eleFromCDA1 = classCDATuple[2]; // A var eleFromCDA2 = classCDATuple[5]; // C | D | A var t10: [E1, E2] = [E1.one, E2.one]; @@ -66,12 +51,6 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot var array1 = numStrTuple; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. -!!! error TS2352: Types of property 'pop' are incompatible. -!!! error TS2352: Type '() => number | string' is not assignable to type '() => number'. -!!! error TS2352: Type 'number | string' is not assignable to type 'number'. -!!! error TS2352: Type 'string' is not assignable to type 'number'. t4[2] = 10; ~~ !!! error TS2304: Cannot find name 't4'. diff --git a/tests/baselines/reference/equalityWithUnionTypes01.errors.txt b/tests/baselines/reference/equalityWithUnionTypes01.errors.txt deleted file mode 100644 index 985ba9e5867..00000000000 --- a/tests/baselines/reference/equalityWithUnionTypes01.errors.txt +++ /dev/null @@ -1,47 +0,0 @@ -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(13,5): error TS2365: Operator '===' cannot be applied to types 'number | I2' and 'I1'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(13,16): error TS2365: Operator '===' cannot be applied to types 'I1' and 'number | I2'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(15,10): error TS2365: Operator '!==' cannot be applied to types 'number | I2' and 'I1'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(15,21): error TS2365: Operator '!==' cannot be applied to types 'I1' and 'number | I2'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(17,10): error TS2365: Operator '==' cannot be applied to types 'number | I2' and 'I1'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(17,20): error TS2365: Operator '==' cannot be applied to types 'I1' and 'number | I2'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(19,10): error TS2365: Operator '!=' cannot be applied to types 'number | I2' and 'I1'. -tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(19,20): error TS2365: Operator '!=' cannot be applied to types 'I1' and 'number | I2'. - - -==== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts (8 errors) ==== - interface I1 { - p1: number - } - - interface I2 extends I1 { - p2: number; - } - - var x = { p1: 10, p2: 20 }; - var y: number | I2 = x; - var z: I1 = x; - - if (y === z || z === y) { - ~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types 'number | I2' and 'I1'. - ~~~~~~~ -!!! error TS2365: Operator '===' cannot be applied to types 'I1' and 'number | I2'. - } - else if (y !== z || z !== y) { - ~~~~~~~ -!!! error TS2365: Operator '!==' cannot be applied to types 'number | I2' and 'I1'. - ~~~~~~~ -!!! error TS2365: Operator '!==' cannot be applied to types 'I1' and 'number | I2'. - } - else if (y == z || z == y) { - ~~~~~~ -!!! error TS2365: Operator '==' cannot be applied to types 'number | I2' and 'I1'. - ~~~~~~ -!!! error TS2365: Operator '==' cannot be applied to types 'I1' and 'number | I2'. - } - else if (y != z || z != y) { - ~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types 'number | I2' and 'I1'. - ~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types 'I1' and 'number | I2'. - } \ No newline at end of file diff --git a/tests/baselines/reference/equalityWithUnionTypes01.symbols b/tests/baselines/reference/equalityWithUnionTypes01.symbols new file mode 100644 index 00000000000..2baf5034f77 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.symbols @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts === +interface I1 { +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) + + p1: number +>p1 : Symbol(p1, Decl(equalityWithUnionTypes01.ts, 0, 14)) +} + +interface I2 extends I1 { +>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1)) +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) + + p2: number; +>p2 : Symbol(p2, Decl(equalityWithUnionTypes01.ts, 4, 25)) +} + +var x = { p1: 10, p2: 20 }; +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) +>p1 : Symbol(p1, Decl(equalityWithUnionTypes01.ts, 8, 9)) +>p2 : Symbol(p2, Decl(equalityWithUnionTypes01.ts, 8, 17)) + +var y: number | I2 = x; +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1)) +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) + +var z: I1 = x; +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) + +if (y === z || z === y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y !== z || z !== y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y == z || z == y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y != z || z != y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.types b/tests/baselines/reference/equalityWithUnionTypes01.types new file mode 100644 index 00000000000..e6a5ce487d9 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.types @@ -0,0 +1,70 @@ +=== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts === +interface I1 { +>I1 : I1 + + p1: number +>p1 : number +} + +interface I2 extends I1 { +>I2 : I2 +>I1 : I1 + + p2: number; +>p2 : number +} + +var x = { p1: 10, p2: 20 }; +>x : { p1: number; p2: number; } +>{ p1: 10, p2: 20 } : { p1: number; p2: number; } +>p1 : number +>10 : number +>p2 : number +>20 : number + +var y: number | I2 = x; +>y : number | I2 +>I2 : I2 +>x : { p1: number; p2: number; } + +var z: I1 = x; +>z : I1 +>I1 : I1 +>x : { p1: number; p2: number; } + +if (y === z || z === y) { +>y === z || z === y : boolean +>y === z : boolean +>y : number | I2 +>z : I1 +>z === y : boolean +>z : I1 +>y : number | I2 +} +else if (y !== z || z !== y) { +>y !== z || z !== y : boolean +>y !== z : boolean +>y : number | I2 +>z : I1 +>z !== y : boolean +>z : I1 +>y : number | I2 +} +else if (y == z || z == y) { +>y == z || z == y : boolean +>y == z : boolean +>y : number | I2 +>z : I1 +>z == y : boolean +>z : I1 +>y : number | I2 +} +else if (y != z || z != y) { +>y != z || z != y : boolean +>y != z : boolean +>y : number | I2 +>z : I1 +>z != y : boolean +>z : I1 +>y : number | I2 +} diff --git a/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt index ee60c210253..a59c9ec57f7 100644 --- a/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt +++ b/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts(19,10): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts(23,10): error TS2322: Type 'boolean' is not assignable to type 'string | number'. Type 'boolean' is not assignable to type 'number'. -==== tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts (2 errors) ==== +==== tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts (1 errors) ==== var strOrNum: string | number; var numOrBool: number | boolean; @@ -25,10 +22,6 @@ tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTyp // Overlap in constituents case numOrBool: - ~~~~~~~~~ -!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. break; // No relation diff --git a/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt b/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt index 2a9dceaf8a6..022617c8ba0 100644 --- a/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt +++ b/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt @@ -1,12 +1,7 @@ -tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(13,9): error TS2352: Neither type 'I1' nor type 'number | I2' is assignable to the other. - Type 'I1' is not assignable to type 'I2'. - Property 'p2' is missing in type 'I1'. tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(14,9): error TS2352: Neither type 'I1' nor type 'number' is assignable to the other. -tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(16,9): error TS2352: Neither type 'number | I2' nor type 'I1' is assignable to the other. - Type 'number' is not assignable to type 'I1'. -==== tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts (3 errors) ==== +==== tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts (1 errors) ==== interface I1 { p1: number } @@ -20,16 +15,9 @@ tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnio var z: I1 = x; var a = z; - ~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'I1' nor type 'number | I2' is assignable to the other. -!!! error TS2352: Type 'I1' is not assignable to type 'I2'. -!!! error TS2352: Property 'p2' is missing in type 'I1'. var b = z; ~~~~~~~~~ !!! error TS2352: Neither type 'I1' nor type 'number' is assignable to the other. var c = z; var d = y; - ~~~~~ -!!! error TS2352: Neither type 'number | I2' nor type 'I1' is assignable to the other. -!!! error TS2352: Type 'number' is not assignable to type 'I1'. \ No newline at end of file