Accepting new baselines after merge with master
The tuple type tests from master need to be updated to reflect the new best common type behavior from union types. This commit simply accepts the baselines as they are.
This commit is contained in:
parent
ea4cbbee4e
commit
5c661baddc
23 changed files with 990 additions and 940 deletions
|
@ -1,7 +1,8 @@
|
|||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]':
|
||||
Types of property 'pop' are incompatible:
|
||||
Type '() => {}' is not assignable to type '() => number':
|
||||
Type '{}' is not assignable to type 'number'.
|
||||
Type '() => string | number' is not assignable to type '() => number':
|
||||
Type 'string | number' is not assignable to type 'number':
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]':
|
||||
Property '0' is missing in type '{}[]'.
|
||||
|
||||
|
@ -27,8 +28,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
|||
~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]':
|
||||
!!! error TS2322: Types of property 'pop' are incompatible:
|
||||
!!! error TS2322: Type '() => {}' is not assignable to type '() => number':
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '() => string | number' is not assignable to type '() => number':
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'number':
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
emptyObjTuple = emptyObjArray;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{}[]' is not assignable to type '[{}]':
|
||||
|
|
|
@ -75,13 +75,13 @@ t4 = [E1.one, E2.two, 20];
|
|||
>two : E2
|
||||
|
||||
var e1 = t1[2]; // {}
|
||||
>e1 : {}
|
||||
>t1[2] : {}
|
||||
>e1 : { (x: number): string; } | { (x: number): number; }
|
||||
>t1[2] : { (x: number): string; } | { (x: number): number; }
|
||||
>t1 : [(x: number) => string, (x: number) => number]
|
||||
|
||||
var e2 = t2[2]; // {}
|
||||
>e2 : {}
|
||||
>t2[2] : {}
|
||||
>e2 : E1 | E2
|
||||
>t2[2] : E1 | E2
|
||||
>t2 : [E1, E2]
|
||||
|
||||
var e3 = t3[2]; // any
|
||||
|
|
|
@ -69,8 +69,8 @@ var e11 = t1[4]; // base
|
|||
>t1 : [C, base]
|
||||
|
||||
var e21 = t2[4]; // {}
|
||||
>e21 : {}
|
||||
>t2[4] : {}
|
||||
>e21 : C | D
|
||||
>t2[4] : C | D
|
||||
>t2 : [C, D]
|
||||
|
||||
var e31 = t3[4]; // C1
|
||||
|
@ -84,7 +84,7 @@ var e41 = t4[2]; // base1
|
|||
>t4 : [base1, C1]
|
||||
|
||||
var e51 = t5[2]; // {}
|
||||
>e51 : {}
|
||||
>t5[2] : {}
|
||||
>e51 : F | C1
|
||||
>t5[2] : F | C1
|
||||
>t5 : [C1, F]
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
tests/cases/conformance/types/tuple/castingTuple.ts(13,23): error TS2353: 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 TS2353: 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(24,10): error TS2353: 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'.
|
||||
|
@ -8,12 +12,13 @@ tests/cases/conformance/types/tuple/castingTuple.ts(25,10): error TS2353: Neithe
|
|||
tests/cases/conformance/types/tuple/castingTuple.ts(26,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(26,14): error TS2353: Neither type '[number, string]' nor type 'number[]' is assignable to the other:
|
||||
Types of property 'pop' are incompatible:
|
||||
Type '() => {}' is not assignable to type '() => number':
|
||||
Type '{}' is not assignable to type 'number'.
|
||||
Type '() => string | number' is not assignable to type '() => number':
|
||||
Type 'string | number' is not assignable to type 'number':
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot find name 't4'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/castingTuple.ts (5 errors) ====
|
||||
==== tests/cases/conformance/types/tuple/castingTuple.ts (7 errors) ====
|
||||
interface I { }
|
||||
class A { a = 10; }
|
||||
class C implements I { c };
|
||||
|
@ -27,9 +32,15 @@ tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot
|
|||
var numStrTuple: [number, string] = [5, "foo"];
|
||||
var emptyObjTuple = <[{}, {}]>numStrTuple;
|
||||
var numStrBoolTuple = <[number, string, boolean]>numStrTuple;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2353: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other:
|
||||
!!! error TS2353: 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 TS2353: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other:
|
||||
!!! error TS2353: Property '2' is missing in type '[C, D]'.
|
||||
var eleFromCDA1 = classCDATuple[2]; // A
|
||||
var eleFromCDA2 = classCDATuple[5]; // {}
|
||||
var t10: [E1, E2] = [E1.one, E2.one];
|
||||
|
@ -54,8 +65,9 @@ tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot
|
|||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2353: Neither type '[number, string]' nor type 'number[]' is assignable to the other:
|
||||
!!! error TS2353: Types of property 'pop' are incompatible:
|
||||
!!! error TS2353: Type '() => {}' is not assignable to type '() => number':
|
||||
!!! error TS2353: Type '{}' is not assignable to type 'number'.
|
||||
!!! error TS2353: Type '() => string | number' is not assignable to type '() => number':
|
||||
!!! error TS2353: Type 'string | number' is not assignable to type 'number':
|
||||
!!! error TS2353: Type 'string' is not assignable to type 'number'.
|
||||
t4[2] = 10;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 't4'.
|
|
@ -1,3 +1,10 @@
|
|||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]':
|
||||
Types of property 'pop' are incompatible:
|
||||
Type '() => string | number | boolean' is not assignable to type '() => string | number':
|
||||
Type 'string | 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/tuple/contextualTypeWithTuple.ts(8,1): error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(11,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]':
|
||||
Types of property '0' are incompatible:
|
||||
Type '{}' is not assignable to type '{ a: string; }':
|
||||
|
@ -6,19 +13,29 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(12,1): error TS23
|
|||
Property '2' is missing in type '[number, string]'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(13,5): error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]':
|
||||
Types of property 'pop' are incompatible:
|
||||
Type '() => {}' is not assignable to type '() => string':
|
||||
Type '{}' is not assignable to type 'string'.
|
||||
Type '() => string | number' is not assignable to type '() => string':
|
||||
Type 'string | number' is not assignable to type 'string':
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (3 errors) ====
|
||||
==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (5 errors) ====
|
||||
// no error
|
||||
var numStrTuple: [number, string] = [5, "hello"];
|
||||
var numStrTuple2: [number, string] = [5, "foo", true];
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]':
|
||||
!!! error TS2322: Types of property 'pop' are incompatible:
|
||||
!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number':
|
||||
!!! error TS2322: Type 'string | 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'.
|
||||
var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
|
||||
var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5];
|
||||
var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]];
|
||||
numStrTuple = numStrTuple2;
|
||||
numStrTuple = numStrBoolTuple;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2323: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
|
||||
|
||||
// error
|
||||
objNumTuple = [ {}, 5];
|
||||
|
@ -35,6 +52,7 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(13,5): error TS23
|
|||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]':
|
||||
!!! error TS2322: Types of property 'pop' are incompatible:
|
||||
!!! error TS2322: Type '() => {}' is not assignable to type '() => string':
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '() => string | number' is not assignable to type '() => string':
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string':
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
|
@ -1,3 +1,11 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(12,1): error TS2322: Type '[string, number, boolean, boolean]' is not assignable to type '[string, number]':
|
||||
Types of property 'pop' are incompatible:
|
||||
Type '() => string | number | boolean' is not assignable to type '() => string | number':
|
||||
Type 'string | 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/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number':
|
||||
Type '{ a: string; }' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]':
|
||||
Types of property '0' are incompatible:
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
@ -8,7 +16,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
|
|||
Property '1' is missing in type '[{}]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (3 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (5 errors) ====
|
||||
interface I<T, U> {
|
||||
tuple1: [T, U];
|
||||
}
|
||||
|
@ -21,8 +29,18 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
|
|||
var e1 = i1.tuple1[0]; // string
|
||||
var e2 = i1.tuple1[1]; // number
|
||||
i1.tuple1 = ["foo", 5, false, true];
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '[string, number, boolean, boolean]' is not assignable to type '[string, number]':
|
||||
!!! error TS2322: Types of property 'pop' are incompatible:
|
||||
!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number':
|
||||
!!! error TS2322: Type 'string | 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'.
|
||||
var e3 = i1.tuple1[2]; // {}
|
||||
i1.tuple1[3] = { a: "string" };
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: string; }' is not assignable to type 'string | number':
|
||||
!!! error TS2322: Type '{ a: string; }' is not assignable to type 'number'.
|
||||
var e4 = i1.tuple1[3]; // {}
|
||||
i2.tuple1 = ["foo", 5];
|
||||
i2.tuple1 = ["foo", "bar"];
|
||||
|
|
|
@ -26,19 +26,19 @@ var ele11 = strNumTuple[1]; // number
|
|||
>strNumTuple : [string, number]
|
||||
|
||||
var ele12 = strNumTuple[2]; // {}
|
||||
>ele12 : {}
|
||||
>strNumTuple[2] : {}
|
||||
>ele12 : string | number
|
||||
>strNumTuple[2] : string | number
|
||||
>strNumTuple : [string, number]
|
||||
|
||||
var ele13 = strNumTuple[idx0]; // {}
|
||||
>ele13 : {}
|
||||
>strNumTuple[idx0] : {}
|
||||
>ele13 : string | number
|
||||
>strNumTuple[idx0] : string | number
|
||||
>strNumTuple : [string, number]
|
||||
>idx0 : number
|
||||
|
||||
var ele14 = strNumTuple[idx1]; // {}
|
||||
>ele14 : {}
|
||||
>strNumTuple[idx1] : {}
|
||||
>ele14 : string | number
|
||||
>strNumTuple[idx1] : string | number
|
||||
>strNumTuple : [string, number]
|
||||
>idx1 : number
|
||||
|
||||
|
@ -58,7 +58,7 @@ var strNumTuple1 = numTupleTuple[1]; //[string, number];
|
|||
>numTupleTuple : [number, [string, number]]
|
||||
|
||||
var ele17 = numTupleTuple[2]; // {}
|
||||
>ele17 : {}
|
||||
>numTupleTuple[2] : {}
|
||||
>ele17 : number | [string, number]
|
||||
>numTupleTuple[2] : number | [string, number]
|
||||
>numTupleTuple : [number, [string, number]]
|
||||
|
||||
|
|
Loading…
Reference in a new issue