From d003561464eaf42026feda6ee79b003fe2a7308e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Oct 2014 14:23:12 -0700 Subject: [PATCH] Fix newlines in tests --- ...nmentCompatBetweenTupleAndArray.errors.txt | 70 +++--- .../assignmentCompatBetweenTupleAndArray.js | 38 +-- .../reference/bestCommonTypeOfTuple.js | 68 +++--- .../reference/bestCommonTypeOfTuple.types | 192 +++++++-------- .../reference/bestCommonTypeOfTuple2.js | 112 ++++----- .../reference/bestCommonTypeOfTuple2.types | 180 +++++++------- ...wiseCompoundAssignmentOperators.errors.txt | 116 ++++----- .../bitwiseCompoundAssignmentOperators.js | 64 ++--- .../reference/castingTuple.errors.txt | 120 ++++----- tests/baselines/reference/castingTuple.js | 138 +++++------ .../contextualTypeWithTuple.errors.txt | 78 +++--- .../reference/contextualTypeWithTuple.js | 32 +-- .../genericCallWithTupleType.errors.txt | 92 +++---- .../reference/genericCallWithTupleType.js | 44 ++-- .../getEmitOutputExternalModule.baseline | 12 +- .../getEmitOutputExternalModule2.baseline | 24 +- .../getEmitOutputWithDeclarationFile.baseline | 12 +- ...getEmitOutputWithDeclarationFile2.baseline | 14 +- ...getEmitOutputWithDeclarationFile3.baseline | 4 +- tests/baselines/reference/indexerWithTuple.js | 36 +-- .../reference/indexerWithTuple.types | 128 +++++----- .../reference/selfReferencingFile.errors.txt | 20 +- .../reference/selfReferencingFile2.errors.txt | 20 +- .../reference/selfReferencingFile3.errors.txt | 20 +- .../reference/typeInferenceWithTupleType.js | 48 ++-- .../typeInferenceWithTupleType.types | 228 +++++++++--------- 26 files changed, 955 insertions(+), 955 deletions(-) diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt index 7c0a3a5c8b9..38d89bdbd78 100644 --- a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt @@ -1,36 +1,36 @@ -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 '() => {}' 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 '{}[]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js index cbe6b1ff04e..fd3ac1d46f1 100644 --- a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js @@ -1,4 +1,4 @@ -//// [assignmentCompatBetweenTupleAndArray.ts] +//// [assignmentCompatBetweenTupleAndArray.ts] var numStrTuple: [number, string]; var numNumTuple: [number, number]; var numEmptyObjTuple: [number, {}]; @@ -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; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js index a668b9978b0..752523317b5 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -1,4 +1,4 @@ -//// [bestCommonTypeOfTuple.ts] +//// [bestCommonTypeOfTuple.ts] function f1(x: number): string { return "foo"; } function f2(x: number): number { return 10; } @@ -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 diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types index 936607769e7..c8a3fb98a51 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple.types @@ -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 : {} +>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] + diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 2f2db308fc9..f9183f41348 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -1,4 +1,4 @@ -//// [bestCommonTypeOfTuple2.ts] +//// [bestCommonTypeOfTuple2.ts] interface base { } interface base1 { i } class C implements base { c } @@ -20,58 +20,58 @@ var e21 = t2[4]; // {} var e31 = t3[4]; // C1 var e41 = t4[2]; // base1 var e51 = t5[2]; // {} - - -//// [bestCommonTypeOfTuple2.js] -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -var C = (function () { - function C() { - } - return C; -})(); -var D = (function () { - function D() { - } - return D; -})(); -var E = (function () { - function E() { - } - return E; -})(); -var F = (function (_super) { - __extends(F, _super); - function F() { - _super.apply(this, arguments); - } - return F; -})(C); -var C1 = (function () { - function C1() { - this.i = "foo"; - } - return C1; -})(); -var D1 = (function (_super) { - __extends(D1, _super); - function D1() { - _super.apply(this, arguments); - this.i = "bar"; - } - return D1; -})(C1); -var t1; -var t2; -var t3; -var t4; -var t5; -var e11 = t1[4]; // base -var e21 = t2[4]; // {} -var e31 = t3[4]; // C1 -var e41 = t4[2]; // base1 -var e51 = t5[2]; // {} + + +//// [bestCommonTypeOfTuple2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var D = (function () { + function D() { + } + return D; +})(); +var E = (function () { + function E() { + } + return E; +})(); +var F = (function (_super) { + __extends(F, _super); + function F() { + _super.apply(this, arguments); + } + return F; +})(C); +var C1 = (function () { + function C1() { + this.i = "foo"; + } + return C1; +})(); +var D1 = (function (_super) { + __extends(D1, _super); + function D1() { + _super.apply(this, arguments); + this.i = "bar"; + } + return D1; +})(C1); +var t1; +var t2; +var t3; +var t4; +var t5; +var e11 = t1[4]; // base +var e21 = t2[4]; // {} +var e31 = t3[4]; // C1 +var e41 = t4[2]; // base1 +var e51 = t5[2]; // {} diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types index ec52e6c685f..49d100ed94d 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.types @@ -1,90 +1,90 @@ -=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts === -interface base { } ->base : base - -interface base1 { i } ->base1 : base1 ->i : any - -class C implements base { c } ->C : C ->base : base ->c : any - -class D implements base { d } ->D : D ->base : base ->d : any - -class E implements base { e } ->E : E ->base : base ->e : any - -class F extends C { f } ->F : F ->C : C ->f : any - -class C1 implements base1 { i = "foo"; c } ->C1 : C1 ->base1 : base1 ->i : string ->c : any - -class D1 extends C1 { i = "bar"; d } ->D1 : D1 ->C1 : C1 ->i : string ->d : any - -var t1: [C, base]; ->t1 : [C, base] ->C : C ->base : base - -var t2: [C, D]; ->t2 : [C, D] ->C : C ->D : D - -var t3: [C1, D1]; ->t3 : [C1, D1] ->C1 : C1 ->D1 : D1 - -var t4: [base1, C1]; ->t4 : [base1, C1] ->base1 : base1 ->C1 : C1 - -var t5: [C1, F] ->t5 : [C1, F] ->C1 : C1 ->F : F - -var e11 = t1[4]; // base ->e11 : base ->t1[4] : base ->t1 : [C, base] - -var e21 = t2[4]; // {} ->e21 : {} ->t2[4] : {} ->t2 : [C, D] - -var e31 = t3[4]; // C1 ->e31 : C1 ->t3[4] : C1 ->t3 : [C1, D1] - -var e41 = t4[2]; // base1 ->e41 : base1 ->t4[2] : base1 ->t4 : [base1, C1] - -var e51 = t5[2]; // {} ->e51 : {} ->t5[2] : {} ->t5 : [C1, F] - +=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts === +interface base { } +>base : base + +interface base1 { i } +>base1 : base1 +>i : any + +class C implements base { c } +>C : C +>base : base +>c : any + +class D implements base { d } +>D : D +>base : base +>d : any + +class E implements base { e } +>E : E +>base : base +>e : any + +class F extends C { f } +>F : F +>C : C +>f : any + +class C1 implements base1 { i = "foo"; c } +>C1 : C1 +>base1 : base1 +>i : string +>c : any + +class D1 extends C1 { i = "bar"; d } +>D1 : D1 +>C1 : C1 +>i : string +>d : any + +var t1: [C, base]; +>t1 : [C, base] +>C : C +>base : base + +var t2: [C, D]; +>t2 : [C, D] +>C : C +>D : D + +var t3: [C1, D1]; +>t3 : [C1, D1] +>C1 : C1 +>D1 : D1 + +var t4: [base1, C1]; +>t4 : [base1, C1] +>base1 : base1 +>C1 : C1 + +var t5: [C1, F] +>t5 : [C1, F] +>C1 : C1 +>F : F + +var e11 = t1[4]; // base +>e11 : base +>t1[4] : base +>t1 : [C, base] + +var e21 = t2[4]; // {} +>e21 : {} +>t2[4] : {} +>t2 : [C, D] + +var e31 = t3[4]; // C1 +>e31 : C1 +>t3[4] : C1 +>t3 : [C1, D1] + +var e41 = t4[2]; // base1 +>e41 : base1 +>t4[2] : base1 +>t4 : [base1, C1] + +var e51 = t5[2]; // {} +>e51 : {} +>t5[2] : {} +>t5 : [C1, F] + diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt index 1cd51984682..ae7a8fdce0a 100644 --- a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt +++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt @@ -1,59 +1,59 @@ -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(3,1): error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(9,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(14,1): error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(20,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(24,1): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. -tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - - -==== tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts (8 errors) ==== - var a = true; - var b = 1; - a ^= a; - ~~~~~~ -!!! error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead. - a = true; - b ^= b; - b = 1; - a ^= b; - ~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - a = true; - b ^= a; - ~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - b = 1; - - var c = false; - var d = 2; - c &= c; - ~~~~~~ -!!! error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead. - c = false; - d &= d; - d = 2; - c &= d; - ~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - c = false; - d &= c; - ~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - - var e = true; - var f = 0; - e |= e; - ~~~~~~ -!!! error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. - e = true; - f |= f; - f = 0; - e |= f; - ~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. - e = true; - f |= f; - +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(3,1): error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(9,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(14,1): error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(20,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(24,1): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts (8 errors) ==== + var a = true; + var b = 1; + a ^= a; + ~~~~~~ +!!! error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead. + a = true; + b ^= b; + b = 1; + a ^= b; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + a = true; + b ^= a; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + b = 1; + + var c = false; + var d = 2; + c &= c; + ~~~~~~ +!!! error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead. + c = false; + d &= d; + d = 2; + c &= d; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + c = false; + d &= c; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var e = true; + var f = 0; + e |= e; + ~~~~~~ +!!! error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. + e = true; + f |= f; + f = 0; + e |= f; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + e = true; + f |= f; + \ No newline at end of file diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js index e9bfeabb965..c148fc0142c 100644 --- a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js +++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js @@ -1,4 +1,4 @@ -//// [bitwiseCompoundAssignmentOperators.ts] +//// [bitwiseCompoundAssignmentOperators.ts] var a = true; var b = 1; a ^= a; @@ -30,34 +30,34 @@ e |= f; e = true; f |= f; - - -//// [bitwiseCompoundAssignmentOperators.js] -var a = true; -var b = 1; -a ^= a; -a = true; -b ^= b; -b = 1; -a ^= b; -a = true; -b ^= a; -b = 1; -var c = false; -var d = 2; -c &= c; -c = false; -d &= d; -d = 2; -c &= d; -c = false; -d &= c; -var e = true; -var f = 0; -e |= e; -e = true; -f |= f; -f = 0; -e |= f; -e = true; -f |= f; + + +//// [bitwiseCompoundAssignmentOperators.js] +var a = true; +var b = 1; +a ^= a; +a = true; +b ^= b; +b = 1; +a ^= b; +a = true; +b ^= a; +b = 1; +var c = false; +var d = 2; +c &= c; +c = false; +d &= d; +d = 2; +c &= d; +c = false; +d &= c; +var e = true; +var f = 0; +e |= e; +e = true; +f |= f; +f = 0; +e |= f; +e = true; +f |= f; diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index ee09362f01f..333cd22caec 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -1,61 +1,61 @@ -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'. -tests/cases/conformance/types/tuple/castingTuple.ts(25,10): error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other: - Types of property '0' are incompatible: - Type 'C' is not assignable to type 'A': - Property 'a' is missing in type 'C'. -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'. -tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot find name 't4'. - - -==== tests/cases/conformance/types/tuple/castingTuple.ts (5 errors) ==== - interface I { } - class A { a = 10; } - class C implements I { c }; - class D implements I { d }; - class E extends A { e }; - class F extends A { f }; - enum E1 { one } - enum E2 { one } - - // no error - var numStrTuple: [number, string] = [5, "foo"]; - var emptyObjTuple = <[{}, {}]>numStrTuple; - var numStrBoolTuple = <[number, string, boolean]>numStrTuple; - var classCDTuple: [C, D] = [new C(), new D()]; - var interfaceIITuple = <[I, I]>classCDTuple; - var classCDATuple = <[C, D, A]>classCDTuple; - var eleFromCDA1 = classCDATuple[2]; // A - var eleFromCDA2 = classCDATuple[5]; // {} - var t10: [E1, E2] = [E1.one, E2.one]; - var t11 = <[number, number]>t10; - var array1 = <{}[]>emptyObjTuple; - - // error - var t3 = <[number, number]>numStrTuple; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2353: Neither type '[number, string]' nor type '[number, number]' is assignable to the other: -!!! error TS2353: Types of property '1' are incompatible: -!!! error TS2353: Type 'string' is not assignable to type 'number'. - var t9 = <[A, I]>classCDTuple; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other: -!!! error TS2353: Types of property '0' are incompatible: -!!! error TS2353: Type 'C' is not assignable to type 'A': -!!! error TS2353: Property 'a' is missing in type 'C'. - 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 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'. - t4[2] = 10; - ~~ +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'. +tests/cases/conformance/types/tuple/castingTuple.ts(25,10): error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other: + Types of property '0' are incompatible: + Type 'C' is not assignable to type 'A': + Property 'a' is missing in type 'C'. +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'. +tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot find name 't4'. + + +==== tests/cases/conformance/types/tuple/castingTuple.ts (5 errors) ==== + interface I { } + class A { a = 10; } + class C implements I { c }; + class D implements I { d }; + class E extends A { e }; + class F extends A { f }; + enum E1 { one } + enum E2 { one } + + // no error + var numStrTuple: [number, string] = [5, "foo"]; + var emptyObjTuple = <[{}, {}]>numStrTuple; + var numStrBoolTuple = <[number, string, boolean]>numStrTuple; + var classCDTuple: [C, D] = [new C(), new D()]; + var interfaceIITuple = <[I, I]>classCDTuple; + var classCDATuple = <[C, D, A]>classCDTuple; + var eleFromCDA1 = classCDATuple[2]; // A + var eleFromCDA2 = classCDATuple[5]; // {} + var t10: [E1, E2] = [E1.one, E2.one]; + var t11 = <[number, number]>t10; + var array1 = <{}[]>emptyObjTuple; + + // error + var t3 = <[number, number]>numStrTuple; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[number, string]' nor type '[number, number]' is assignable to the other: +!!! error TS2353: Types of property '1' are incompatible: +!!! error TS2353: Type 'string' is not assignable to type 'number'. + var t9 = <[A, I]>classCDTuple; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other: +!!! error TS2353: Types of property '0' are incompatible: +!!! error TS2353: Type 'C' is not assignable to type 'A': +!!! error TS2353: Property 'a' is missing in type 'C'. + 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 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'. + t4[2] = 10; + ~~ !!! error TS2304: Cannot find name 't4'. \ No newline at end of file diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index c1835e9d117..0671062bb4e 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -1,4 +1,4 @@ -//// [castingTuple.ts] +//// [castingTuple.ts] interface I { } class A { a = 10; } class C implements I { c }; @@ -25,71 +25,71 @@ var array1 = <{}[]>emptyObjTuple; var t3 = <[number, number]>numStrTuple; var t9 = <[A, I]>classCDTuple; var array1 = numStrTuple; -t4[2] = 10; - -//// [castingTuple.js] -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -var A = (function () { - function A() { - this.a = 10; - } - return A; -})(); -var C = (function () { - function C() { - } - return C; -})(); -; -var D = (function () { - function D() { - } - return D; -})(); -; -var E = (function (_super) { - __extends(E, _super); - function E() { - _super.apply(this, arguments); - } - return E; -})(A); -; -var F = (function (_super) { - __extends(F, _super); - function F() { - _super.apply(this, arguments); - } - return F; -})(A); -; -var E1; -(function (E1) { - E1[E1["one"] = 0] = "one"; -})(E1 || (E1 = {})); -var E2; -(function (E2) { - E2[E2["one"] = 0] = "one"; -})(E2 || (E2 = {})); -// no error -var numStrTuple = [5, "foo"]; -var emptyObjTuple = numStrTuple; -var numStrBoolTuple = numStrTuple; -var classCDTuple = [new C(), new D()]; -var interfaceIITuple = classCDTuple; -var classCDATuple = classCDTuple; -var eleFromCDA1 = classCDATuple[2]; // A -var eleFromCDA2 = classCDATuple[5]; // {} -var t10 = [0 /* one */, 0 /* one */]; -var t11 = t10; -var array1 = emptyObjTuple; -// error -var t3 = numStrTuple; -var t9 = classCDTuple; -var array1 = numStrTuple; -t4[2] = 10; +t4[2] = 10; + +//// [castingTuple.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var A = (function () { + function A() { + this.a = 10; + } + return A; +})(); +var C = (function () { + function C() { + } + return C; +})(); +; +var D = (function () { + function D() { + } + return D; +})(); +; +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + return E; +})(A); +; +var F = (function (_super) { + __extends(F, _super); + function F() { + _super.apply(this, arguments); + } + return F; +})(A); +; +var E1; +(function (E1) { + E1[E1["one"] = 0] = "one"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["one"] = 0] = "one"; +})(E2 || (E2 = {})); +// no error +var numStrTuple = [5, "foo"]; +var emptyObjTuple = numStrTuple; +var numStrBoolTuple = numStrTuple; +var classCDTuple = [new C(), new D()]; +var interfaceIITuple = classCDTuple; +var classCDATuple = classCDTuple; +var eleFromCDA1 = classCDATuple[2]; // A +var eleFromCDA2 = classCDATuple[5]; // {} +var t10 = [0 /* one */, 0 /* one */]; +var t11 = t10; +var array1 = emptyObjTuple; +// error +var t3 = numStrTuple; +var t9 = classCDTuple; +var array1 = numStrTuple; +t4[2] = 10; diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt index e739c916c8a..f2f77277c5e 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -1,40 +1,40 @@ -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; }': - Property 'a' is missing in type '{}'. -tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(12,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]': - 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'. - - -==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (3 errors) ==== - // no error - var numStrTuple: [number, string] = [5, "hello"]; - var numStrTuple2: [number, string] = [5, "foo", true]; - 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 - objNumTuple = [ {}, 5]; - ~~~~~~~~~~~ -!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]': -!!! error TS2322: Types of property '0' are incompatible: -!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }': -!!! error TS2322: Property 'a' is missing in type '{}'. - numStrBoolTuple = numStrTuple; - ~~~~~~~~~~~~~~~ -!!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]': -!!! error TS2322: Property '2' is missing in type '[number, string]'. - var strStrTuple: [string, string] = ["foo", "bar", 5]; - ~~~~~~~~~~~ -!!! 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'. +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; }': + Property 'a' is missing in type '{}'. +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(12,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]': + 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'. + + +==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (3 errors) ==== + // no error + var numStrTuple: [number, string] = [5, "hello"]; + var numStrTuple2: [number, string] = [5, "foo", true]; + 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 + objNumTuple = [ {}, 5]; + ~~~~~~~~~~~ +!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }': +!!! error TS2322: Property 'a' is missing in type '{}'. + numStrBoolTuple = numStrTuple; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]': +!!! error TS2322: Property '2' is missing in type '[number, string]'. + var strStrTuple: [string, string] = ["foo", "bar", 5]; + ~~~~~~~~~~~ +!!! 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'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypeWithTuple.js b/tests/baselines/reference/contextualTypeWithTuple.js index 0e53cea283b..61a2df5d8ce 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.js +++ b/tests/baselines/reference/contextualTypeWithTuple.js @@ -1,4 +1,4 @@ -//// [contextualTypeWithTuple.ts] +//// [contextualTypeWithTuple.ts] // no error var numStrTuple: [number, string] = [5, "hello"]; var numStrTuple2: [number, string] = [5, "foo", true]; @@ -12,18 +12,18 @@ numStrTuple = numStrBoolTuple; objNumTuple = [ {}, 5]; numStrBoolTuple = numStrTuple; var strStrTuple: [string, string] = ["foo", "bar", 5]; - - -//// [contextualTypeWithTuple.js] -// no error -var numStrTuple = [5, "hello"]; -var numStrTuple2 = [5, "foo", true]; -var numStrBoolTuple = [5, "foo", true]; -var objNumTuple = [{ a: "world" }, 5]; -var strTupleTuple = ["bar", [5, { x: 1, y: 1 }]]; -numStrTuple = numStrTuple2; -numStrTuple = numStrBoolTuple; -// error -objNumTuple = [{}, 5]; -numStrBoolTuple = numStrTuple; -var strStrTuple = ["foo", "bar", 5]; + + +//// [contextualTypeWithTuple.js] +// no error +var numStrTuple = [5, "hello"]; +var numStrTuple2 = [5, "foo", true]; +var numStrBoolTuple = [5, "foo", true]; +var objNumTuple = [{ a: "world" }, 5]; +var strTupleTuple = ["bar", [5, { x: 1, y: 1 }]]; +numStrTuple = numStrTuple2; +numStrTuple = numStrBoolTuple; +// error +objNumTuple = [{}, 5]; +numStrBoolTuple = numStrTuple; +var strStrTuple = ["foo", "bar", 5]; diff --git a/tests/baselines/reference/genericCallWithTupleType.errors.txt b/tests/baselines/reference/genericCallWithTupleType.errors.txt index 7f84cee760c..8ddeb93435f 100644 --- a/tests/baselines/reference/genericCallWithTupleType.errors.txt +++ b/tests/baselines/reference/genericCallWithTupleType.errors.txt @@ -1,47 +1,47 @@ -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'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]': - Types of property '0' are incompatible: - Type '{}' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]': - Property '1' is missing in type '[{}]'. - - -==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (3 errors) ==== - interface I { - tuple1: [T, U]; - } - - var i1: I; - var i2: I<{}, {}>; - - // no error - i1.tuple1 = ["foo", 5]; - var e1 = i1.tuple1[0]; // string - var e2 = i1.tuple1[1]; // number - i1.tuple1 = ["foo", 5, false, true]; - var e3 = i1.tuple1[2]; // {} - i1.tuple1[3] = { a: "string" }; - var e4 = i1.tuple1[3]; // {} - i2.tuple1 = ["foo", 5]; - i2.tuple1 = ["foo", "bar"]; - i2.tuple1 = [5, "bar"]; - i2.tuple1 = [{}, {}]; - - // error - i1.tuple1 = [5, "foo"]; - ~~~~~~~~~ -!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]': -!!! error TS2322: Types of property '0' are incompatible: -!!! error TS2322: Type 'number' is not assignable to type 'string'. - i1.tuple1 = [{}, {}]; - ~~~~~~~~~ -!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]': -!!! error TS2322: Types of property '0' are incompatible: -!!! error TS2322: Type '{}' is not assignable to type 'string'. - i2.tuple1 = [{}]; - ~~~~~~~~~ -!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]': -!!! error TS2322: Property '1' is missing in type '[{}]'. +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'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]': + Types of property '0' are incompatible: + Type '{}' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]': + Property '1' is missing in type '[{}]'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (3 errors) ==== + interface I { + tuple1: [T, U]; + } + + var i1: I; + var i2: I<{}, {}>; + + // no error + i1.tuple1 = ["foo", 5]; + var e1 = i1.tuple1[0]; // string + var e2 = i1.tuple1[1]; // number + i1.tuple1 = ["foo", 5, false, true]; + var e3 = i1.tuple1[2]; // {} + i1.tuple1[3] = { a: "string" }; + var e4 = i1.tuple1[3]; // {} + i2.tuple1 = ["foo", 5]; + i2.tuple1 = ["foo", "bar"]; + i2.tuple1 = [5, "bar"]; + i2.tuple1 = [{}, {}]; + + // error + i1.tuple1 = [5, "foo"]; + ~~~~~~~~~ +!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type 'number' is not assignable to type 'string'. + i1.tuple1 = [{}, {}]; + ~~~~~~~~~ +!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]': +!!! error TS2322: Types of property '0' are incompatible: +!!! error TS2322: Type '{}' is not assignable to type 'string'. + i2.tuple1 = [{}]; + ~~~~~~~~~ +!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]': +!!! error TS2322: Property '1' is missing in type '[{}]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithTupleType.js b/tests/baselines/reference/genericCallWithTupleType.js index 5ac66f66c3c..296a6dad63b 100644 --- a/tests/baselines/reference/genericCallWithTupleType.js +++ b/tests/baselines/reference/genericCallWithTupleType.js @@ -1,4 +1,4 @@ -//// [genericCallWithTupleType.ts] +//// [genericCallWithTupleType.ts] interface I { tuple1: [T, U]; } @@ -23,24 +23,24 @@ i2.tuple1 = [{}, {}]; i1.tuple1 = [5, "foo"]; i1.tuple1 = [{}, {}]; i2.tuple1 = [{}]; - - -//// [genericCallWithTupleType.js] -var i1; -var i2; -// no error -i1.tuple1 = ["foo", 5]; -var e1 = i1.tuple1[0]; // string -var e2 = i1.tuple1[1]; // number -i1.tuple1 = ["foo", 5, false, true]; -var e3 = i1.tuple1[2]; // {} -i1.tuple1[3] = { a: "string" }; -var e4 = i1.tuple1[3]; // {} -i2.tuple1 = ["foo", 5]; -i2.tuple1 = ["foo", "bar"]; -i2.tuple1 = [5, "bar"]; -i2.tuple1 = [{}, {}]; -// error -i1.tuple1 = [5, "foo"]; -i1.tuple1 = [{}, {}]; -i2.tuple1 = [{}]; + + +//// [genericCallWithTupleType.js] +var i1; +var i2; +// no error +i1.tuple1 = ["foo", 5]; +var e1 = i1.tuple1[0]; // string +var e2 = i1.tuple1[1]; // number +i1.tuple1 = ["foo", 5, false, true]; +var e3 = i1.tuple1[2]; // {} +i1.tuple1[3] = { a: "string" }; +var e4 = i1.tuple1[3]; // {} +i2.tuple1 = ["foo", 5]; +i2.tuple1 = ["foo", "bar"]; +i2.tuple1 = [5, "bar"]; +i2.tuple1 = [{}, {}]; +// error +i1.tuple1 = [5, "foo"]; +i1.tuple1 = [{}, {}]; +i2.tuple1 = [{}]; diff --git a/tests/baselines/reference/getEmitOutputExternalModule.baseline b/tests/baselines/reference/getEmitOutputExternalModule.baseline index b5e670c5fd7..33360cbed61 100644 --- a/tests/baselines/reference/getEmitOutputExternalModule.baseline +++ b/tests/baselines/reference/getEmitOutputExternalModule.baseline @@ -1,9 +1,9 @@ EmitOutputStatus : Succeeded Filename : declSingleFile.js -var x = 5; -var Bar = (function () { - function Bar() { - } - return Bar; -})(); +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); diff --git a/tests/baselines/reference/getEmitOutputExternalModule2.baseline b/tests/baselines/reference/getEmitOutputExternalModule2.baseline index 5c03a092257..ede5474d8cc 100644 --- a/tests/baselines/reference/getEmitOutputExternalModule2.baseline +++ b/tests/baselines/reference/getEmitOutputExternalModule2.baseline @@ -1,15 +1,15 @@ EmitOutputStatus : JSGeneratedWithSemanticErrors Filename : declSingleFile.js -var x = 5; -var Bar = (function () { - function Bar() { - } - return Bar; -})(); -var x = "world"; -var Bar2 = (function () { - function Bar2() { - } - return Bar2; -})(); +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var x = "world"; +var Bar2 = (function () { + function Bar2() { + } + return Bar2; +})(); diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline index 9b75091b3b0..be0ac935601 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline @@ -2,10 +2,10 @@ EmitOutputStatus : Succeeded EmitOutputStatus : Succeeded Filename : tests/cases/fourslash/inputFile2.js -var x1 = "hello world"; -var Foo = (function () { - function Foo() { - } - return Foo; -})(); +var x1 = "hello world"; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline index ba719e2df99..92a1ea1fe7a 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline @@ -2,14 +2,14 @@ EmitOutputStatus : Succeeded EmitOutputStatus : Succeeded Filename : tests/cases/fourslash/inputFile2.js -var Foo = (function () { - function Foo() { - } - return Foo; -})(); -exports.Foo = Foo; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +exports.Foo = Foo; EmitOutputStatus : Succeeded Filename : tests/cases/fourslash/inputFile3.js -var x = "hello"; +var x = "hello"; diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline index fe6bfb06953..f960a05f151 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded Filename : declSingle.js -var x = "hello"; -var x1 = 1000; +var x = "hello"; +var x1 = 1000; diff --git a/tests/baselines/reference/indexerWithTuple.js b/tests/baselines/reference/indexerWithTuple.js index bc3bee9dd17..fc82716ba05 100644 --- a/tests/baselines/reference/indexerWithTuple.js +++ b/tests/baselines/reference/indexerWithTuple.js @@ -1,4 +1,4 @@ -//// [indexerWithTuple.ts] +//// [indexerWithTuple.ts] var strNumTuple: [string, number] = ["foo", 10]; var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; @@ -13,20 +13,20 @@ var ele14 = strNumTuple[idx1]; // {} var ele15 = strNumTuple["0"]; // string var ele16 = strNumTuple["1"]; // number var strNumTuple1 = numTupleTuple[1]; //[string, number]; -var ele17 = numTupleTuple[2]; // {} - -//// [indexerWithTuple.js] -var strNumTuple = ["foo", 10]; -var numTupleTuple = [10, ["bar", 20]]; -// no error -var idx0 = 0; -var idx1 = 1; -var ele10 = strNumTuple[0]; // string -var ele11 = strNumTuple[1]; // number -var ele12 = strNumTuple[2]; // {} -var ele13 = strNumTuple[idx0]; // {} -var ele14 = strNumTuple[idx1]; // {} -var ele15 = strNumTuple["0"]; // string -var ele16 = strNumTuple["1"]; // number -var strNumTuple1 = numTupleTuple[1]; //[string, number]; -var ele17 = numTupleTuple[2]; // {} +var ele17 = numTupleTuple[2]; // {} + +//// [indexerWithTuple.js] +var strNumTuple = ["foo", 10]; +var numTupleTuple = [10, ["bar", 20]]; +// no error +var idx0 = 0; +var idx1 = 1; +var ele10 = strNumTuple[0]; // string +var ele11 = strNumTuple[1]; // number +var ele12 = strNumTuple[2]; // {} +var ele13 = strNumTuple[idx0]; // {} +var ele14 = strNumTuple[idx1]; // {} +var ele15 = strNumTuple["0"]; // string +var ele16 = strNumTuple["1"]; // number +var strNumTuple1 = numTupleTuple[1]; //[string, number]; +var ele17 = numTupleTuple[2]; // {} diff --git a/tests/baselines/reference/indexerWithTuple.types b/tests/baselines/reference/indexerWithTuple.types index 7c22cac407f..0a2de09b2c8 100644 --- a/tests/baselines/reference/indexerWithTuple.types +++ b/tests/baselines/reference/indexerWithTuple.types @@ -1,64 +1,64 @@ -=== tests/cases/conformance/types/tuple/indexerWithTuple.ts === -var strNumTuple: [string, number] = ["foo", 10]; ->strNumTuple : [string, number] ->["foo", 10] : [string, number] - -var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; ->numTupleTuple : [number, [string, number]] ->[10, ["bar", 20]] : [number, [string, number]] ->["bar", 20] : [string, number] - -// no error -var idx0 = 0; ->idx0 : number - -var idx1 = 1; ->idx1 : number - -var ele10 = strNumTuple[0]; // string ->ele10 : string ->strNumTuple[0] : string ->strNumTuple : [string, number] - -var ele11 = strNumTuple[1]; // number ->ele11 : number ->strNumTuple[1] : number ->strNumTuple : [string, number] - -var ele12 = strNumTuple[2]; // {} ->ele12 : {} ->strNumTuple[2] : {} ->strNumTuple : [string, number] - -var ele13 = strNumTuple[idx0]; // {} ->ele13 : {} ->strNumTuple[idx0] : {} ->strNumTuple : [string, number] ->idx0 : number - -var ele14 = strNumTuple[idx1]; // {} ->ele14 : {} ->strNumTuple[idx1] : {} ->strNumTuple : [string, number] ->idx1 : number - -var ele15 = strNumTuple["0"]; // string ->ele15 : string ->strNumTuple["0"] : string ->strNumTuple : [string, number] - -var ele16 = strNumTuple["1"]; // number ->ele16 : number ->strNumTuple["1"] : number ->strNumTuple : [string, number] - -var strNumTuple1 = numTupleTuple[1]; //[string, number]; ->strNumTuple1 : [string, number] ->numTupleTuple[1] : [string, number] ->numTupleTuple : [number, [string, number]] - -var ele17 = numTupleTuple[2]; // {} ->ele17 : {} ->numTupleTuple[2] : {} ->numTupleTuple : [number, [string, number]] - +=== tests/cases/conformance/types/tuple/indexerWithTuple.ts === +var strNumTuple: [string, number] = ["foo", 10]; +>strNumTuple : [string, number] +>["foo", 10] : [string, number] + +var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; +>numTupleTuple : [number, [string, number]] +>[10, ["bar", 20]] : [number, [string, number]] +>["bar", 20] : [string, number] + +// no error +var idx0 = 0; +>idx0 : number + +var idx1 = 1; +>idx1 : number + +var ele10 = strNumTuple[0]; // string +>ele10 : string +>strNumTuple[0] : string +>strNumTuple : [string, number] + +var ele11 = strNumTuple[1]; // number +>ele11 : number +>strNumTuple[1] : number +>strNumTuple : [string, number] + +var ele12 = strNumTuple[2]; // {} +>ele12 : {} +>strNumTuple[2] : {} +>strNumTuple : [string, number] + +var ele13 = strNumTuple[idx0]; // {} +>ele13 : {} +>strNumTuple[idx0] : {} +>strNumTuple : [string, number] +>idx0 : number + +var ele14 = strNumTuple[idx1]; // {} +>ele14 : {} +>strNumTuple[idx1] : {} +>strNumTuple : [string, number] +>idx1 : number + +var ele15 = strNumTuple["0"]; // string +>ele15 : string +>strNumTuple["0"] : string +>strNumTuple : [string, number] + +var ele16 = strNumTuple["1"]; // number +>ele16 : number +>strNumTuple["1"] : number +>strNumTuple : [string, number] + +var strNumTuple1 = numTupleTuple[1]; //[string, number]; +>strNumTuple1 : [string, number] +>numTupleTuple[1] : [string, number] +>numTupleTuple : [number, [string, number]] + +var ele17 = numTupleTuple[2]; // {} +>ele17 : {} +>numTupleTuple[2] : {} +>numTupleTuple : [number, [string, number]] + diff --git a/tests/baselines/reference/selfReferencingFile.errors.txt b/tests/baselines/reference/selfReferencingFile.errors.txt index 727be1ea0b2..8bf68fde774 100644 --- a/tests/baselines/reference/selfReferencingFile.errors.txt +++ b/tests/baselines/reference/selfReferencingFile.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/selfReferencingFile.ts(1,1): error TS1006: A file cannot have a reference to itself. - - -==== tests/cases/compiler/selfReferencingFile.ts (1 errors) ==== - /// - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1006: A file cannot have a reference to itself. - - class selfReferencingFile { - +tests/cases/compiler/selfReferencingFile.ts(1,1): error TS1006: A file cannot have a reference to itself. + + +==== tests/cases/compiler/selfReferencingFile.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1006: A file cannot have a reference to itself. + + class selfReferencingFile { + } \ No newline at end of file diff --git a/tests/baselines/reference/selfReferencingFile2.errors.txt b/tests/baselines/reference/selfReferencingFile2.errors.txt index 5bd2d75723a..c993616784a 100644 --- a/tests/baselines/reference/selfReferencingFile2.errors.txt +++ b/tests/baselines/reference/selfReferencingFile2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/selfReferencingFile2.ts(1,1): error TS6053: File 'tests/cases/selfReferencingFile2.ts' not found. - - -==== tests/cases/compiler/selfReferencingFile2.ts (1 errors) ==== - /// - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS6053: File 'selfReferencingFile2.ts' not found. - - class selfReferencingFile2 { - +tests/cases/compiler/selfReferencingFile2.ts(1,1): error TS6053: File 'tests/cases/selfReferencingFile2.ts' not found. + + +==== tests/cases/compiler/selfReferencingFile2.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS6053: File 'selfReferencingFile2.ts' not found. + + class selfReferencingFile2 { + } \ No newline at end of file diff --git a/tests/baselines/reference/selfReferencingFile3.errors.txt b/tests/baselines/reference/selfReferencingFile3.errors.txt index e6e8deb5d47..05cf04ddc4b 100644 --- a/tests/baselines/reference/selfReferencingFile3.errors.txt +++ b/tests/baselines/reference/selfReferencingFile3.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/selfReferencingFile3.ts(1,1): error TS1006: A file cannot have a reference to itself. - - -==== tests/cases/compiler/selfReferencingFile3.ts (1 errors) ==== - /// - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1006: A file cannot have a reference to itself. - - class selfReferencingFile3 { - +tests/cases/compiler/selfReferencingFile3.ts(1,1): error TS1006: A file cannot have a reference to itself. + + +==== tests/cases/compiler/selfReferencingFile3.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1006: A file cannot have a reference to itself. + + class selfReferencingFile3 { + } \ No newline at end of file diff --git a/tests/baselines/reference/typeInferenceWithTupleType.js b/tests/baselines/reference/typeInferenceWithTupleType.js index a9d75ad9990..10a18274c73 100644 --- a/tests/baselines/reference/typeInferenceWithTupleType.js +++ b/tests/baselines/reference/typeInferenceWithTupleType.js @@ -1,4 +1,4 @@ -//// [typeInferenceWithTupleType.ts] +//// [typeInferenceWithTupleType.ts] function combine(x: T, y: U): [T, U] { return [x, y]; } @@ -23,26 +23,26 @@ var zipResult = zip(["foo", "bar"], [5, 6]); var zipResultEle = zipResult[0]; // [string, number] var zipResultEleEle = zipResult[0][0]; // string - - -//// [typeInferenceWithTupleType.js] -function combine(x, y) { - return [x, y]; -} -var combineResult = combine("string", 10); -var combineEle1 = combineResult[0]; // string -var combineEle2 = combineResult[1]; // number -function zip(array1, array2) { - if (array1.length != array2.length) { - return [[undefined, undefined]]; - } - var length = array1.length; - var zipResult; - for (var i = 0; i < length; ++i) { - zipResult.push([array1[i], array2[i]]); - } - return zipResult; -} -var zipResult = zip(["foo", "bar"], [5, 6]); -var zipResultEle = zipResult[0]; // [string, number] -var zipResultEleEle = zipResult[0][0]; // string + + +//// [typeInferenceWithTupleType.js] +function combine(x, y) { + return [x, y]; +} +var combineResult = combine("string", 10); +var combineEle1 = combineResult[0]; // string +var combineEle2 = combineResult[1]; // number +function zip(array1, array2) { + if (array1.length != array2.length) { + return [[undefined, undefined]]; + } + var length = array1.length; + var zipResult; + for (var i = 0; i < length; ++i) { + zipResult.push([array1[i], array2[i]]); + } + return zipResult; +} +var zipResult = zip(["foo", "bar"], [5, 6]); +var zipResultEle = zipResult[0]; // [string, number] +var zipResultEleEle = zipResult[0][0]; // string diff --git a/tests/baselines/reference/typeInferenceWithTupleType.types b/tests/baselines/reference/typeInferenceWithTupleType.types index fbf1cd51920..3648c0aba50 100644 --- a/tests/baselines/reference/typeInferenceWithTupleType.types +++ b/tests/baselines/reference/typeInferenceWithTupleType.types @@ -1,114 +1,114 @@ -=== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts === -function combine(x: T, y: U): [T, U] { ->combine : (x: T, y: U) => [T, U] ->T : T ->U : U ->x : T ->T : T ->y : U ->U : U ->T : T ->U : U - - return [x, y]; ->[x, y] : [T, U] ->x : T ->y : U -} - -var combineResult = combine("string", 10); ->combineResult : [string, number] ->combine("string", 10) : [string, number] ->combine : (x: T, y: U) => [T, U] - -var combineEle1 = combineResult[0]; // string ->combineEle1 : string ->combineResult[0] : string ->combineResult : [string, number] - -var combineEle2 = combineResult[1]; // number ->combineEle2 : number ->combineResult[1] : number ->combineResult : [string, number] - -function zip(array1: T[], array2: U[]): [[T, U]] { ->zip : (array1: T[], array2: U[]) => [[T, U]] ->T : T ->U : U ->array1 : T[] ->T : T ->array2 : U[] ->U : U ->T : T ->U : U - - if (array1.length != array2.length) { ->array1.length != array2.length : boolean ->array1.length : number ->array1 : T[] ->length : number ->array2.length : number ->array2 : U[] ->length : number - - return [[undefined, undefined]]; ->[[undefined, undefined]] : [[undefined, undefined]] ->[undefined, undefined] : [undefined, undefined] ->undefined : undefined ->undefined : undefined - } - var length = array1.length; ->length : number ->array1.length : number ->array1 : T[] ->length : number - - var zipResult: [[T, U]]; ->zipResult : [[T, U]] ->T : T ->U : U - - for (var i = 0; i < length; ++i) { ->i : number ->i < length : boolean ->i : number ->length : number ->++i : number ->i : number - - zipResult.push([array1[i], array2[i]]); ->zipResult.push([array1[i], array2[i]]) : number ->zipResult.push : (...items: [T, U][]) => number ->zipResult : [[T, U]] ->push : (...items: [T, U][]) => number ->[array1[i], array2[i]] : [T, U] ->array1[i] : T ->array1 : T[] ->i : number ->array2[i] : U ->array2 : U[] ->i : number - } - return zipResult; ->zipResult : [[T, U]] -} - -var zipResult = zip(["foo", "bar"], [5, 6]); ->zipResult : [[string, number]] ->zip(["foo", "bar"], [5, 6]) : [[string, number]] ->zip : (array1: T[], array2: U[]) => [[T, U]] ->["foo", "bar"] : string[] ->[5, 6] : number[] - -var zipResultEle = zipResult[0]; // [string, number] ->zipResultEle : [string, number] ->zipResult[0] : [string, number] ->zipResult : [[string, number]] - -var zipResultEleEle = zipResult[0][0]; // string ->zipResultEleEle : string ->zipResult[0][0] : string ->zipResult[0] : [string, number] ->zipResult : [[string, number]] - - +=== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts === +function combine(x: T, y: U): [T, U] { +>combine : (x: T, y: U) => [T, U] +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +>U : U + + return [x, y]; +>[x, y] : [T, U] +>x : T +>y : U +} + +var combineResult = combine("string", 10); +>combineResult : [string, number] +>combine("string", 10) : [string, number] +>combine : (x: T, y: U) => [T, U] + +var combineEle1 = combineResult[0]; // string +>combineEle1 : string +>combineResult[0] : string +>combineResult : [string, number] + +var combineEle2 = combineResult[1]; // number +>combineEle2 : number +>combineResult[1] : number +>combineResult : [string, number] + +function zip(array1: T[], array2: U[]): [[T, U]] { +>zip : (array1: T[], array2: U[]) => [[T, U]] +>T : T +>U : U +>array1 : T[] +>T : T +>array2 : U[] +>U : U +>T : T +>U : U + + if (array1.length != array2.length) { +>array1.length != array2.length : boolean +>array1.length : number +>array1 : T[] +>length : number +>array2.length : number +>array2 : U[] +>length : number + + return [[undefined, undefined]]; +>[[undefined, undefined]] : [[undefined, undefined]] +>[undefined, undefined] : [undefined, undefined] +>undefined : undefined +>undefined : undefined + } + var length = array1.length; +>length : number +>array1.length : number +>array1 : T[] +>length : number + + var zipResult: [[T, U]]; +>zipResult : [[T, U]] +>T : T +>U : U + + for (var i = 0; i < length; ++i) { +>i : number +>i < length : boolean +>i : number +>length : number +>++i : number +>i : number + + zipResult.push([array1[i], array2[i]]); +>zipResult.push([array1[i], array2[i]]) : number +>zipResult.push : (...items: [T, U][]) => number +>zipResult : [[T, U]] +>push : (...items: [T, U][]) => number +>[array1[i], array2[i]] : [T, U] +>array1[i] : T +>array1 : T[] +>i : number +>array2[i] : U +>array2 : U[] +>i : number + } + return zipResult; +>zipResult : [[T, U]] +} + +var zipResult = zip(["foo", "bar"], [5, 6]); +>zipResult : [[string, number]] +>zip(["foo", "bar"], [5, 6]) : [[string, number]] +>zip : (array1: T[], array2: U[]) => [[T, U]] +>["foo", "bar"] : string[] +>[5, 6] : number[] + +var zipResultEle = zipResult[0]; // [string, number] +>zipResultEle : [string, number] +>zipResult[0] : [string, number] +>zipResult : [[string, number]] + +var zipResultEleEle = zipResult[0][0]; // string +>zipResultEleEle : string +>zipResult[0][0] : string +>zipResult[0] : [string, number] +>zipResult : [[string, number]] + +