Skip to content

Commit

Permalink
Accepting new baselines after merge with master
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ahejlsberg committed Oct 8, 2014
1 parent ea4cbbe commit 5c661ba
Show file tree
Hide file tree
Showing 23 changed files with 990 additions and 940 deletions.
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
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'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]':
Property '0' is missing in type '{}[]'.


==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts (2 errors) ====
var numStrTuple: [number, string];
var numNumTuple: [number, number];
var numEmptyObjTuple: [number, {}];
var emptyObjTuple: [{}];

var numArray: number[];
var emptyObjArray: {}[];

// no error
numArray = numNumTuple;
emptyObjArray = emptyObjTuple;
emptyObjArray = numStrTuple;
emptyObjArray = numNumTuple;
emptyObjArray = numEmptyObjTuple;

// error
numArray = numStrTuple;
~~~~~~~~
!!! 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'.
emptyObjTuple = emptyObjArray;
~~~~~~~~~~~~~
!!! error TS2322: Type '{}[]' is not assignable to type '[{}]':
!!! error TS2322: Property '0' is missing in type '{}[]'.
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'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]':
Property '0' is missing in type '{}[]'.


==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts (2 errors) ====
var numStrTuple: [number, string];
var numNumTuple: [number, number];
var numEmptyObjTuple: [number, {}];
var emptyObjTuple: [{}];

var numArray: number[];
var emptyObjArray: {}[];

// no error
numArray = numNumTuple;
emptyObjArray = emptyObjTuple;
emptyObjArray = numStrTuple;
emptyObjArray = numNumTuple;
emptyObjArray = numEmptyObjTuple;

// error
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'.
emptyObjTuple = emptyObjArray;
~~~~~~~~~~~~~
!!! error TS2322: Type '{}[]' is not assignable to type '[{}]':
!!! error TS2322: Property '0' is missing in type '{}[]'.

38 changes: 19 additions & 19 deletions tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//// [assignmentCompatBetweenTupleAndArray.ts]
//// [assignmentCompatBetweenTupleAndArray.ts]
var numStrTuple: [number, string];
var numNumTuple: [number, number];
var numEmptyObjTuple: [number, {}];
Expand All @@ -17,21 +17,21 @@ emptyObjArray = numEmptyObjTuple;
// error
numArray = numStrTuple;
emptyObjTuple = emptyObjArray;


//// [assignmentCompatBetweenTupleAndArray.js]
var numStrTuple;
var numNumTuple;
var numEmptyObjTuple;
var emptyObjTuple;
var numArray;
var emptyObjArray;
// no error
numArray = numNumTuple;
emptyObjArray = emptyObjTuple;
emptyObjArray = numStrTuple;
emptyObjArray = numNumTuple;
emptyObjArray = numEmptyObjTuple;
// error
numArray = numStrTuple;
emptyObjTuple = emptyObjArray;


//// [assignmentCompatBetweenTupleAndArray.js]
var numStrTuple;
var numNumTuple;
var numEmptyObjTuple;
var emptyObjTuple;
var numArray;
var emptyObjArray;
// no error
numArray = numNumTuple;
emptyObjArray = emptyObjTuple;
emptyObjArray = numStrTuple;
emptyObjArray = numNumTuple;
emptyObjArray = numEmptyObjTuple;
// error
numArray = numStrTuple;
emptyObjTuple = emptyObjArray;
68 changes: 34 additions & 34 deletions tests/baselines/reference/bestCommonTypeOfTuple.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//// [bestCommonTypeOfTuple.ts]
//// [bestCommonTypeOfTuple.ts]
function f1(x: number): string { return "foo"; }

function f2(x: number): number { return 10; }
Expand All @@ -23,36 +23,36 @@ t4 = [E1.one, E2.two, 20];
var e1 = t1[2]; // {}
var e2 = t2[2]; // {}
var e3 = t3[2]; // any
var e4 = t4[3]; // number

//// [bestCommonTypeOfTuple.js]
function f1(x) {
return "foo";
}
function f2(x) {
return 10;
}
function f3(x) {
return true;
}
var E1;
(function (E1) {
E1[E1["one"] = 0] = "one";
})(E1 || (E1 = {}));
var E2;
(function (E2) {
E2[E2["two"] = 0] = "two";
})(E2 || (E2 = {}));
var t1;
var t2;
var t3;
var t4;
// no error
t1 = [f1, f2];
t2 = [0 /* one */, 0 /* two */];
t3 = [5, undefined];
t4 = [0 /* one */, 0 /* two */, 20];
var e1 = t1[2]; // {}
var e2 = t2[2]; // {}
var e3 = t3[2]; // any
var e4 = t4[3]; // number
var e4 = t4[3]; // number

//// [bestCommonTypeOfTuple.js]
function f1(x) {
return "foo";
}
function f2(x) {
return 10;
}
function f3(x) {
return true;
}
var E1;
(function (E1) {
E1[E1["one"] = 0] = "one";
})(E1 || (E1 = {}));
var E2;
(function (E2) {
E2[E2["two"] = 0] = "two";
})(E2 || (E2 = {}));
var t1;
var t2;
var t3;
var t4;
// no error
t1 = [f1, f2];
t2 = [0 /* one */, 0 /* two */];
t3 = [5, undefined];
t4 = [0 /* one */, 0 /* two */, 20];
var e1 = t1[2]; // {}
var e2 = t2[2]; // {}
var e3 = t3[2]; // any
var e4 = t4[3]; // number
192 changes: 96 additions & 96 deletions tests/baselines/reference/bestCommonTypeOfTuple.types
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts ===
function f1(x: number): string { return "foo"; }
>f1 : (x: number) => string
>x : number

function f2(x: number): number { return 10; }
>f2 : (x: number) => number
>x : number

function f3(x: number): boolean { return true; }
>f3 : (x: number) => boolean
>x : number

enum E1 { one }
>E1 : E1
>one : E1

enum E2 { two }
>E2 : E2
>two : E2


var t1: [(x: number) => string, (x: number) => number];
>t1 : [(x: number) => string, (x: number) => number]
>x : number
>x : number

var t2: [E1, E2];
>t2 : [E1, E2]
>E1 : E1
>E2 : E2

var t3: [number, any];
>t3 : [number, any]

var t4: [E1, E2, number];
>t4 : [E1, E2, number]
>E1 : E1
>E2 : E2

// no error
t1 = [f1, f2];
>t1 = [f1, f2] : [(x: number) => string, (x: number) => number]
>t1 : [(x: number) => string, (x: number) => number]
>[f1, f2] : [(x: number) => string, (x: number) => number]
>f1 : (x: number) => string
>f2 : (x: number) => number

t2 = [E1.one, E2.two];
>t2 = [E1.one, E2.two] : [E1, E2]
>t2 : [E1, E2]
>[E1.one, E2.two] : [E1, E2]
>E1.one : E1
>E1 : typeof E1
>one : E1
>E2.two : E2
>E2 : typeof E2
>two : E2

t3 = [5, undefined];
>t3 = [5, undefined] : [number, undefined]
>t3 : [number, any]
>[5, undefined] : [number, undefined]
>undefined : undefined

t4 = [E1.one, E2.two, 20];
>t4 = [E1.one, E2.two, 20] : [E1, E2, number]
>t4 : [E1, E2, number]
>[E1.one, E2.two, 20] : [E1, E2, number]
>E1.one : E1
>E1 : typeof E1
>one : E1
>E2.two : E2
>E2 : typeof E2
>two : E2

var e1 = t1[2]; // {}
>e1 : {}
>t1[2] : {}
>t1 : [(x: number) => string, (x: number) => number]

var e2 = t2[2]; // {}
>e2 : {}
>t2[2] : {}
>t2 : [E1, E2]

var e3 = t3[2]; // any
>e3 : any
>t3[2] : any
>t3 : [number, any]

var e4 = t4[3]; // number
>e4 : number
>t4[3] : number
>t4 : [E1, E2, number]

=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts ===
function f1(x: number): string { return "foo"; }
>f1 : (x: number) => string
>x : number
function f2(x: number): number { return 10; }
>f2 : (x: number) => number
>x : number
function f3(x: number): boolean { return true; }
>f3 : (x: number) => boolean
>x : number
enum E1 { one }
>E1 : E1
>one : E1
enum E2 { two }
>E2 : E2
>two : E2
var t1: [(x: number) => string, (x: number) => number];
>t1 : [(x: number) => string, (x: number) => number]
>x : number
>x : number
var t2: [E1, E2];
>t2 : [E1, E2]
>E1 : E1
>E2 : E2
var t3: [number, any];
>t3 : [number, any]
var t4: [E1, E2, number];
>t4 : [E1, E2, number]
>E1 : E1
>E2 : E2
// no error
t1 = [f1, f2];
>t1 = [f1, f2] : [(x: number) => string, (x: number) => number]
>t1 : [(x: number) => string, (x: number) => number]
>[f1, f2] : [(x: number) => string, (x: number) => number]
>f1 : (x: number) => string
>f2 : (x: number) => number
t2 = [E1.one, E2.two];
>t2 = [E1.one, E2.two] : [E1, E2]
>t2 : [E1, E2]
>[E1.one, E2.two] : [E1, E2]
>E1.one : E1
>E1 : typeof E1
>one : E1
>E2.two : E2
>E2 : typeof E2
>two : E2
t3 = [5, undefined];
>t3 = [5, undefined] : [number, undefined]
>t3 : [number, any]
>[5, undefined] : [number, undefined]
>undefined : undefined
t4 = [E1.one, E2.two, 20];
>t4 = [E1.one, E2.two, 20] : [E1, E2, number]
>t4 : [E1, E2, number]
>[E1.one, E2.two, 20] : [E1, E2, number]
>E1.one : E1
>E1 : typeof E1
>one : E1
>E2.two : E2
>E2 : typeof E2
>two : E2
var 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 : E1 | E2
>t2[2] : E1 | E2
>t2 : [E1, E2]
var e3 = t3[2]; // any
>e3 : any
>t3[2] : any
>t3 : [number, any]
var e4 = t4[3]; // number
>e4 : number
>t4[3] : number
>t4 : [E1, E2, number]
Loading

0 comments on commit 5c661ba

Please sign in to comment.