Accept rest parameter properties error baselines

This commit is contained in:
Erik Edrosa
2016-06-21 19:06:26 -04:00
parent 1a66f54e89
commit 65bd8e5b6c
8 changed files with 35 additions and 25 deletions

View File

@@ -1,5 +1,7 @@
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(11,13): error TS2370: A rest parameter must be of an array type.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(13,13): error TS2370: A rest parameter must be of an array type.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2304: Cannot find name 'array2'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,4): error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
@@ -10,12 +12,12 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
Type 'number | string' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(29,24): error TS1005: ',' expected.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(29,17): error TS1317: A parameter property cannot be declared using a rest parameter.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(34,22): error TS2304: Cannot find name 'E1'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(34,28): error TS2304: Cannot find name 'E'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts (10 errors) ====
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts (12 errors) ====
// If the parameter is a rest parameter, the parameter type is any[]
// A type annotation for a rest parameter must denote an array type.
@@ -34,7 +36,11 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
~~~~~~~~~~~~~~~
!!! error TS2370: A rest parameter must be of an array type.
function a3(...b?) { } // Error, can't be optional
~
!!! error TS1047: A rest parameter cannot be optional.
function a4(...b = [1,2,3]) { } // Error, can't have initializer
~
!!! error TS1048: A rest parameter cannot have an initializer.
function a5([a, b, [[c]]]) { }
function a6([a, b, c, ...x]: number[]) { }
@@ -64,8 +70,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
var temp = [1, 2, 3];
class C {
constructor(public ...temp) { } // Error, rest parameter can't have accessibilityModifier
~~~
!!! error TS1005: ',' expected.
~~~~~~~~~~~~~~
!!! error TS1317: A parameter property cannot be declared using a rest parameter.
}
// Rest parameter with generic

View File

@@ -83,11 +83,12 @@ a5([1, 2]); // Error, parameter type is [any, any, [[any]]]
a6([1, 2, "string"]); // Error, parameter type is number[]
var temp = [1, 2, 3];
var C = (function () {
function C(public) {
function C() {
var temp = [];
for (var _i = 1; _i < arguments.length; _i++) {
temp[_i - 1] = arguments[_i];
for (var _i = 0; _i < arguments.length; _i++) {
temp[_i - 0] = arguments[_i];
}
this.temp = temp;
} // Error, rest parameter can't have accessibilityModifier
return C;
}());

View File

@@ -1,10 +1,10 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,23): error TS1005: ',' expected.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,16): error TS1317: A parameter property cannot be declared using a rest parameter.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts (1 errors) ====
class Foo3 {
// Doesn't work, but should
constructor (public ...args: string[]) { }
~~~
!!! error TS1005: ',' expected.
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1317: A parameter property cannot be declared using a rest parameter.
}

View File

@@ -7,11 +7,12 @@ class Foo3 {
//// [parser509668.js]
var Foo3 = (function () {
// Doesn't work, but should
function Foo3(public) {
function Foo3() {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
this.args = args;
}
return Foo3;
}());

View File

@@ -1,9 +1,9 @@
tests/cases/compiler/restParamModifier2.ts(2,24): error TS1005: ',' expected.
tests/cases/compiler/restParamModifier2.ts(2,17): error TS1317: A parameter property cannot be declared using a rest parameter.
==== tests/cases/compiler/restParamModifier2.ts (1 errors) ====
class C {
constructor(public ...rest: string[]) {}
~~~
!!! error TS1005: ',' expected.
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1317: A parameter property cannot be declared using a rest parameter.
}

View File

@@ -5,11 +5,12 @@ class C {
//// [restParamModifier2.js]
var C = (function () {
function C(public) {
function C() {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
for (var _i = 0; _i < arguments.length; _i++) {
rest[_i - 0] = arguments[_i];
}
this.rest = rest;
}
return C;
}());

View File

@@ -1,4 +1,4 @@
tests/cases/compiler/varArgConstructorMemberParameter.ts(10,25): error TS1005: ',' expected.
tests/cases/compiler/varArgConstructorMemberParameter.ts(10,18): error TS1317: A parameter property cannot be declared using a rest parameter.
==== tests/cases/compiler/varArgConstructorMemberParameter.ts (1 errors) ====
@@ -12,7 +12,7 @@ tests/cases/compiler/varArgConstructorMemberParameter.ts(10,25): error TS1005: '
class Foo3 {
constructor (public ...args: string[]) { }
~~~
!!! error TS1005: ',' expected.
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1317: A parameter property cannot be declared using a rest parameter.
}

View File

@@ -29,11 +29,12 @@ var Foo2 = (function () {
return Foo2;
}());
var Foo3 = (function () {
function Foo3(public) {
function Foo3() {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
this.args = args;
}
return Foo3;
}());