From 78a36c0cee390014637e151df0025c5196338730 Mon Sep 17 00:00:00 2001 From: Tingan Ho Date: Sat, 16 May 2015 16:42:49 +0800 Subject: [PATCH] Fixes concat style --- src/compiler/emitter.ts | 19 +- .../reference/newWithSpread.errors.txt | 63 +++-- tests/baselines/reference/newWithSpread.js | 16 ++ tests/baselines/reference/newWithSpreadES5.js | 63 +++-- .../reference/newWithSpreadES5.symbols | 255 +++++++++-------- .../reference/newWithSpreadES5.types | 23 ++ tests/baselines/reference/newWithSpreadES6.js | 12 + .../reference/newWithSpreadES6.symbols | 256 ++++++++++-------- .../reference/newWithSpreadES6.types | 24 ++ .../functionCalls/newWithSpread.ts | 7 + .../functionCalls/newWithSpreadES5.ts | 3 +- .../functionCalls/newWithSpreadES6.ts | 7 + 12 files changed, 452 insertions(+), 296 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 508b9654719..955a6b4b621 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1366,14 +1366,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { return true; } - function emitListWithSpread(elements: Expression[], needsUniqueCopy: boolean, multiLine: boolean, trailingComma: boolean) { + function emitListWithSpread(elements: Expression[], needsUniqueCopy: boolean, multiLine: boolean, trailingComma: boolean, useConcat: boolean) { let pos = 0; let group = 0; let length = elements.length; while (pos < length) { // Emit using the pattern .concat(, , ...) if (group === 1) { - write(".concat("); + if(useConcat) { + write(".concat("); + } + else { + write(", "); + } } else if (group > 1) { write(", "); @@ -1406,7 +1411,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { group++; } if (group > 1) { - write(")"); + if(useConcat) { + write(")"); + } } } @@ -1426,7 +1433,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } else { emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, - /*trailingComma*/ elements.hasTrailingComma); + /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } @@ -1850,7 +1857,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write("void 0"); } write(", "); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); write(")"); } @@ -1913,7 +1920,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write(".bind.apply("); emit(target); write(", [void 0].concat("); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/false, /*multiline*/false, /*trailingComma*/false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); write(")))"); write("()"); } diff --git a/tests/baselines/reference/newWithSpread.errors.txt b/tests/baselines/reference/newWithSpread.errors.txt index 2b02d91fccc..293c7054e4c 100644 --- a/tests/baselines/reference/newWithSpread.errors.txt +++ b/tests/baselines/reference/newWithSpread.errors.txt @@ -1,34 +1,39 @@ -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(34,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(35,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(39,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(40,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(44,15): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(45,15): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(49,17): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(50,17): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(54,18): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(55,18): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(59,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(60,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(64,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(65,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(69,20): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(70,20): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(74,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(75,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(79,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(80,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(84,27): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(85,27): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(89,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(90,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(37,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(38,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(41,8): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(42,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(46,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(47,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(51,15): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(52,15): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(56,17): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(57,17): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(61,18): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(62,18): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(66,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(67,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(71,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(72,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(76,20): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(77,20): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(81,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(82,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(86,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(87,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(91,27): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(92,27): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(96,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(97,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. -==== tests/cases/conformance/expressions/functionCalls/newWithSpread.ts (24 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/newWithSpread.ts (26 errors) ==== function f(x: number, y: number, ...z: string[]) { } + function f2(...x: string[]) { + } + interface A { f: { new (x: number, y: number, ...z: string[]); @@ -65,6 +70,14 @@ tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(90,23): error ~~~~ !!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + // Multiple spreads arguments + new f2(...a, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new f(1 ,2, ...a, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); diff --git a/tests/baselines/reference/newWithSpread.js b/tests/baselines/reference/newWithSpread.js index 6fba9e9a9e8..3161eb9f67e 100644 --- a/tests/baselines/reference/newWithSpread.js +++ b/tests/baselines/reference/newWithSpread.js @@ -3,6 +3,9 @@ function f(x: number, y: number, ...z: string[]) { } +function f2(...x: string[]) { +} + interface A { f: { new (x: number, y: number, ...z: string[]); @@ -35,6 +38,10 @@ new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); @@ -97,6 +104,12 @@ function f(x, y) { z[_i - 2] = arguments[_i]; } } +function f2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} var B = (function () { function B(x, y) { var z = []; @@ -118,6 +131,9 @@ var i; new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1, 2, ...a, ...a); // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); diff --git a/tests/baselines/reference/newWithSpreadES5.js b/tests/baselines/reference/newWithSpreadES5.js index 22667d80cab..f7470266273 100644 --- a/tests/baselines/reference/newWithSpreadES5.js +++ b/tests/baselines/reference/newWithSpreadES5.js @@ -3,6 +3,8 @@ function f(x: number, y: number, ...z: string[]) { } +function f2(...x: string[]) {} + interface A { f: { new (x: number, y: number, ...z: string[]); @@ -35,6 +37,10 @@ new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); @@ -97,6 +103,12 @@ function f(x, y) { z[_i - 2] = arguments[_i]; } } +function f2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} var B = (function () { function B(x, y) { var z = []; @@ -116,50 +128,53 @@ var h; var i; // Basic expression new f(1, 2, "string"); -new (f.bind.apply(f, [void 0].concat([1, 2].concat(a))))(); -new (f.bind.apply(f, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new (f.bind.apply(f, [void 0].concat([1, 2], a)))(); +new (f.bind.apply(f, [void 0].concat([1, 2], a, ["string"])))(); +// Multiple spreads arguments +new (f2.bind.apply(f2, [void 0].concat(a, a)))(); +new (f.bind.apply(f, [void 0].concat([1, 2], a, a)))(); // Call expression new f(1, 2, "string")(); -new (f.bind.apply(f, [void 0].concat([1, 2].concat(a))))()(); -new (f.bind.apply(f, [void 0].concat([1, 2].concat(a, ["string"]))))()(); +new (f.bind.apply(f, [void 0].concat([1, 2], a)))()(); +new (f.bind.apply(f, [void 0].concat([1, 2], a, ["string"])))()(); // Property access expression new b.f(1, 2, "string"); -new ((_a = b.f).bind.apply(_a, [void 0].concat([1, 2].concat(a))))(); -new ((_b = b.f).bind.apply(_b, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_a = b.f).bind.apply(_a, [void 0].concat([1, 2], a)))(); +new ((_b = b.f).bind.apply(_b, [void 0].concat([1, 2], a, ["string"])))(); // Parenthesised expression new (b.f)(1, 2, "string"); -new ((_c = (b.f)).bind.apply(_c, [void 0].concat([1, 2].concat(a))))(); -new ((_d = (b.f)).bind.apply(_d, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_c = (b.f)).bind.apply(_c, [void 0].concat([1, 2], a)))(); +new ((_d = (b.f)).bind.apply(_d, [void 0].concat([1, 2], a, ["string"])))(); // Element access expression new d[1].f(1, 2, "string"); -new ((_e = d[1].f).bind.apply(_e, [void 0].concat([1, 2].concat(a))))(); -new ((_f = d[1].f).bind.apply(_f, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_e = d[1].f).bind.apply(_e, [void 0].concat([1, 2], a)))(); +new ((_f = d[1].f).bind.apply(_f, [void 0].concat([1, 2], a, ["string"])))(); // Element access expression with a punctuated key new e["a-b"].f(1, 2, "string"); -new ((_g = e["a-b"].f).bind.apply(_g, [void 0].concat([1, 2].concat(a))))(); -new ((_h = e["a-b"].f).bind.apply(_h, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_g = e["a-b"].f).bind.apply(_g, [void 0].concat([1, 2], a)))(); +new ((_h = e["a-b"].f).bind.apply(_h, [void 0].concat([1, 2], a, ["string"])))(); // Basic expression new B(1, 2, "string"); -new (B.bind.apply(B, [void 0].concat([1, 2].concat(a))))(); -new (B.bind.apply(B, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new (B.bind.apply(B, [void 0].concat([1, 2], a)))(); +new (B.bind.apply(B, [void 0].concat([1, 2], a, ["string"])))(); // Property access expression new c["a-b"](1, 2, "string"); -new ((_j = c["a-b"]).bind.apply(_j, [void 0].concat([1, 2].concat(a))))(); -new ((_k = c["a-b"]).bind.apply(_k, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_j = c["a-b"]).bind.apply(_j, [void 0].concat([1, 2], a)))(); +new ((_k = c["a-b"]).bind.apply(_k, [void 0].concat([1, 2], a, ["string"])))(); // Parenthesised expression new (c["a-b"])(1, 2, "string"); -new ((_l = (c["a-b"])).bind.apply(_l, [void 0].concat([1, 2].concat(a))))(); -new ((_m = (c["a-b"])).bind.apply(_m, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_l = (c["a-b"])).bind.apply(_l, [void 0].concat([1, 2], a)))(); +new ((_m = (c["a-b"])).bind.apply(_m, [void 0].concat([1, 2], a, ["string"])))(); // Element access expression new g[1]["a-b"](1, 2, "string"); -new ((_o = g[1]["a-b"]).bind.apply(_o, [void 0].concat([1, 2].concat(a))))(); -new ((_p = g[1]["a-b"]).bind.apply(_p, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_o = g[1]["a-b"]).bind.apply(_o, [void 0].concat([1, 2], a)))(); +new ((_p = g[1]["a-b"]).bind.apply(_p, [void 0].concat([1, 2], a, ["string"])))(); // Element access expression with a punctuated key new h["a-b"]["a-b"](1, 2, "string"); -new ((_q = h["a-b"]["a-b"]).bind.apply(_q, [void 0].concat([1, 2].concat(a))))(); -new ((_r = h["a-b"]["a-b"]).bind.apply(_r, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_q = h["a-b"]["a-b"]).bind.apply(_q, [void 0].concat([1, 2], a)))(); +new ((_r = h["a-b"]["a-b"]).bind.apply(_r, [void 0].concat([1, 2], a, ["string"])))(); // Element access expression with a number new i["a-b"][1](1, 2, "string"); -new ((_s = i["a-b"][1]).bind.apply(_s, [void 0].concat([1, 2].concat(a))))(); -new ((_t = i["a-b"][1]).bind.apply(_t, [void 0].concat([1, 2].concat(a, ["string"]))))(); +new ((_s = i["a-b"][1]).bind.apply(_s, [void 0].concat([1, 2], a)))(); +new ((_t = i["a-b"][1]).bind.apply(_t, [void 0].concat([1, 2], a, ["string"])))(); var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; diff --git a/tests/baselines/reference/newWithSpreadES5.symbols b/tests/baselines/reference/newWithSpreadES5.symbols index dc37c41f597..021674ef337 100644 --- a/tests/baselines/reference/newWithSpreadES5.symbols +++ b/tests/baselines/reference/newWithSpreadES5.symbols @@ -7,74 +7,78 @@ function f(x: number, y: number, ...z: string[]) { >z : Symbol(z, Decl(newWithSpreadES5.ts, 1, 32)) } +function f2(...x: string[]) {} +>f2 : Symbol(f2, Decl(newWithSpreadES5.ts, 2, 1)) +>x : Symbol(x, Decl(newWithSpreadES5.ts, 4, 12)) + interface A { ->A : Symbol(A, Decl(newWithSpreadES5.ts, 2, 1)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) f: { ->f : Symbol(f, Decl(newWithSpreadES5.ts, 4, 13)) +>f : Symbol(f, Decl(newWithSpreadES5.ts, 6, 13)) new (x: number, y: number, ...z: string[]); ->x : Symbol(x, Decl(newWithSpreadES5.ts, 6, 13)) ->y : Symbol(y, Decl(newWithSpreadES5.ts, 6, 23)) ->z : Symbol(z, Decl(newWithSpreadES5.ts, 6, 34)) +>x : Symbol(x, Decl(newWithSpreadES5.ts, 8, 13)) +>y : Symbol(y, Decl(newWithSpreadES5.ts, 8, 23)) +>z : Symbol(z, Decl(newWithSpreadES5.ts, 8, 34)) } } class B { ->B : Symbol(B, Decl(newWithSpreadES5.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) constructor(x: number, y: number, ...z: string[]) {} ->x : Symbol(x, Decl(newWithSpreadES5.ts, 11, 16)) ->y : Symbol(y, Decl(newWithSpreadES5.ts, 11, 26)) ->z : Symbol(z, Decl(newWithSpreadES5.ts, 11, 37)) +>x : Symbol(x, Decl(newWithSpreadES5.ts, 13, 16)) +>y : Symbol(y, Decl(newWithSpreadES5.ts, 13, 26)) +>z : Symbol(z, Decl(newWithSpreadES5.ts, 13, 37)) } interface C { ->C : Symbol(C, Decl(newWithSpreadES5.ts, 12, 1)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) "a-b": typeof B; ->B : Symbol(B, Decl(newWithSpreadES5.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) } interface D { ->D : Symbol(D, Decl(newWithSpreadES5.ts, 16, 1)) +>D : Symbol(D, Decl(newWithSpreadES5.ts, 18, 1)) 1: typeof B; ->B : Symbol(B, Decl(newWithSpreadES5.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) } var a: string[]; ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) var b: A; ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->A : Symbol(A, Decl(newWithSpreadES5.ts, 2, 1)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) var c: C; ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->C : Symbol(C, Decl(newWithSpreadES5.ts, 12, 1)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) var d: A[]; ->d : Symbol(d, Decl(newWithSpreadES5.ts, 25, 3)) ->A : Symbol(A, Decl(newWithSpreadES5.ts, 2, 1)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) var e: { [key: string]: A }; ->e : Symbol(e, Decl(newWithSpreadES5.ts, 26, 3)) ->key : Symbol(key, Decl(newWithSpreadES5.ts, 26, 10)) ->A : Symbol(A, Decl(newWithSpreadES5.ts, 2, 1)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>key : Symbol(key, Decl(newWithSpreadES5.ts, 28, 10)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) var g: C[]; ->g : Symbol(g, Decl(newWithSpreadES5.ts, 27, 3)) ->C : Symbol(C, Decl(newWithSpreadES5.ts, 12, 1)) +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) var h: { [key: string]: C }; ->h : Symbol(h, Decl(newWithSpreadES5.ts, 28, 3)) ->key : Symbol(key, Decl(newWithSpreadES5.ts, 28, 10)) ->C : Symbol(C, Decl(newWithSpreadES5.ts, 12, 1)) +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>key : Symbol(key, Decl(newWithSpreadES5.ts, 30, 10)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) var i: C[][]; ->i : Symbol(i, Decl(newWithSpreadES5.ts, 29, 3)) ->C : Symbol(C, Decl(newWithSpreadES5.ts, 12, 1)) +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) // Basic expression new f(1, 2, "string"); @@ -82,11 +86,22 @@ new f(1, 2, "string"); new f(1, 2, ...a); >f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new f(1, 2, ...a, "string"); >f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Multiple spreads arguments +new f2(...a, ...a); +>f2 : Symbol(f2, Decl(newWithSpreadES5.ts, 2, 1)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new f(1 ,2, ...a, ...a); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Call expression new f(1, 2, "string")(); @@ -94,165 +109,165 @@ new f(1, 2, "string")(); new f(1, 2, ...a)(); >f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new f(1, 2, ...a, "string")(); >f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Property access expression new b.f(1, 2, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) new b.f(1, 2, ...a); ->b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new b.f(1, 2, ...a, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Parenthesised expression new (b.f)(1, 2, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) new (b.f)(1, 2, ...a); ->b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new (b.f)(1, 2, ...a, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES5.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression new d[1].f(1, 2, "string"); ->d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->d : Symbol(d, Decl(newWithSpreadES5.ts, 25, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) +>d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) new d[1].f(1, 2, ...a); ->d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->d : Symbol(d, Decl(newWithSpreadES5.ts, 25, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new d[1].f(1, 2, ...a, "string"); ->d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->d : Symbol(d, Decl(newWithSpreadES5.ts, 25, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression with a punctuated key new e["a-b"].f(1, 2, "string"); ->e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->e : Symbol(e, Decl(newWithSpreadES5.ts, 26, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) new e["a-b"].f(1, 2, ...a); ->e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->e : Symbol(e, Decl(newWithSpreadES5.ts, 26, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new e["a-b"].f(1, 2, ...a, "string"); ->e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->e : Symbol(e, Decl(newWithSpreadES5.ts, 26, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES5.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Basic expression new B(1, 2, "string"); ->B : Symbol(B, Decl(newWithSpreadES5.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) new B(1, 2, ...a); ->B : Symbol(B, Decl(newWithSpreadES5.ts, 8, 1)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new B(1, 2, ...a, "string"); ->B : Symbol(B, Decl(newWithSpreadES5.ts, 8, 1)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Property access expression new c["a-b"](1, 2, "string"); ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) new c["a-b"](1, 2, ...a); ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new c["a-b"](1, 2, ...a, "string"); ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Parenthesised expression new (c["a-b"])(1, 2, "string"); ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) new (c["a-b"])(1, 2, ...a); ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new (c["a-b"])(1, 2, ...a, "string"); ->c : Symbol(c, Decl(newWithSpreadES5.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression new g[1]["a-b"](1, 2, "string"); ->g : Symbol(g, Decl(newWithSpreadES5.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) new g[1]["a-b"](1, 2, ...a); ->g : Symbol(g, Decl(newWithSpreadES5.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new g[1]["a-b"](1, 2, ...a, "string"); ->g : Symbol(g, Decl(newWithSpreadES5.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression with a punctuated key new h["a-b"]["a-b"](1, 2, "string"); ->h : Symbol(h, Decl(newWithSpreadES5.ts, 28, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) new h["a-b"]["a-b"](1, 2, ...a); ->h : Symbol(h, Decl(newWithSpreadES5.ts, 28, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new h["a-b"]["a-b"](1, 2, ...a, "string"); ->h : Symbol(h, Decl(newWithSpreadES5.ts, 28, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) // Element access expression with a number new i["a-b"][1](1, 2, "string"); ->i : Symbol(i, Decl(newWithSpreadES5.ts, 29, 3)) +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) new i["a-b"][1](1, 2, ...a); ->i : Symbol(i, Decl(newWithSpreadES5.ts, 29, 3)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) new i["a-b"][1](1, 2, ...a, "string"); ->i : Symbol(i, Decl(newWithSpreadES5.ts, 29, 3)) ->a : Symbol(a, Decl(newWithSpreadES5.ts, 22, 3)) +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) diff --git a/tests/baselines/reference/newWithSpreadES5.types b/tests/baselines/reference/newWithSpreadES5.types index 9948d075bef..a2c83ed6372 100644 --- a/tests/baselines/reference/newWithSpreadES5.types +++ b/tests/baselines/reference/newWithSpreadES5.types @@ -7,6 +7,10 @@ function f(x: number, y: number, ...z: string[]) { >z : string[] } +function f2(...x: string[]) {} +>f2 : (...x: string[]) => void +>x : string[] + interface A { >A : A @@ -101,6 +105,25 @@ new f(1, 2, ...a, "string"); >a : string[] >"string" : string +// Multiple spreads arguments +new f2(...a, ...a); +>new f2(...a, ...a) : any +>f2 : (...x: string[]) => void +>...a : string +>a : string[] +>...a : string +>a : string[] + +new f(1 ,2, ...a, ...a); +>new f(1 ,2, ...a, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>...a : string +>a : string[] + // Call expression new f(1, 2, "string")(); >new f(1, 2, "string")() : any diff --git a/tests/baselines/reference/newWithSpreadES6.js b/tests/baselines/reference/newWithSpreadES6.js index dae7c9229db..b712984f05e 100644 --- a/tests/baselines/reference/newWithSpreadES6.js +++ b/tests/baselines/reference/newWithSpreadES6.js @@ -3,6 +3,9 @@ function f(x: number, y: number, ...z: string[]) { } +function f2(...x: string[]) { +} + interface A { f: { new (x: number, y: number, ...z: string[]); @@ -35,6 +38,10 @@ new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); @@ -93,6 +100,8 @@ new i["a-b"][1](1, 2, ...a, "string"); //// [newWithSpreadES6.js] function f(x, y, ...z) { } +function f2(...x) { +} class B { constructor(x, y, ...z) { } @@ -109,6 +118,9 @@ var i; new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1, 2, ...a, ...a); // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); diff --git a/tests/baselines/reference/newWithSpreadES6.symbols b/tests/baselines/reference/newWithSpreadES6.symbols index f16984fb481..51a34ad73ef 100644 --- a/tests/baselines/reference/newWithSpreadES6.symbols +++ b/tests/baselines/reference/newWithSpreadES6.symbols @@ -7,74 +7,79 @@ function f(x: number, y: number, ...z: string[]) { >z : Symbol(z, Decl(newWithSpreadES6.ts, 1, 32)) } +function f2(...x: string[]) { +>f2 : Symbol(f2, Decl(newWithSpreadES6.ts, 2, 1)) +>x : Symbol(x, Decl(newWithSpreadES6.ts, 4, 12)) +} + interface A { ->A : Symbol(A, Decl(newWithSpreadES6.ts, 2, 1)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) f: { ->f : Symbol(f, Decl(newWithSpreadES6.ts, 4, 13)) +>f : Symbol(f, Decl(newWithSpreadES6.ts, 7, 13)) new (x: number, y: number, ...z: string[]); ->x : Symbol(x, Decl(newWithSpreadES6.ts, 6, 13)) ->y : Symbol(y, Decl(newWithSpreadES6.ts, 6, 23)) ->z : Symbol(z, Decl(newWithSpreadES6.ts, 6, 34)) +>x : Symbol(x, Decl(newWithSpreadES6.ts, 9, 13)) +>y : Symbol(y, Decl(newWithSpreadES6.ts, 9, 23)) +>z : Symbol(z, Decl(newWithSpreadES6.ts, 9, 34)) } } class B { ->B : Symbol(B, Decl(newWithSpreadES6.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) constructor(x: number, y: number, ...z: string[]) {} ->x : Symbol(x, Decl(newWithSpreadES6.ts, 11, 16)) ->y : Symbol(y, Decl(newWithSpreadES6.ts, 11, 26)) ->z : Symbol(z, Decl(newWithSpreadES6.ts, 11, 37)) +>x : Symbol(x, Decl(newWithSpreadES6.ts, 14, 16)) +>y : Symbol(y, Decl(newWithSpreadES6.ts, 14, 26)) +>z : Symbol(z, Decl(newWithSpreadES6.ts, 14, 37)) } interface C { ->C : Symbol(C, Decl(newWithSpreadES6.ts, 12, 1)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) "a-b": typeof B; ->B : Symbol(B, Decl(newWithSpreadES6.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) } interface D { ->D : Symbol(D, Decl(newWithSpreadES6.ts, 16, 1)) +>D : Symbol(D, Decl(newWithSpreadES6.ts, 19, 1)) 1: typeof B; ->B : Symbol(B, Decl(newWithSpreadES6.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) } var a: string[]; ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) var b: A; ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->A : Symbol(A, Decl(newWithSpreadES6.ts, 2, 1)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) var c: C; ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->C : Symbol(C, Decl(newWithSpreadES6.ts, 12, 1)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) var d: A[]; ->d : Symbol(d, Decl(newWithSpreadES6.ts, 25, 3)) ->A : Symbol(A, Decl(newWithSpreadES6.ts, 2, 1)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) var e: { [key: string]: A }; ->e : Symbol(e, Decl(newWithSpreadES6.ts, 26, 3)) ->key : Symbol(key, Decl(newWithSpreadES6.ts, 26, 10)) ->A : Symbol(A, Decl(newWithSpreadES6.ts, 2, 1)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>key : Symbol(key, Decl(newWithSpreadES6.ts, 29, 10)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) var g: C[]; ->g : Symbol(g, Decl(newWithSpreadES6.ts, 27, 3)) ->C : Symbol(C, Decl(newWithSpreadES6.ts, 12, 1)) +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) var h: { [key: string]: C }; ->h : Symbol(h, Decl(newWithSpreadES6.ts, 28, 3)) ->key : Symbol(key, Decl(newWithSpreadES6.ts, 28, 10)) ->C : Symbol(C, Decl(newWithSpreadES6.ts, 12, 1)) +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>key : Symbol(key, Decl(newWithSpreadES6.ts, 31, 10)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) var i: C[][]; ->i : Symbol(i, Decl(newWithSpreadES6.ts, 29, 3)) ->C : Symbol(C, Decl(newWithSpreadES6.ts, 12, 1)) +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) // Basic expression new f(1, 2, "string"); @@ -82,11 +87,22 @@ new f(1, 2, "string"); new f(1, 2, ...a); >f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new f(1, 2, ...a, "string"); >f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Multiple spreads arguments +new f2(...a, ...a); +>f2 : Symbol(f2, Decl(newWithSpreadES6.ts, 2, 1)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new f(1 ,2, ...a, ...a); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Call expression new f(1, 2, "string")(); @@ -94,165 +110,165 @@ new f(1, 2, "string")(); new f(1, 2, ...a)(); >f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new f(1, 2, ...a, "string")(); >f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Property access expression new b.f(1, 2, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) new b.f(1, 2, ...a); ->b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new b.f(1, 2, ...a, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Parenthesised expression new (b.f)(1, 2, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) new (b.f)(1, 2, ...a); ->b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new (b.f)(1, 2, ...a, "string"); ->b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->b : Symbol(b, Decl(newWithSpreadES6.ts, 23, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression new d[1].f(1, 2, "string"); ->d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->d : Symbol(d, Decl(newWithSpreadES6.ts, 25, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) +>d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) new d[1].f(1, 2, ...a); ->d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->d : Symbol(d, Decl(newWithSpreadES6.ts, 25, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new d[1].f(1, 2, ...a, "string"); ->d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->d : Symbol(d, Decl(newWithSpreadES6.ts, 25, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression with a punctuated key new e["a-b"].f(1, 2, "string"); ->e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->e : Symbol(e, Decl(newWithSpreadES6.ts, 26, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) new e["a-b"].f(1, 2, ...a); ->e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->e : Symbol(e, Decl(newWithSpreadES6.ts, 26, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new e["a-b"].f(1, 2, ...a, "string"); ->e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->e : Symbol(e, Decl(newWithSpreadES6.ts, 26, 3)) ->f : Symbol(A.f, Decl(newWithSpreadES6.ts, 4, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Basic expression new B(1, 2, "string"); ->B : Symbol(B, Decl(newWithSpreadES6.ts, 8, 1)) +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) new B(1, 2, ...a); ->B : Symbol(B, Decl(newWithSpreadES6.ts, 8, 1)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new B(1, 2, ...a, "string"); ->B : Symbol(B, Decl(newWithSpreadES6.ts, 8, 1)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Property access expression new c["a-b"](1, 2, "string"); ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) new c["a-b"](1, 2, ...a); ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new c["a-b"](1, 2, ...a, "string"); ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Parenthesised expression new (c["a-b"])(1, 2, "string"); ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) new (c["a-b"])(1, 2, ...a); ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new (c["a-b"])(1, 2, ...a, "string"); ->c : Symbol(c, Decl(newWithSpreadES6.ts, 24, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression new g[1]["a-b"](1, 2, "string"); ->g : Symbol(g, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) new g[1]["a-b"](1, 2, ...a); ->g : Symbol(g, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new g[1]["a-b"](1, 2, ...a, "string"); ->g : Symbol(g, Decl(newWithSpreadES6.ts, 27, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression with a punctuated key new h["a-b"]["a-b"](1, 2, "string"); ->h : Symbol(h, Decl(newWithSpreadES6.ts, 28, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) new h["a-b"]["a-b"](1, 2, ...a); ->h : Symbol(h, Decl(newWithSpreadES6.ts, 28, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new h["a-b"]["a-b"](1, 2, ...a, "string"); ->h : Symbol(h, Decl(newWithSpreadES6.ts, 28, 3)) ->"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 14, 13)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) // Element access expression with a number new i["a-b"][1](1, 2, "string"); ->i : Symbol(i, Decl(newWithSpreadES6.ts, 29, 3)) +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) new i["a-b"][1](1, 2, ...a); ->i : Symbol(i, Decl(newWithSpreadES6.ts, 29, 3)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) new i["a-b"][1](1, 2, ...a, "string"); ->i : Symbol(i, Decl(newWithSpreadES6.ts, 29, 3)) ->a : Symbol(a, Decl(newWithSpreadES6.ts, 22, 3)) +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) diff --git a/tests/baselines/reference/newWithSpreadES6.types b/tests/baselines/reference/newWithSpreadES6.types index 7be42103419..52951729e3d 100644 --- a/tests/baselines/reference/newWithSpreadES6.types +++ b/tests/baselines/reference/newWithSpreadES6.types @@ -7,6 +7,11 @@ function f(x: number, y: number, ...z: string[]) { >z : string[] } +function f2(...x: string[]) { +>f2 : (...x: string[]) => void +>x : string[] +} + interface A { >A : A @@ -101,6 +106,25 @@ new f(1, 2, ...a, "string"); >a : string[] >"string" : string +// Multiple spreads arguments +new f2(...a, ...a); +>new f2(...a, ...a) : any +>f2 : (...x: string[]) => void +>...a : string +>a : string[] +>...a : string +>a : string[] + +new f(1 ,2, ...a, ...a); +>new f(1 ,2, ...a, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>...a : string +>a : string[] + // Call expression new f(1, 2, "string")(); >new f(1, 2, "string")() : any diff --git a/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts b/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts index 6550658c814..d17919a7036 100644 --- a/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts +++ b/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts @@ -2,6 +2,9 @@ function f(x: number, y: number, ...z: string[]) { } +function f2(...x: string[]) { +} + interface A { f: { new (x: number, y: number, ...z: string[]); @@ -34,6 +37,10 @@ new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)(); diff --git a/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts index b826b639a8e..25ef3444669 100644 --- a/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts +++ b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts @@ -3,7 +3,7 @@ function f(x: number, y: number, ...z: string[]) { } -function f2(...a: string[]) {} +function f2(...x: string[]) {} interface A { f: { @@ -39,6 +39,7 @@ new f(1, 2, ...a, "string"); // Multiple spreads arguments new f2(...a, ...a); +new f(1 ,2, ...a, ...a); // Call expression new f(1, 2, "string")(); diff --git a/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts index ec235f7a619..0068b6cf80e 100644 --- a/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts +++ b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts @@ -3,6 +3,9 @@ function f(x: number, y: number, ...z: string[]) { } +function f2(...x: string[]) { +} + interface A { f: { new (x: number, y: number, ...z: string[]); @@ -35,6 +38,10 @@ new f(1, 2, "string"); new f(1, 2, ...a); new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + // Call expression new f(1, 2, "string")(); new f(1, 2, ...a)();