-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
ea4cbbe
commit 5c661ba
Showing
23 changed files
with
990 additions
and
940 deletions.
There are no files selected for viewing
72 changes: 37 additions & 35 deletions
72
tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '{}[]'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
Oops, something went wrong.