Skip to content

Commit

Permalink
Update baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Nov 6, 2017
1 parent ea55de3 commit 888da3c
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error


==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (19 errors) ====
interface StrNum extends Array<string|number> {
interface StrNum extends TupleBase<string|number> {
0: string;
1: number;
length: 2;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/arityAndOrderCompatibility01.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//// [arityAndOrderCompatibility01.ts]
interface StrNum extends Array<string|number> {
interface StrNum extends TupleBase<string|number> {
0: string;
1: number;
length: 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts ===
interface StrNum extends Array<string|number> {
interface StrNum extends TupleBase<string|number> {
>StrNum : Symbol(StrNum, Decl(arityAndOrderCompatibility01.ts, 0, 0))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>TupleBase : Symbol(TupleBase, Decl(lib.d.ts, --, --))

0: string;
1: number;
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/arityAndOrderCompatibility01.types
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts ===
interface StrNum extends Array<string|number> {
interface StrNum extends TupleBase<string|number> {
>StrNum : StrNum
>Array : T[]
>TupleBase : TupleBase<T>

0: string;
1: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
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 '() => 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'.
Types of property 'concat' are incompatible.
Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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 '{}[]'.

Expand All @@ -27,10 +28,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
numArray = numStrTuple;
~~~~~~~~
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! 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'.
!!! error TS2322: Types of property 'concat' are incompatible.
!!! error TS2322: Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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 '[{}]'.
Expand Down
36 changes: 20 additions & 16 deletions tests/baselines/reference/tupleTypes.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ tests/cases/compiler/tupleTypes.ts(18,1): error TS2322: Type '[number, string, n
Type '3' is not assignable to type '2'.
tests/cases/compiler/tupleTypes.ts(41,1): error TS2322: Type 'undefined[]' is not assignable to type '[number, string]'.
tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
Types of property 'pop' are incompatible.
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'.
Types of property 'concat' are incompatible.
Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is not assignable to type 'number[]'.
Types of property 'pop' are incompatible.
Type '() => number | {}' is not assignable to type '() => number'.
Type 'number | {}' is not assignable to type 'number'.
Type '{}' is not assignable to type 'number'.
Types of property 'concat' are incompatible.
Type '{ (...items: ReadonlyArray<number | {}>[]): (number | {})[]; (...items: (number | {} | ReadonlyArray<number | {}>)[]): (number | {})[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): number[]; }'.
Type '(number | {})[]' is not assignable to type 'number[]'.
Type 'number | {}' is not assignable to type 'number'.
Type '{}' is not assignable to type 'number'.
tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is not assignable to type '[number, string]'.
Expand Down Expand Up @@ -92,18 +94,20 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
a = a1; // Error
~
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! 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'.
!!! error TS2322: Types of property 'concat' are incompatible.
!!! error TS2322: Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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'.
a = a2;
a = a3; // Error
~
!!! error TS2322: Type '[number, {}]' is not assignable to type 'number[]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => number | {}' is not assignable to type '() => number'.
!!! error TS2322: Type 'number | {}' is not assignable to type 'number'.
!!! error TS2322: Type '{}' is not assignable to type 'number'.
!!! error TS2322: Types of property 'concat' are incompatible.
!!! error TS2322: Type '{ (...items: ReadonlyArray<number | {}>[]): (number | {})[]; (...items: (number | {} | ReadonlyArray<number | {}>)[]): (number | {})[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): number[]; }'.
!!! error TS2322: Type '(number | {})[]' is not assignable to type 'number[]'.
!!! error TS2322: Type 'number | {}' is not assignable to type 'number'.
!!! error TS2322: Type '{}' is not assignable to type 'number'.
a1 = a2; // Error
~~
!!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
Expand Down
31 changes: 31 additions & 0 deletions tests/baselines/reference/typeInferenceWithTupleType.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts(16,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures.


==== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts (1 errors) ====
function combine<T, U>(x: T, y: U): [T, U] {
return [x, y];
}

var combineResult = combine("string", 10);
var combineEle1 = combineResult[0]; // string
var combineEle2 = combineResult[1]; // number

function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
if (array1.length != array2.length) {
return [[undefined, undefined]];
}
var length = array1.length;
var zipResult: [[T, U]];
for (var i = 0; i < length; ++i) {
zipResult.push([array1[i], array2[i]]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures.
}
return zipResult;
}

var zipResult = zip(["foo", "bar"], [5, 6]);
var zipResultEle = zipResult[0]; // [string, number]
var zipResultEleEle = zipResult[0][0]; // string


4 changes: 2 additions & 2 deletions tests/baselines/reference/typeInferenceWithTupleType.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))

zipResult.push([array1[i], array2[i]]);
>zipResult.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>zipResult.push : Symbol(TupleBase.push, Decl(lib.d.ts, --, --))
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 13, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>push : Symbol(TupleBase.push, Decl(lib.d.ts, --, --))
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
>array2 : Symbol(array2, Decl(typeInferenceWithTupleType.ts, 8, 31))
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/typeInferenceWithTupleType.types
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
>i : number

zipResult.push([array1[i], array2[i]]);
>zipResult.push([array1[i], array2[i]]) : number
>zipResult.push : (...items: [T, U][]) => number
>zipResult.push([array1[i], array2[i]]) : any
>zipResult.push : never
>zipResult : [[T, U]]
>push : (...items: [T, U][]) => number
>[array1[i], array2[i]] : [T, U]
>push : never
>[array1[i], array2[i]] : (T | U)[]
>array1[i] : T
>array1 : T[]
>i : number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface StrNum extends Array<string|number> {
interface StrNum extends TupleBase<string|number> {
0: string;
1: number;
length: 2;
Expand Down

0 comments on commit 888da3c

Please sign in to comment.