From 865f3281bcf91fbf76a90aea5c86496af585f006 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 16 Nov 2017 09:39:31 -0800 Subject: [PATCH] Update spread tests w/new excess arguments error --- .../reference/callWithSpread2.errors.txt | 32 ++++++++++--------- tests/baselines/reference/callWithSpread2.js | 12 ++----- .../reference/callWithSpread2.symbols | 18 +---------- .../baselines/reference/callWithSpread2.types | 28 +--------------- .../functionCalls/callWithSpread2.ts | 6 +--- 5 files changed, 22 insertions(+), 74 deletions(-) diff --git a/tests/baselines/reference/callWithSpread2.errors.txt b/tests/baselines/reference/callWithSpread2.errors.txt index 89617ab6074..7272b1b9f3b 100644 --- a/tests/baselines/reference/callWithSpread2.errors.txt +++ b/tests/baselines/reference/callWithSpread2.errors.txt @@ -1,21 +1,23 @@ -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(30,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(22,1): error TS2556: Expected 1 arguments, but got a minimum of 2. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(23,1): error TS2556: Expected 0 arguments, but got a minimum of 1. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(26,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(31,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(27,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(32,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(28,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(33,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(29,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(30,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(35,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(31,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(36,1): error TS2556: Expected 1-3 arguments, but got a minimum of 0. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(37,1): error TS2556: Expected 1-3 arguments, but got a minimum of 0. -tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(38,1): error TS2556: Expected 1-3 arguments, but got a minimum of 0. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(32,1): error TS2556: Expected 1-3 arguments, but got a minimum of 0. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(33,1): error TS2556: Expected 1-3 arguments, but got a minimum of 0. +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,1): error TS2556: Expected 1-3 arguments, but got a minimum of 0. -==== tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts (9 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts (11 errors) ==== declare function all(a?: number, b?: number): void; declare function weird(a?: number | string, b?: number | string): void; declare function prefix(s: string, a?: number, b?: number): void; @@ -36,13 +38,13 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(38,1): erro rest("d", ...ns) - // this covers the arguments case + // extra arguments normal("g", ...ns) - normal("h", ...mixed) - normal("i", ...tuple) + ~~~~~~~~~~~~~~~~~~ +!!! error TS2556: Expected 1 arguments, but got a minimum of 2. thunk(...ns) - thunk(...mixed) - thunk(...tuple) + ~~~~~~~~~~~~ +!!! error TS2556: Expected 0 arguments, but got a minimum of 1. // bad all(...mixed) diff --git a/tests/baselines/reference/callWithSpread2.js b/tests/baselines/reference/callWithSpread2.js index 55296d924f7..27bcc893ca8 100644 --- a/tests/baselines/reference/callWithSpread2.js +++ b/tests/baselines/reference/callWithSpread2.js @@ -19,13 +19,9 @@ prefix("a", ...ns) rest("d", ...ns) -// this covers the arguments case +// extra arguments normal("g", ...ns) -normal("h", ...mixed) -normal("i", ...tuple) thunk(...ns) -thunk(...mixed) -thunk(...tuple) // bad all(...mixed) @@ -47,13 +43,9 @@ weird.apply(void 0, mixed); weird.apply(void 0, tuple); prefix.apply(void 0, ["a"].concat(ns)); rest.apply(void 0, ["d"].concat(ns)); -// this covers the arguments case +// extra arguments normal.apply(void 0, ["g"].concat(ns)); -normal.apply(void 0, ["h"].concat(mixed)); -normal.apply(void 0, ["i"].concat(tuple)); thunk.apply(void 0, ns); -thunk.apply(void 0, mixed); -thunk.apply(void 0, tuple); // bad all.apply(void 0, mixed); all.apply(void 0, tuple); diff --git a/tests/baselines/reference/callWithSpread2.symbols b/tests/baselines/reference/callWithSpread2.symbols index 169e8c8d47e..8ce7fb6f903 100644 --- a/tests/baselines/reference/callWithSpread2.symbols +++ b/tests/baselines/reference/callWithSpread2.symbols @@ -64,31 +64,15 @@ rest("d", ...ns) >ns : Symbol(ns, Decl(callWithSpread2.ts, 7, 11)) -// this covers the arguments case +// extra arguments normal("g", ...ns) >normal : Symbol(normal, Decl(callWithSpread2.ts, 3, 83)) >ns : Symbol(ns, Decl(callWithSpread2.ts, 7, 11)) -normal("h", ...mixed) ->normal : Symbol(normal, Decl(callWithSpread2.ts, 3, 83)) ->mixed : Symbol(mixed, Decl(callWithSpread2.ts, 8, 11)) - -normal("i", ...tuple) ->normal : Symbol(normal, Decl(callWithSpread2.ts, 3, 83)) ->tuple : Symbol(tuple, Decl(callWithSpread2.ts, 9, 11)) - thunk(...ns) >thunk : Symbol(thunk, Decl(callWithSpread2.ts, 4, 41)) >ns : Symbol(ns, Decl(callWithSpread2.ts, 7, 11)) -thunk(...mixed) ->thunk : Symbol(thunk, Decl(callWithSpread2.ts, 4, 41)) ->mixed : Symbol(mixed, Decl(callWithSpread2.ts, 8, 11)) - -thunk(...tuple) ->thunk : Symbol(thunk, Decl(callWithSpread2.ts, 4, 41)) ->tuple : Symbol(tuple, Decl(callWithSpread2.ts, 9, 11)) - // bad all(...mixed) >all : Symbol(all, Decl(callWithSpread2.ts, 0, 0)) diff --git a/tests/baselines/reference/callWithSpread2.types b/tests/baselines/reference/callWithSpread2.types index 75f0f18d287..4c87b9bd74d 100644 --- a/tests/baselines/reference/callWithSpread2.types +++ b/tests/baselines/reference/callWithSpread2.types @@ -78,7 +78,7 @@ rest("d", ...ns) >ns : number[] -// this covers the arguments case +// extra arguments normal("g", ...ns) >normal("g", ...ns) : void >normal : (s: string) => void @@ -86,38 +86,12 @@ normal("g", ...ns) >...ns : number >ns : number[] -normal("h", ...mixed) ->normal("h", ...mixed) : void ->normal : (s: string) => void ->"h" : "h" ->...mixed : string | number ->mixed : (string | number)[] - -normal("i", ...tuple) ->normal("i", ...tuple) : void ->normal : (s: string) => void ->"i" : "i" ->...tuple : string | number ->tuple : [number, string] - thunk(...ns) >thunk(...ns) : string >thunk : () => string >...ns : number >ns : number[] -thunk(...mixed) ->thunk(...mixed) : string ->thunk : () => string ->...mixed : string | number ->mixed : (string | number)[] - -thunk(...tuple) ->thunk(...tuple) : string ->thunk : () => string ->...tuple : string | number ->tuple : [number, string] - // bad all(...mixed) >all(...mixed) : void diff --git a/tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts b/tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts index 9151f52f00d..abf445a700e 100644 --- a/tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts +++ b/tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts @@ -18,13 +18,9 @@ prefix("a", ...ns) rest("d", ...ns) -// this covers the arguments case +// extra arguments normal("g", ...ns) -normal("h", ...mixed) -normal("i", ...tuple) thunk(...ns) -thunk(...mixed) -thunk(...tuple) // bad all(...mixed)