From 64427a9df141bff6392f11f650b8852f8d9d4b74 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 1 Apr 2015 18:28:13 -0700 Subject: [PATCH 1/5] Remove checking for scriptTarget before setting parsing context for classLikeDeclaration --- src/compiler/parser.ts | 4 +--- src/server/client.ts | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2972fba397..e00c0c8d25 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4756,9 +4756,7 @@ module ts { function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration { // In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code let savedStrictModeContext = inStrictModeContext(); - if (languageVersion >= ScriptTarget.ES6) { - setStrictModeContext(true); - } + setStrictModeContext(true); var node = createNode(kind, fullStart); node.decorators = decorators; diff --git a/src/server/client.ts b/src/server/client.ts index 6042142178..d395d2a832 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -68,12 +68,12 @@ module ts.server { }; } - private processRequest(command: string, arguments?: any): T { + private processRequest(command: string, args?: any): T { var request: protocol.Request = { seq: this.sequence++, type: "request", - command: command, - arguments: arguments + arguments: args, + command }; this.writeMessage(JSON.stringify(request)); From 696e6a30fcb89be4c43dbbd3255210ee00efff61 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 1 Apr 2015 18:28:43 -0700 Subject: [PATCH 2/5] Update test and baseliens from parsing classLikeDeclaration in strict mode --- ...lisionArgumentsClassConstructor.errors.txt | 101 +- .../collisionArgumentsClassMethod.errors.txt | 89 +- .../computedPropertyNames3_ES5.errors.txt | 5 +- .../constructorStaticParamName.errors.txt | 12 + .../reference/constructorStaticParamName.js | 2 +- .../constructorStaticParamName.types | 10 - ...torWithIncompleteTypeAnnotation.errors.txt | 99 +- ...constructorWithIncompleteTypeAnnotation.js | 217 +++-- .../reference/convertKeywordsYes.errors.txt | 383 ++++++++ .../baselines/reference/convertKeywordsYes.js | 69 +- .../reference/convertKeywordsYes.types | 879 ------------------ .../decoratorOnClassAccessor3.errors.txt | 28 +- .../reference/decoratorOnClassAccessor3.js | 25 +- .../decoratorOnClassAccessor6.errors.txt | 37 +- .../reference/decoratorOnClassAccessor6.js | 23 +- ...torOnClassConstructorParameter4.errors.txt | 5 +- .../decoratorOnClassConstructorParameter4.js | 2 +- .../decoratorOnClassMethod3.errors.txt | 22 +- .../reference/decoratorOnClassMethod3.js | 18 +- .../decoratorOnClassProperty3.errors.txt | 19 +- .../reference/decoratorOnClassProperty3.js | 16 +- .../reference/parser509668.errors.txt | 5 +- tests/baselines/reference/parser509668.js | 2 +- .../reference/parser553699.errors.txt | 4 +- tests/baselines/reference/parser553699.js | 2 +- .../reference/parser642331.errors.txt | 10 + tests/baselines/reference/parser642331.js | 2 +- tests/baselines/reference/parser642331.types | 8 - .../reference/parserRealSource11.errors.txt | 8 +- .../superCallsInConstructor.errors.txt | 5 +- ...arArgConstructorMemberParameter.errors.txt | 5 +- .../varArgConstructorMemberParameter.js | 2 +- .../cases/fourslash/getOccurrencesDeclare1.ts | 1 - .../cases/fourslash/getOccurrencesDeclare3.ts | 1 - .../cases/fourslash/getOccurrencesExport1.ts | 1 - .../cases/fourslash/getOccurrencesExport3.ts | 1 - 36 files changed, 925 insertions(+), 1193 deletions(-) create mode 100644 tests/baselines/reference/constructorStaticParamName.errors.txt delete mode 100644 tests/baselines/reference/constructorStaticParamName.types create mode 100644 tests/baselines/reference/convertKeywordsYes.errors.txt delete mode 100644 tests/baselines/reference/convertKeywordsYes.types create mode 100644 tests/baselines/reference/parser642331.errors.txt delete mode 100644 tests/baselines/reference/parser642331.types diff --git a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt index f2ec9429eb..7e145688ba 100644 --- a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt @@ -1,40 +1,89 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,28): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(9,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(13,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(14,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(20,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(25,13): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,24): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(31,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(35,24): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(36,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(41,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(44,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(47,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(51,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(52,31): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,28): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(54,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(59,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(60,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(62,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(67,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(68,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(69,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(70,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(75,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(76,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(79,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(80,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(84,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: Invalid use of 'arguments' in strict mode. -==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (5 errors) ==== +==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (38 errors) ==== // Constructors class c1 { constructor(i: number, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments: any[]; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c12 { constructor(arguments: number, ...rest) { // error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. ~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c1NoError { constructor(arguments: number) { // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c2 { constructor(...restParameters) { var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c2NoError { constructor() { var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } @@ -42,63 +91,113 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396: constructor(public arguments: number, ...restParameters) { //arguments is error ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c3NoError { constructor(public arguments: number) { // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } declare class c4 { constructor(i: number, ...arguments); // No error - no code gen + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } declare class c42 { constructor(arguments: number, ...rest); // No error - no code gen + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } declare class c4NoError { constructor(arguments: number); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } class c5 { constructor(i: number, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(i: string, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(i: any, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments: any[]; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c52 { constructor(arguments: number, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(arguments: string, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(arguments: any, ...rest) { // error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. ~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } class c5NoError { constructor(arguments: number); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(arguments: string); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(arguments: any) { // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments: any; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } declare class c6 { constructor(i: number, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(i: string, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } declare class c62 { constructor(arguments: number, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(arguments: string, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } declare class c6NoError { constructor(arguments: number); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. constructor(arguments: string); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } \ No newline at end of file diff --git a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt index 38ad686720..34b92990c7 100644 --- a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt @@ -1,63 +1,150 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(2,27): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(2,30): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(6,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(8,23): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(9,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(11,29): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(12,29): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(13,23): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(13,26): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(14,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(16,16): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(17,16): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. +tests/cases/compiler/collisionArgumentsClassMethod.ts(19,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(21,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(22,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(23,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(24,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(29,30): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(30,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(31,23): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(33,29): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(34,29): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(35,16): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(36,16): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(37,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(38,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(43,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Invalid use of 'arguments' in strict mode. -==== tests/cases/compiler/collisionArgumentsClassMethod.ts (4 errors) ==== +==== tests/cases/compiler/collisionArgumentsClassMethod.ts (33 errors) ==== class c1 { public foo(i: number, ...arguments) { //arguments is error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments: any[]; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } public foo1(arguments: number, ...rest) { //arguments is error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. ~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } public fooNoError(arguments: number) { // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } public f4(i: number, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4(i: string, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4(i: any, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments: any[]; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } public f41(arguments: number, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f41(arguments: string, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f41(arguments: any, ...rest) { // error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. ~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } public f4NoError(arguments: number); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4NoError(arguments: string); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4NoError(arguments: any) { // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. var arguments: any; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } declare class c2 { public foo(i: number, ...arguments); // No error - no code gen + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public foo1(arguments: number, ...rest); // No error - no code gen + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public fooNoError(arguments: number); // No error - no code gen + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4(i: number, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4(i: string, ...arguments); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f41(arguments: number, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f41(arguments: string, ...rest); // no codegen no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4NoError(arguments: number); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. public f4NoError(arguments: string); // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } class c3 { public foo(...restParameters) { var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } public fooNoError() { var arguments = 10; // no error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index 82e4b71b33..a31965dc69 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -1,12 +1,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (7 errors) ==== var id; class C { [0 + 1]() { } @@ -18,6 +19,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1 !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + ~~ +!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/constructorStaticParamName.errors.txt b/tests/baselines/reference/constructorStaticParamName.errors.txt new file mode 100644 index 0000000000..ac50edd22f --- /dev/null +++ b/tests/baselines/reference/constructorStaticParamName.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1003: Identifier expected. + + +==== tests/cases/compiler/constructorStaticParamName.ts (1 errors) ==== + // static as constructor parameter name should only give error if 'use strict' + + class test { + constructor (static) { } + ~~~~~~ +!!! error TS1003: Identifier expected. + } + \ No newline at end of file diff --git a/tests/baselines/reference/constructorStaticParamName.js b/tests/baselines/reference/constructorStaticParamName.js index cf74aed2eb..85b2286744 100644 --- a/tests/baselines/reference/constructorStaticParamName.js +++ b/tests/baselines/reference/constructorStaticParamName.js @@ -9,7 +9,7 @@ class test { //// [constructorStaticParamName.js] // static as constructor parameter name should only give error if 'use strict' var test = (function () { - function test(static) { + function test() { } return test; })(); diff --git a/tests/baselines/reference/constructorStaticParamName.types b/tests/baselines/reference/constructorStaticParamName.types deleted file mode 100644 index 9fdc94e4a7..0000000000 --- a/tests/baselines/reference/constructorStaticParamName.types +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/compiler/constructorStaticParamName.ts === -// static as constructor parameter name should only give error if 'use strict' - -class test { ->test : test - - constructor (static) { } ->static : any -} - diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index fa1c6bea38..75de7c32eb 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -21,27 +21,47 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(49,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(65,29): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(81,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(90,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(94,17): error TS1134: Variable declaration expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(95,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(105,29): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(106,13): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2304: Cannot find name 'any'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,30): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,37): error TS2304: Cannot find name 'declare'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,47): error TS2304: Cannot find name 'constructor'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,61): error TS2304: Cannot find name 'get'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,67): error TS2304: Cannot find name 'implements'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(111,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,9): error TS2304: Cannot find name 'STATEMENTS'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,21): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,30): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,39): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(138,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(141,32): error TS1005: '{' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(143,13): error TS1005: 'try' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,16): error TS2304: Cannot find name 'TYPES'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,23): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,32): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,24): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,30): error TS1005: '(' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,31): error TS2304: Cannot find name 'Property'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,16): error TS2304: Cannot find name 'OPERATOR'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,26): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,35): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(210,5): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,29): error TS2304: Cannot find name 'yield'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected. @@ -49,7 +69,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,16): error TS2304: Cannot find name 'method1'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,24): error TS2304: Cannot find name 'val'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error TS2304: Cannot find name 'number'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'. @@ -64,27 +83,23 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2304: Cannot find name 'string'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2304: Cannot find name 'string'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS2304: Cannot find name 'public'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS2304: Cannot find name 'DefaultValue'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error TS2304: Cannot find name 'value'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. -==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (84 errors) ==== +==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (99 errors) ==== declare module "fs" { export class File { constructor(filename: string); @@ -199,6 +214,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS /// /// public VARIABLES(): number { + ~~~~~~ +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. var local = Number.MAX_VALUE; var min = Number.MIN_VALUE; var inf = Number.NEGATIVE_INFINITY - @@ -238,7 +255,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS var constructor = 0; var get = 0; var implements = 0; + ~~~~~~~~~~ +!!! error TS1134: Variable declaration expected. var interface = 0; + ~~~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. var let = 0; var module = 0; var number = 0; @@ -256,11 +277,23 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS !!! error TS1109: Expression expected. var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. + ~~~ +!!! error TS2304: Cannot find name 'any'. + ~~~~ +!!! error TS2304: Cannot find name 'bool'. + ~~~~~~~ +!!! error TS2304: Cannot find name 'declare'. + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'constructor'. + ~~~ +!!! error TS2304: Cannot find name 'get'. + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'implements'. return 0; } + ~ +!!! error TS1128: Declaration or statement expected. /// /// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally @@ -268,6 +301,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS /// /// STATEMENTS(i: number): number { + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'STATEMENTS'. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: ';' expected. var retVal = 0; if (i == 1) retVal = 1; @@ -311,6 +352,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS /// /// public TYPES(): number { + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~~~~~ +!!! error TS2304: Cannot find name 'TYPES'. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: ';' expected. var retVal = 0; var c = new CLASS(); var xx: IF = c; @@ -340,6 +389,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ///// ///// public OPERATOR(): number { + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~ +!!! error TS2304: Cannot find name 'OPERATOR'. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1005: ';' expected. var a: number[] = [1, 2, 3, 4, 5, ];/*[] bug*/ // YES [] var i = a[1];/*[]*/ i = i + i - i * i / i % i & i | i ^ i;/*+ - * / % & | ^*/ @@ -378,6 +435,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS } } + ~ +!!! error TS1128: Declaration or statement expected. interface IF { Foo(): bool; @@ -390,10 +449,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS case d = () => { yield 0; }; ~~~~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~~~~ -!!! error TS2304: Cannot find name 'yield'. - ~ -!!! error TS1005: ';' expected. public get Property() { return 0; } public Member() { return 0; @@ -425,8 +480,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS !!! error TS2304: Cannot find name 'val'. ~ !!! error TS1005: ',' expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'number'. ~ !!! error TS1005: ';' expected. return val; @@ -476,8 +529,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS !!! error TS2304: Cannot find name 'value'. ~ !!! error TS1005: ',' expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. public Overloads( while : string, ...rest: string[]) { & ~~~~~~ !!! error TS1128: Declaration or statement expected. @@ -487,20 +538,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS !!! error TS1135: Argument expression expected. ~ !!! error TS1005: '(' expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. ~~~ !!! error TS1109: Expression expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. ~ !!! error TS1005: ';' expected. ~ !!! error TS1109: Expression expected. public DefaultValue(value?: string = "Hello") { } - ~~~~~~ -!!! error TS2304: Cannot find name 'public'. ~~~~~~~~~~~~ !!! error TS1005: ';' expected. ~~~~~~~~~~~~ @@ -510,7 +555,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ~ !!! error TS1109: Expression expected. ~~~~~~ -!!! error TS2304: Cannot find name 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. ~ !!! error TS1005: ';' expected. } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 64c7027387..4fb940bc9e 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -342,6 +342,7 @@ var TypeScriptAllInOne; })(TypeScriptAllInOne || (TypeScriptAllInOne = {})); var BasicFeatures = (function () { function BasicFeatures() { + this.implements = 0; } /// /// Test various of variables. Including nullable,key world as variable,special format @@ -374,120 +375,118 @@ var BasicFeatures = (function () { var declare = 0; var constructor = 0; var get = 0; - var implements = 0; - var interface = 0; - var let = 0; - var module = 0; - var number = 0; - var package = 0; - var private = 0; - var protected = 0; - var public = 0; - var set = 0; - var static = 0; - var string = 0 / > - ; - var yield = 0; - var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; - return 0; - }; - /// - /// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally - /// - /// - /// - BasicFeatures.prototype.STATEMENTS = function (i) { - var retVal = 0; - if (i == 1) - retVal = 1; - else - retVal = 0; - switch (i) { - case 2: - retVal = 1; - break; - case 3: - retVal = 1; - break; - default: - break; - } - for (var x in { x: 0, y: 1 }) { - !; - try { - throw null; - } - catch (Exception) { } - } - try { - } - finally { - try { } - catch (Exception) { } - } - return retVal; - }; - /// - /// Test types in ts language. Including class,struct,interface,delegate,anonymous type - /// - /// - BasicFeatures.prototype.TYPES = function () { - var retVal = 0; - var c = new CLASS(); - var xx = c; - retVal += ; - try { } - catch () { } - Property; - retVal += c.Member(); - retVal += xx.Foo() ? 0 : 1; - //anonymous type - var anony = { a: new CLASS() }; - retVal += anony.a.d(); - return retVal; - }; - ///// - ///// Test different operators - ///// - ///// - BasicFeatures.prototype.OPERATOR = function () { - var a = [1, 2, 3, 4, 5,]; /*[] bug*/ // YES [] - var i = a[1]; /*[]*/ - i = i + i - i * i / i % i & i | i ^ i; /*+ - * / % & | ^*/ - var b = true && false || true ^ false; /*& | ^*/ - b = !b; /*!*/ - i = ~i; /*~i*/ - b = i < (i - 1) && (i + 1) > i; /*< && >*/ - var f = true ? 1 : 0; /*? :*/ // YES : - i++; /*++*/ - i--; /*--*/ - b = true && false || true; /*&& ||*/ - i = i << 5; /*<<*/ - i = i >> 5; /*>>*/ - var j = i; - b = i == j && i != j && i <= j && i >= j; /*= == && != <= >=*/ - i += 5.0; /*+=*/ - i -= i; /*-=*/ - i *= i; /**=*/ - if (i == 0) - i++; - i /= i; /*/=*/ - i %= i; /*%=*/ - i &= i; /*&=*/ - i |= i; /*|=*/ - i ^= i; /*^=*/ - i <<= i; /*<<=*/ - i >>= i; /*>>=*/ - if (i == 0 && != b && f == 1) - return 0; - else - return 1; + var ; }; return BasicFeatures; })(); +var interface = 0; +var let = 0; +var module = 0; +var number = 0; +var package = 0; +var private = 0; +var protected = 0; +var public = 0; +var set = 0; +var static = 0; +var string = 0 / > +; +var yield = 0; +var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; +return 0; +/// +/// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally +/// +/// +/// +STATEMENTS(i, number); +number; +{ + var retVal = 0; + if (i == 1) + retVal = 1; + else + retVal = 0; + switch (i) { + case 2: + retVal = 1; + break; + case 3: + retVal = 1; + break; + default: + break; + } + for (var x in { x: 0, y: 1 }) { + !; + try { + throw null; + } + catch (Exception) { } + } + try { + } + finally { + try { } + catch (Exception) { } + } + return retVal; +} +TYPES(); +number; +{ + var retVal = 0; + var c = new CLASS(); + var xx = c; + retVal += ; + try { } + catch () { } + Property; + retVal += c.Member(); + retVal += xx.Foo() ? 0 : 1; + //anonymous type + var anony = { a: new CLASS() }; + retVal += anony.a.d(); + return retVal; +} +OPERATOR(); +number; +{ + var a = [1, 2, 3, 4, 5,]; /*[] bug*/ // YES [] + var i = a[1]; /*[]*/ + i = i + i - i * i / i % i & i | i ^ i; /*+ - * / % & | ^*/ + var b = true && false || true ^ false; /*& | ^*/ + b = !b; /*!*/ + i = ~i; /*~i*/ + b = i < (i - 1) && (i + 1) > i; /*< && >*/ + var f = true ? 1 : 0; /*? :*/ // YES : + i++; /*++*/ + i--; /*--*/ + b = true && false || true; /*&& ||*/ + i = i << 5; /*<<*/ + i = i >> 5; /*>>*/ + var j = i; + b = i == j && i != j && i <= j && i >= j; /*= == && != <= >=*/ + i += 5.0; /*+=*/ + i -= i; /*-=*/ + i *= i; /**=*/ + if (i == 0) + i++; + i /= i; /*/=*/ + i %= i; /*%=*/ + i &= i; /*&=*/ + i |= i; /*|=*/ + i ^= i; /*^=*/ + i <<= i; /*<<=*/ + i >>= i; /*>>=*/ + if (i == 0 && != b && f == 1) + return 0; + else + return 1; +} var CLASS = (function () { function CLASS() { - this.d = function () { yield; 0; }; + this.d = function () { ; }; } Object.defineProperty(CLASS.prototype, "Property", { get: function () { return 0; }, diff --git a/tests/baselines/reference/convertKeywordsYes.errors.txt b/tests/baselines/reference/convertKeywordsYes.errors.txt new file mode 100644 index 0000000000..1a54e3615b --- /dev/null +++ b/tests/baselines/reference/convertKeywordsYes.errors.txt @@ -0,0 +1,383 @@ +tests/cases/compiler/convertKeywordsYes.ts(292,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(293,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(293,21): error TS1005: ';' expected. +tests/cases/compiler/convertKeywordsYes.ts(294,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(296,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(296,19): error TS1005: ';' expected. +tests/cases/compiler/convertKeywordsYes.ts(297,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(297,19): error TS1005: ';' expected. +tests/cases/compiler/convertKeywordsYes.ts(298,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(298,21): error TS1005: ';' expected. +tests/cases/compiler/convertKeywordsYes.ts(299,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(299,18): error TS1005: ';' expected. +tests/cases/compiler/convertKeywordsYes.ts(301,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(301,18): error TS1005: ';' expected. +tests/cases/compiler/convertKeywordsYes.ts(303,10): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(303,17): error TS1005: ';' expected. + + +==== tests/cases/compiler/convertKeywordsYes.ts (25 errors) ==== + // reserved ES5 future in strict mode + + var constructor = 0; + var any = 0; + var boolean = 0; + var implements = 0; + var interface = 0; + var let = 0; + var module = 0; + var number = 0; + var package = 0; + var private = 0; + var protected = 0; + var public = 0; + var set = 0; + var static = 0; + var string = 0; + var get = 0; + var yield = 0; + var declare = 0; + + function bigGeneric< + constructor, + implements , + interface , + let, + module , + package, + private , + protected, + public , + set , + static , + get , + yield, + declare + >(c: constructor, + a: any, + b2: boolean, + i: implements , + i2: interface , + l: let, + m: module , + n: number, + p: package, + p2: private , + p3: protected, + p4: public , + s: set , + s2: static , + s3: string, + g: get , + y: yield, + d: declare ) { } + + var bigObject = { + constructor: 0, + any: 0, + boolean: 0, + implements: 0, + interface: 0, + let: 0, + module: 0, + number: 0, + package: 0, + private: 0, + protected: 0, + public: 0, + set: 0, + static: 0, + string: 0, + get: 0, + yield: 0, + break: 0, + case: 0, + catch: 0, + class: 0, + continue: 0, + const: 0, + + debugger: 0, + declare: 0, + default: 0, + delete: 0, + do: 0, + else: 0, + enum: 0, + export: 0, + extends: 0, + false: 0, + finally: 0, + for: 0, + function: 0, + if: 0, + + import: 0, + in: 0, + instanceof: 0, + new: 0, + null: 0, + return: 0, + super: 0, + switch: 0, + this: 0, + throw: 0, + true: 0, + try: 0, + typeof: 0, + var: 0, + void: 0, + while: 0, + with: 0, + }; + + interface bigInterface { + constructor; + any; + boolean; + implements; + interface; + let; + module; + number; + package; + private; + protected; + public; + set; + static; + string; + get; + yield; + break; + case; + catch; + class; + continue; + const; + + debugger; + declare; + default; + delete; + do; + else; + enum; + export; + extends; + false; + finally; + for; + function; + if; + + import; + in; + instanceof; + new; + null; + return; + super; + switch; + this; + throw; + true; + try; + typeof; + var; + void; + while; + with; + } + + class bigClass { + public "constructor" = 0; + public any = 0; + public boolean = 0; + public implements = 0; + public interface = 0; + public let = 0; + public module = 0; + public number = 0; + public package = 0; + public private = 0; + public protected = 0; + public public = 0; + public set = 0; + public static = 0; + public string = 0; + public get = 0; + public yield = 0; + public break = 0; + public case = 0; + public catch = 0; + public class = 0; + public continue = 0; + public const = 0; + public debugger = 0; + public declare = 0; + public default = 0; + public delete = 0; + public do = 0; + public else = 0; + public enum = 0; + public export = 0; + public extends = 0; + public false = 0; + public finally = 0; + public for = 0; + public function = 0; + public if = 0; + public import = 0; + public in = 0; + public instanceof = 0; + public new = 0; + public null = 0; + public return = 0; + public super = 0; + public switch = 0; + public this = 0; + public throw = 0; + public true = 0; + public try = 0; + public typeof = 0; + public var = 0; + public void = 0; + public while = 0; + public with = 0; + } + + enum bigEnum { + constructor, + any, + boolean, + implements, + interface, + let, + module, + number, + package, + private, + protected, + public, + set, + static, + string, + get, + yield, + break, + case, + catch, + class, + continue, + const, + + debugger, + declare, + default, + delete, + do, + else, + enum, + export, + extends, + false, + finally, + for, + function, + if, + + import, + in, + instanceof, + new, + null, + return, + super, + switch, + this, + throw, + true, + try, + typeof, + var, + void, + while, + with, + } + + module bigModule { + class constructor { } + class implements { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~~~~~ +!!! error TS1003: Identifier expected. + class interface { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class let { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~ +!!! error TS1003: Identifier expected. + class module { } + class package { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class private { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class protected { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class public { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class set { } + class static { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class get { } + class yield { } + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ';' expected. + class declare { } + } \ No newline at end of file diff --git a/tests/baselines/reference/convertKeywordsYes.js b/tests/baselines/reference/convertKeywordsYes.js index a68f751f43..174ff31fc1 100644 --- a/tests/baselines/reference/convertKeywordsYes.js +++ b/tests/baselines/reference/convertKeywordsYes.js @@ -505,66 +505,81 @@ var bigModule; } return constructor; })(); - var implements = (function () { - function implements() { + var = (function () { + function () { } - return implements; + return ; })(); - var interface = (function () { - function interface() { + var = (function () { + function () { } - return interface; + return ; })(); - var let = (function () { - function let() { + interface; + { } + var = (function () { + function () { } - return let; + return ; })(); + var _a = void 0; var module = (function () { function module() { } return module; })(); - var package = (function () { - function package() { + var = (function () { + function () { } - return package; + return ; })(); - var private = (function () { - function private() { + package; + { } + var = (function () { + function () { } - return private; + return ; })(); - var protected = (function () { - function protected() { + private; + { } + var = (function () { + function () { } - return protected; + return ; })(); - var public = (function () { - function public() { + protected; + { } + var = (function () { + function () { } - return public; + return ; })(); + public; + { } var set = (function () { function set() { } return set; })(); - var static = (function () { - function static() { + var = (function () { + function () { } - return static; + return ; })(); + static; + { } var get = (function () { function get() { } return get; })(); - var yield = (function () { - function yield() { + var = (function () { + function () { } - return yield; + return ; })(); + yield; + { } var declare = (function () { function declare() { } diff --git a/tests/baselines/reference/convertKeywordsYes.types b/tests/baselines/reference/convertKeywordsYes.types deleted file mode 100644 index af2e076618..0000000000 --- a/tests/baselines/reference/convertKeywordsYes.types +++ /dev/null @@ -1,879 +0,0 @@ -=== tests/cases/compiler/convertKeywordsYes.ts === -// reserved ES5 future in strict mode - -var constructor = 0; ->constructor : number - -var any = 0; ->any : number - -var boolean = 0; ->boolean : number - -var implements = 0; ->implements : number - -var interface = 0; ->interface : number - -var let = 0; ->let : number - -var module = 0; ->module : number - -var number = 0; ->number : number - -var package = 0; ->package : number - -var private = 0; ->private : number - -var protected = 0; ->protected : number - -var public = 0; ->public : number - -var set = 0; ->set : number - -var static = 0; ->static : number - -var string = 0; ->string : number - -var get = 0; ->get : number - -var yield = 0; ->yield : number - -var declare = 0; ->declare : number - -function bigGeneric< ->bigGeneric : (c: constructor, a: any, b2: boolean, i: implements, i2: interface, l: let, m: module, n: number, p: package, p2: private, p3: protected, p4: public, s: set, s2: static, s3: string, g: get, y: yield, d: declare) => void - - constructor, ->constructor : constructor - - implements , ->implements : implements - - interface , ->interface : interface - - let, ->let : let - - module , ->module : module - - package, ->package : package - - private , ->private : private - - protected, ->protected : protected - - public , ->public : public - - set , ->set : set - - static , ->static : static - - get , ->get : get - - yield, ->yield : yield - - declare ->declare : declare - - >(c: constructor, ->c : constructor ->constructor : constructor - - a: any, ->a : any - - b2: boolean, ->b2 : boolean - - i: implements , ->i : implements ->implements : implements - - i2: interface , ->i2 : interface ->interface : interface - - l: let, ->l : let ->let : let - - m: module , ->m : module ->module : module - - n: number, ->n : number - - p: package, ->p : package ->package : package - - p2: private , ->p2 : private ->private : private - - p3: protected, ->p3 : protected ->protected : protected - - p4: public , ->p4 : public ->public : public - - s: set , ->s : set ->set : set - - s2: static , ->s2 : static ->static : static - - s3: string, ->s3 : string - - g: get , ->g : get ->get : get - - y: yield, ->y : yield ->yield : yield - - d: declare ) { } ->d : declare ->declare : declare - -var bigObject = { ->bigObject : { constructor: number; any: number; boolean: number; implements: number; interface: number; let: number; module: number; number: number; package: number; private: number; protected: number; public: number; set: number; static: number; string: number; get: number; yield: number; break: number; case: number; catch: number; class: number; continue: number; const: number; debugger: number; declare: number; default: number; delete: number; do: number; else: number; enum: number; export: number; extends: number; false: number; finally: number; for: number; function: number; if: number; import: number; in: number; instanceof: number; new: number; null: number; return: number; super: number; switch: number; this: number; throw: number; true: number; try: number; typeof: number; var: number; void: number; while: number; with: number; } ->{ constructor: 0, any: 0, boolean: 0, implements: 0, interface: 0, let: 0, module: 0, number: 0, package: 0, private: 0, protected: 0, public: 0, set: 0, static: 0, string: 0, get: 0, yield: 0, break: 0, case: 0, catch: 0, class: 0, continue: 0, const: 0, debugger: 0, declare: 0, default: 0, delete: 0, do: 0, else: 0, enum: 0, export: 0, extends: 0, false: 0, finally: 0, for: 0, function: 0, if: 0, import: 0, in: 0, instanceof: 0, new: 0, null: 0, return: 0, super: 0, switch: 0, this: 0, throw: 0, true: 0, try: 0, typeof: 0, var: 0, void: 0, while: 0, with: 0,} : { constructor: number; any: number; boolean: number; implements: number; interface: number; let: number; module: number; number: number; package: number; private: number; protected: number; public: number; set: number; static: number; string: number; get: number; yield: number; break: number; case: number; catch: number; class: number; continue: number; const: number; debugger: number; declare: number; default: number; delete: number; do: number; else: number; enum: number; export: number; extends: number; false: number; finally: number; for: number; function: number; if: number; import: number; in: number; instanceof: number; new: number; null: number; return: number; super: number; switch: number; this: number; throw: number; true: number; try: number; typeof: number; var: number; void: number; while: number; with: number; } - - constructor: 0, ->constructor : number - - any: 0, ->any : number - - boolean: 0, ->boolean : number - - implements: 0, ->implements : number - - interface: 0, ->interface : number - - let: 0, ->let : number - - module: 0, ->module : number - - number: 0, ->number : number - - package: 0, ->package : number - - private: 0, ->private : number - - protected: 0, ->protected : number - - public: 0, ->public : number - - set: 0, ->set : number - - static: 0, ->static : number - - string: 0, ->string : number - - get: 0, ->get : number - - yield: 0, ->yield : number - - break: 0, ->break : number - - case: 0, ->case : number - - catch: 0, ->catch : number - - class: 0, ->class : number - - continue: 0, ->continue : number - - const: 0, ->const : number - - debugger: 0, ->debugger : number - - declare: 0, ->declare : number - - default: 0, ->default : number - - delete: 0, ->delete : number - - do: 0, ->do : number - - else: 0, ->else : number - - enum: 0, ->enum : number - - export: 0, ->export : number - - extends: 0, ->extends : number - - false: 0, ->false : number - - finally: 0, ->finally : number - - for: 0, ->for : number - - function: 0, ->function : number - - if: 0, ->if : number - - import: 0, ->import : number - - in: 0, ->in : number - - instanceof: 0, ->instanceof : number - - new: 0, ->new : number - - null: 0, ->null : number - - return: 0, ->return : number - - super: 0, ->super : number - - switch: 0, ->switch : number - - this: 0, ->this : number - - throw: 0, ->throw : number - - true: 0, ->true : number - - try: 0, ->try : number - - typeof: 0, ->typeof : number - - var: 0, ->var : number - - void: 0, ->void : number - - while: 0, ->while : number - - with: 0, ->with : number - -}; - -interface bigInterface { ->bigInterface : bigInterface - - constructor; ->constructor : any - - any; ->any : any - - boolean; ->boolean : any - - implements; ->implements : any - - interface; ->interface : any - - let; ->let : any - - module; ->module : any - - number; ->number : any - - package; ->package : any - - private; ->private : any - - protected; ->protected : any - - public; ->public : any - - set; ->set : any - - static; ->static : any - - string; ->string : any - - get; ->get : any - - yield; ->yield : any - - break; ->break : any - - case; ->case : any - - catch; ->catch : any - - class; ->class : any - - continue; ->continue : any - - const; ->const : any - - debugger; ->debugger : any - - declare; ->declare : any - - default; ->default : any - - delete; ->delete : any - - do; ->do : any - - else; ->else : any - - enum; ->enum : any - - export; ->export : any - - extends; ->extends : any - - false; ->false : any - - finally; ->finally : any - - for; ->for : any - - function; ->function : any - - if; ->if : any - - import; ->import : any - - in; ->in : any - - instanceof; ->instanceof : any - - new; ->new : any - - null; ->null : any - - return; ->return : any - - super; ->super : any - - switch; ->switch : any - - this; ->this : any - - throw; ->throw : any - - true; ->true : any - - try; ->try : any - - typeof; ->typeof : any - - var; ->var : any - - void; ->void : any - - while; ->while : any - - with; ->with : any -} - -class bigClass { ->bigClass : bigClass - - public "constructor" = 0; - public any = 0; ->any : number - - public boolean = 0; ->boolean : number - - public implements = 0; ->implements : number - - public interface = 0; ->interface : number - - public let = 0; ->let : number - - public module = 0; ->module : number - - public number = 0; ->number : number - - public package = 0; ->package : number - - public private = 0; ->private : number - - public protected = 0; ->protected : number - - public public = 0; ->public : number - - public set = 0; ->set : number - - public static = 0; ->static : number - - public string = 0; ->string : number - - public get = 0; ->get : number - - public yield = 0; ->yield : number - - public break = 0; ->break : number - - public case = 0; ->case : number - - public catch = 0; ->catch : number - - public class = 0; ->class : number - - public continue = 0; ->continue : number - - public const = 0; ->const : number - - public debugger = 0; ->debugger : number - - public declare = 0; ->declare : number - - public default = 0; ->default : number - - public delete = 0; ->delete : number - - public do = 0; ->do : number - - public else = 0; ->else : number - - public enum = 0; ->enum : number - - public export = 0; ->export : number - - public extends = 0; ->extends : number - - public false = 0; ->false : number - - public finally = 0; ->finally : number - - public for = 0; ->for : number - - public function = 0; ->function : number - - public if = 0; ->if : number - - public import = 0; ->import : number - - public in = 0; ->in : number - - public instanceof = 0; ->instanceof : number - - public new = 0; ->new : number - - public null = 0; ->null : number - - public return = 0; ->return : number - - public super = 0; ->super : number - - public switch = 0; ->switch : number - - public this = 0; ->this : number - - public throw = 0; ->throw : number - - public true = 0; ->true : number - - public try = 0; ->try : number - - public typeof = 0; ->typeof : number - - public var = 0; ->var : number - - public void = 0; ->void : number - - public while = 0; ->while : number - - public with = 0; ->with : number -} - -enum bigEnum { ->bigEnum : bigEnum - - constructor, ->constructor : bigEnum - - any, ->any : bigEnum - - boolean, ->boolean : bigEnum - - implements, ->implements : bigEnum - - interface, ->interface : bigEnum - - let, ->let : bigEnum - - module, ->module : bigEnum - - number, ->number : bigEnum - - package, ->package : bigEnum - - private, ->private : bigEnum - - protected, ->protected : bigEnum - - public, ->public : bigEnum - - set, ->set : bigEnum - - static, ->static : bigEnum - - string, ->string : bigEnum - - get, ->get : bigEnum - - yield, ->yield : bigEnum - - break, ->break : bigEnum - - case, ->case : bigEnum - - catch, ->catch : bigEnum - - class, ->class : bigEnum - - continue, ->continue : bigEnum - - const, ->const : bigEnum - - debugger, ->debugger : bigEnum - - declare, ->declare : bigEnum - - default, ->default : bigEnum - - delete, ->delete : bigEnum - - do, ->do : bigEnum - - else, ->else : bigEnum - - enum, ->enum : bigEnum - - export, ->export : bigEnum - - extends, ->extends : bigEnum - - false, ->false : bigEnum - - finally, ->finally : bigEnum - - for, ->for : bigEnum - - function, ->function : bigEnum - - if, ->if : bigEnum - - import, ->import : bigEnum - - in, ->in : bigEnum - - instanceof, ->instanceof : bigEnum - - new, ->new : bigEnum - - null, ->null : bigEnum - - return, ->return : bigEnum - - super, ->super : bigEnum - - switch, ->switch : bigEnum - - this, ->this : bigEnum - - throw, ->throw : bigEnum - - true, ->true : bigEnum - - try, ->try : bigEnum - - typeof, ->typeof : bigEnum - - var, ->var : bigEnum - - void, ->void : bigEnum - - while, ->while : bigEnum - - with, ->with : bigEnum -} - -module bigModule { ->bigModule : typeof bigModule - - class constructor { } ->constructor : constructor - - class implements { } ->implements : implements - - class interface { } ->interface : interface - - class let { } ->let : let - - class module { } ->module : module - - class package { } ->package : package - - class private { } ->private : private - - class protected { } ->protected : protected - - class public { } ->public : public - - class set { } ->set : set - - class static { } ->static : static - - class get { } ->get : get - - class yield { } ->yield : yield - - class declare { } ->declare : declare -} diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt b/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt index b75b7e0d8b..1a1e650335 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt +++ b/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt @@ -1,35 +1,11 @@ tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS2304: Cannot find name 'public'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,16): error TS1146: Declaration expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,17): error TS2304: Cannot find name 'get'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS2304: Cannot find name 'accessor'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,32): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(5,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (9 errors) ==== +==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (1 errors) ==== declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; class C { public @dec get accessor() { return 1; } ~~~~~~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'public'. - ~ -!!! error TS1005: ';' expected. - -!!! error TS1146: Declaration expected. - ~~~ -!!! error TS2304: Cannot find name 'get'. - ~~~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~~~ -!!! error TS2304: Cannot find name 'accessor'. - ~ -!!! error TS1005: ';' expected. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.js b/tests/baselines/reference/decoratorOnClassAccessor3.js index f48a755953..a2a2221a11 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.js +++ b/tests/baselines/reference/decoratorOnClassAccessor3.js @@ -6,14 +6,27 @@ class C { } //// [decoratorOnClassAccessor3.js] +var __decorate = this.__decorate || function (decorators, target, key, value) { + var kind = typeof (arguments.length == 2 ? value = target : value); + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + switch (kind) { + case "function": value = decorator(value) || value; break; + case "number": decorator(target, key, value); break; + case "undefined": decorator(target, key); break; + case "object": value = decorator(target, key, value) || value; break; + } + } + return value; +}; var C = (function () { function C() { } + Object.defineProperty(C.prototype, "accessor", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); -public; -get; -accessor(); -{ - return 1; -} diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt b/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt index ec22ae0b3e..f43827c0e4 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt +++ b/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt @@ -1,44 +1,11 @@ tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS2304: Cannot find name 'public'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,16): error TS1146: Declaration expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,17): error TS2304: Cannot find name 'set'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS2304: Cannot find name 'accessor'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,30): error TS2304: Cannot find name 'value'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,35): error TS1005: ',' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,37): error TS2304: Cannot find name 'number'. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,45): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(5,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (12 errors) ==== +==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (1 errors) ==== declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; class C { public @dec set accessor(value: number) { } ~~~~~~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'public'. - ~ -!!! error TS1005: ';' expected. - -!!! error TS1146: Declaration expected. - ~~~ -!!! error TS2304: Cannot find name 'set'. - ~~~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~~~ -!!! error TS2304: Cannot find name 'accessor'. - ~~~~~ -!!! error TS2304: Cannot find name 'value'. - ~ -!!! error TS1005: ',' expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'number'. - ~ -!!! error TS1005: ';' expected. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.js b/tests/baselines/reference/decoratorOnClassAccessor6.js index 771d937634..ce9776bfc6 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.js +++ b/tests/baselines/reference/decoratorOnClassAccessor6.js @@ -6,12 +6,27 @@ class C { } //// [decoratorOnClassAccessor6.js] +var __decorate = this.__decorate || function (decorators, target, key, value) { + var kind = typeof (arguments.length == 2 ? value = target : value); + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + switch (kind) { + case "function": value = decorator(value) || value; break; + case "number": decorator(target, key, value); break; + case "undefined": decorator(target, key); break; + case "object": value = decorator(target, key, value) || value; break; + } + } + return value; +}; var C = (function () { function C() { } + Object.defineProperty(C.prototype, "accessor", { + set: function (value) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); -public; -set; -accessor(value, number); -{ } diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.errors.txt b/tests/baselines/reference/decoratorOnClassConstructorParameter4.errors.txt index 5969cfca06..61ff143366 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.errors.txt +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.errors.txt @@ -1,11 +1,14 @@ +tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts(4,17): error TS1003: Identifier expected. tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts(4,24): error TS1005: ',' expected. -==== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts (1 errors) ==== +==== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts (2 errors) ==== declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void; class C { constructor(public @dec p: number) {} + ~~~~~~ +!!! error TS1003: Identifier expected. ~ !!! error TS1005: ',' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js index 07dc7cae07..3ab9829e72 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js @@ -20,7 +20,7 @@ var __decorate = this.__decorate || function (decorators, target, key, value) { return value; }; var C = (function () { - function C(public, p) { + function C(, p) { } __decorate([dec], C, void 0, 1); return C; diff --git a/tests/baselines/reference/decoratorOnClassMethod3.errors.txt b/tests/baselines/reference/decoratorOnClassMethod3.errors.txt index b2173dedf9..2775ab9f14 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethod3.errors.txt @@ -1,29 +1,11 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS2304: Cannot find name 'public'. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,16): error TS1146: Declaration expected. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,17): error TS2304: Cannot find name 'method'. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,26): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(5,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (7 errors) ==== +==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (1 errors) ==== declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; class C { public @dec method() {} ~~~~~~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'public'. - ~ -!!! error TS1005: ';' expected. - -!!! error TS1146: Declaration expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'method'. - ~ -!!! error TS1005: ';' expected. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassMethod3.js b/tests/baselines/reference/decoratorOnClassMethod3.js index 3ac97697e8..7e13f91d86 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.js +++ b/tests/baselines/reference/decoratorOnClassMethod3.js @@ -6,11 +6,23 @@ class C { } //// [decoratorOnClassMethod3.js] +var __decorate = this.__decorate || function (decorators, target, key, value) { + var kind = typeof (arguments.length == 2 ? value = target : value); + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + switch (kind) { + case "function": value = decorator(value) || value; break; + case "number": decorator(target, key, value); break; + case "undefined": decorator(target, key); break; + case "object": value = decorator(target, key, value) || value; break; + } + } + return value; +}; var C = (function () { function C() { } + C.prototype.method = function () { }; + Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); -public; -method(); -{ } diff --git a/tests/baselines/reference/decoratorOnClassProperty3.errors.txt b/tests/baselines/reference/decoratorOnClassProperty3.errors.txt index 29438bd67a..a6321c5542 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.errors.txt +++ b/tests/baselines/reference/decoratorOnClassProperty3.errors.txt @@ -1,26 +1,11 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS2304: Cannot find name 'public'. -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1005: ';' expected. -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,16): error TS1146: Declaration expected. -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,17): error TS2304: Cannot find name 'prop'. -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(5,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (6 errors) ==== +==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (1 errors) ==== declare function dec(target: any, propertyKey: string): void; class C { public @dec prop; ~~~~~~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~~~~~ -!!! error TS2304: Cannot find name 'public'. - ~ -!!! error TS1005: ';' expected. - -!!! error TS1146: Declaration expected. - ~~~~ -!!! error TS2304: Cannot find name 'prop'. - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassProperty3.js b/tests/baselines/reference/decoratorOnClassProperty3.js index 6c9945677c..f8a2cce27d 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.js +++ b/tests/baselines/reference/decoratorOnClassProperty3.js @@ -6,10 +6,22 @@ class C { } //// [decoratorOnClassProperty3.js] +var __decorate = this.__decorate || function (decorators, target, key, value) { + var kind = typeof (arguments.length == 2 ? value = target : value); + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + switch (kind) { + case "function": value = decorator(value) || value; break; + case "number": decorator(target, key, value); break; + case "undefined": decorator(target, key); break; + case "object": value = decorator(target, key, value) || value; break; + } + } + return value; +}; var C = (function () { function C() { } + __decorate([dec], C.prototype, "prop"); return C; })(); -public; -prop; diff --git a/tests/baselines/reference/parser509668.errors.txt b/tests/baselines/reference/parser509668.errors.txt index 5ea380592e..588bda6d91 100644 --- a/tests/baselines/reference/parser509668.errors.txt +++ b/tests/baselines/reference/parser509668.errors.txt @@ -1,10 +1,13 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,16): error TS1003: Identifier expected. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,23): error TS1005: ',' expected. -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts (2 errors) ==== class Foo3 { // Doesn't work, but should constructor (public ...args: string[]) { } + ~~~~~~ +!!! error TS1003: Identifier expected. ~~~ !!! error TS1005: ',' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/parser509668.js b/tests/baselines/reference/parser509668.js index 63c5d8a1a9..a64c9c7b5b 100644 --- a/tests/baselines/reference/parser509668.js +++ b/tests/baselines/reference/parser509668.js @@ -7,7 +7,7 @@ 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]; diff --git a/tests/baselines/reference/parser553699.errors.txt b/tests/baselines/reference/parser553699.errors.txt index 5a0b9e2fba..84bc6e6070 100644 --- a/tests/baselines/reference/parser553699.errors.txt +++ b/tests/baselines/reference/parser553699.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS2304: Cannot find name 'public'. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS1110: Type expected. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21) constructor() { } public banana (x: public) { } ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS1110: Type expected. } class Bar { diff --git a/tests/baselines/reference/parser553699.js b/tests/baselines/reference/parser553699.js index 8570780e74..c4cc51bf5a 100644 --- a/tests/baselines/reference/parser553699.js +++ b/tests/baselines/reference/parser553699.js @@ -12,7 +12,7 @@ class Bar { var Foo = (function () { function Foo() { } - Foo.prototype.banana = function (x) { }; + Foo.prototype.banana = function (x, ) { }; return Foo; })(); var Bar = (function () { diff --git a/tests/baselines/reference/parser642331.errors.txt b/tests/baselines/reference/parser642331.errors.txt new file mode 100644 index 0000000000..fad38e6651 --- /dev/null +++ b/tests/baselines/reference/parser642331.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts(2,18): error TS1003: Identifier expected. + + +==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts (1 errors) ==== + class test { + constructor (static) { } + ~~~~~~ +!!! error TS1003: Identifier expected. + } + \ No newline at end of file diff --git a/tests/baselines/reference/parser642331.js b/tests/baselines/reference/parser642331.js index 056ea7dd38..3d88c096af 100644 --- a/tests/baselines/reference/parser642331.js +++ b/tests/baselines/reference/parser642331.js @@ -6,7 +6,7 @@ class test { //// [parser642331.js] var test = (function () { - function test(static) { + function test() { } return test; })(); diff --git a/tests/baselines/reference/parser642331.types b/tests/baselines/reference/parser642331.types deleted file mode 100644 index 19cd40b76b..0000000000 --- a/tests/baselines/reference/parser642331.types +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts === -class test { ->test : test - - constructor (static) { } ->static : any -} - diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index bf5432062b..9b09e6d3b9 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -115,6 +115,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(504,58): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(506,22): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(507,58): error TS2304: Cannot find name 'TokenID'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(518,32): error TS2304: Cannot find name 'NodeType'. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(520,29): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(525,27): error TS2304: Cannot find name 'Signature'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(527,36): error TS2304: Cannot find name 'TypeFlow'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(528,34): error TS2304: Cannot find name 'NodeType'. @@ -246,6 +247,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(963,27): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(969,31): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(977,32): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(981,27): error TS2304: Cannot find name 'Type'. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(985,29): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,44): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,67): error TS2304: Cannot find name 'FncFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1005,57): error TS2304: Cannot find name 'FncFlags'. @@ -515,7 +517,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,30): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error TS2304: Cannot find name 'TokenID'. -==== tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts (515 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts (517 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -1270,6 +1272,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error !!! error TS2304: Cannot find name 'NodeType'. public target: AST, public arguments: ASTList) { + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. super(nodeType); this.minChar = this.target.minChar; } @@ -1997,6 +2001,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error constructor (public name: Identifier, public bod: ASTList, public isConstructor: boolean, public arguments: ASTList, public vars: ASTList, public scopes: ASTList, public statics: ASTList, + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. nodeType: number) { super(nodeType); diff --git a/tests/baselines/reference/superCallsInConstructor.errors.txt b/tests/baselines/reference/superCallsInConstructor.errors.txt index 0e7b1577bc..eee7c06b67 100644 --- a/tests/baselines/reference/superCallsInConstructor.errors.txt +++ b/tests/baselines/reference/superCallsInConstructor.errors.txt @@ -1,7 +1,8 @@ +tests/cases/compiler/superCallsInConstructor.ts(12,9): error TS1101: 'with' statements are not allowed in strict mode. tests/cases/compiler/superCallsInConstructor.ts(12,14): error TS2410: All symbols within a 'with' block will be resolved to 'any'. -==== tests/cases/compiler/superCallsInConstructor.ts (1 errors) ==== +==== tests/cases/compiler/superCallsInConstructor.ts (2 errors) ==== class C { foo() {} bar() {} @@ -14,6 +15,8 @@ tests/cases/compiler/superCallsInConstructor.ts(12,14): error TS2410: All symbol class Derived extends Base { constructor() { with(new C()) { + ~~~~ +!!! error TS1101: 'with' statements are not allowed in strict mode. ~~~~~~~ !!! error TS2410: All symbols within a 'with' block will be resolved to 'any'. foo(); diff --git a/tests/baselines/reference/varArgConstructorMemberParameter.errors.txt b/tests/baselines/reference/varArgConstructorMemberParameter.errors.txt index e3257b870d..19bd0396be 100644 --- a/tests/baselines/reference/varArgConstructorMemberParameter.errors.txt +++ b/tests/baselines/reference/varArgConstructorMemberParameter.errors.txt @@ -1,7 +1,8 @@ +tests/cases/compiler/varArgConstructorMemberParameter.ts(10,18): error TS1003: Identifier expected. tests/cases/compiler/varArgConstructorMemberParameter.ts(10,25): error TS1005: ',' expected. -==== tests/cases/compiler/varArgConstructorMemberParameter.ts (1 errors) ==== +==== tests/cases/compiler/varArgConstructorMemberParameter.ts (2 errors) ==== class Foo1 { constructor (...args: string[]) { } } @@ -12,6 +13,8 @@ tests/cases/compiler/varArgConstructorMemberParameter.ts(10,25): error TS1005: ' class Foo3 { constructor (public ...args: string[]) { } + ~~~~~~ +!!! error TS1003: Identifier expected. ~~~ !!! error TS1005: ',' expected. } diff --git a/tests/baselines/reference/varArgConstructorMemberParameter.js b/tests/baselines/reference/varArgConstructorMemberParameter.js index 7f1ef8d5b3..100a4b0789 100644 --- a/tests/baselines/reference/varArgConstructorMemberParameter.js +++ b/tests/baselines/reference/varArgConstructorMemberParameter.js @@ -29,7 +29,7 @@ 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]; diff --git a/tests/cases/fourslash/getOccurrencesDeclare1.ts b/tests/cases/fourslash/getOccurrencesDeclare1.ts index 1cdad07eb7..4207a92b5a 100644 --- a/tests/cases/fourslash/getOccurrencesDeclare1.ts +++ b/tests/cases/fourslash/getOccurrencesDeclare1.ts @@ -44,7 +44,6 @@ //// protected prot1; //// //// protected constructor(public public, protected protected, private private) { -//// public = private = protected; //// } //// } //// } diff --git a/tests/cases/fourslash/getOccurrencesDeclare3.ts b/tests/cases/fourslash/getOccurrencesDeclare3.ts index 048dd8efea..2dee0af4b1 100644 --- a/tests/cases/fourslash/getOccurrencesDeclare3.ts +++ b/tests/cases/fourslash/getOccurrencesDeclare3.ts @@ -48,7 +48,6 @@ //// protected prot1; //// //// protected constructor(public public, protected protected, private private) { -//// public = private = protected; //// } //// } //// } diff --git a/tests/cases/fourslash/getOccurrencesExport1.ts b/tests/cases/fourslash/getOccurrencesExport1.ts index c47c39cf54..bc82e8a1be 100644 --- a/tests/cases/fourslash/getOccurrencesExport1.ts +++ b/tests/cases/fourslash/getOccurrencesExport1.ts @@ -44,7 +44,6 @@ //// protected prot1; //// //// protected constructor(public public, protected protected, private private) { -//// public = private = protected; //// } //// } //// } diff --git a/tests/cases/fourslash/getOccurrencesExport3.ts b/tests/cases/fourslash/getOccurrencesExport3.ts index 009b891992..215cbf8f48 100644 --- a/tests/cases/fourslash/getOccurrencesExport3.ts +++ b/tests/cases/fourslash/getOccurrencesExport3.ts @@ -48,7 +48,6 @@ //// protected prot1; //// //// protected constructor(public public, protected protected, private private) { -//// public = private = protected; //// } //// } //// } From aef37f1e41f5fdcfdf78f35f726296a4685ac6d6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 2 Apr 2015 17:42:24 -0700 Subject: [PATCH 3/5] Address code review: have more explicit error --- src/compiler/checker.ts | 10 +- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + ...lisionArgumentsClassConstructor.errors.txt | 92 +++++++++---------- .../collisionArgumentsClassMethod.errors.txt | 84 ++++++++--------- ...ationInStrictModeByDefaultInES6.errors.txt | 8 +- .../reference/parserRealSource11.errors.txt | 8 +- 7 files changed, 110 insertions(+), 97 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3ce7fe5e1c..ed32686e79 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12441,7 +12441,15 @@ module ts { let identifier = name; if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) { let nameText = declarationNameToString(identifier); - return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText); + + // We are checking if this parameter's name is of method or constructor so that we can give more explicit errors because + // invalid usage error particularly of "arguments" is very common mistake + if (contextNode && (contextNode.parent.kind === SyntaxKind.MethodDeclaration || contextNode.parent.kind === SyntaxKind.Constructor)) { + return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_because_class_definition_is_considered_a_strict_mode_code, nameText); + } + else { + return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText); + } } } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 3e9017786e..c24b3fe174 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -167,6 +167,7 @@ module ts { Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, + Invalid_use_of_0_because_class_definition_is_considered_a_strict_mode_code: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' because class definition is considered a strict mode code " }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f6edb3150b..0c7708ad2f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -659,6 +659,10 @@ "category": "Error", "code": 1209 }, + "Invalid use of '{0}' because class definition is considered a strict mode code ": { + "category": "Error", + "code": 1210 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 diff --git a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt index 7e145688ba..391e4ad24d 100644 --- a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt @@ -1,41 +1,41 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,28): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. tests/cases/compiler/collisionArgumentsClassConstructor.ts(9,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(13,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(13,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(14,13): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(20,13): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(25,13): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,24): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,24): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(31,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(35,24): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(35,24): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(36,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(41,31): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(44,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(47,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(51,31): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(52,31): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(41,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(44,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(47,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(51,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(52,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,28): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,28): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(54,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(59,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(60,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(59,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(60,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. tests/cases/compiler/collisionArgumentsClassConstructor.ts(62,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(67,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(68,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(69,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(67,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(68,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(69,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassConstructor.ts(70,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(75,31): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(76,31): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(79,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(80,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(84,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(75,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(76,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(79,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(80,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(84,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code ==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (38 errors) ==== @@ -45,7 +45,7 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments: any[]; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -54,7 +54,7 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: class c12 { constructor(arguments: number, ...rest) { // error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code ~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error @@ -65,7 +65,7 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: class c1NoError { constructor(arguments: number) { // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments = 10; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -92,7 +92,7 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments = 10; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -101,7 +101,7 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: class c3NoError { constructor(public arguments: number) { // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments = 10; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -111,31 +111,31 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: declare class c4 { constructor(i: number, ...arguments); // No error - no code gen ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } declare class c42 { constructor(arguments: number, ...rest); // No error - no code gen ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } declare class c4NoError { constructor(arguments: number); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } class c5 { constructor(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(i: any, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments: any[]; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -145,13 +145,13 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: class c52 { constructor(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(arguments: any, ...rest) { // error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code ~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error @@ -163,13 +163,13 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: class c5NoError { constructor(arguments: number); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(arguments: string); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(arguments: any) { // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments: any; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -179,25 +179,25 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1100: declare class c6 { constructor(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } declare class c62 { constructor(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } declare class c6NoError { constructor(arguments: number); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code constructor(arguments: string); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } \ No newline at end of file diff --git a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt index 34b92990c7..67ec130936 100644 --- a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt @@ -1,34 +1,34 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(2,27): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassMethod.ts(2,30): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(2,30): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. tests/cases/compiler/collisionArgumentsClassMethod.ts(6,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(8,23): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(8,23): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(9,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(11,29): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(12,29): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(11,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(12,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(13,23): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassMethod.ts(13,26): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(13,26): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(14,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(16,16): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(17,16): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(16,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(17,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. tests/cases/compiler/collisionArgumentsClassMethod.ts(19,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(21,22): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(22,22): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(23,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(21,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(22,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(23,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(24,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(29,30): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(30,17): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(31,23): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(33,29): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(34,29): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(35,16): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(36,16): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(37,22): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(38,22): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(29,30): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(30,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(31,23): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(33,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(34,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(35,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(36,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(37,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(38,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/compiler/collisionArgumentsClassMethod.ts(43,13): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Invalid use of 'arguments' in strict mode. @@ -39,14 +39,14 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Inva ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments: any[]; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. } public foo1(arguments: number, ...rest) { //arguments is error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code ~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error @@ -55,35 +55,35 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Inva } public fooNoError(arguments: number) { // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments = 10; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. } public f4(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4(i: any, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments: any[]; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. } public f41(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f41(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f41(arguments: any, ...rest) { // error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code ~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error @@ -92,13 +92,13 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Inva } public f4NoError(arguments: number); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4NoError(arguments: string); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4NoError(arguments: any) { // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code var arguments: any; // no error ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. @@ -108,32 +108,32 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Inva declare class c2 { public foo(i: number, ...arguments); // No error - no code gen ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public foo1(arguments: number, ...rest); // No error - no code gen ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public fooNoError(arguments: number); // No error - no code gen ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f41(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f41(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4NoError(arguments: number); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code public f4NoError(arguments: string); // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code } class c3 { diff --git a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt index d109b04808..024716f91f 100644 --- a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt +++ b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1100: Invalid use of 'eval' in strict mode. +tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1210: Invalid use of 'eval' because class definition is considered a strict mode code tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS2322: Type 'string' is not assignable to type 'IArguments'. Property 'callee' is missing in type 'String'. @@ -11,10 +11,10 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeBy public implements() { } public foo(arguments: any) { } ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code private bar(eval:any) { ~~~~ -!!! error TS1100: Invalid use of 'eval' in strict mode. +!!! error TS1210: Invalid use of 'eval' because class definition is considered a strict mode code arguments = "hello"; ~~~~~~~~~ !!! error TS1100: Invalid use of 'arguments' in strict mode. diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index 9b09e6d3b9..1ed2ee9393 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -115,7 +115,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(504,58): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(506,22): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(507,58): error TS2304: Cannot find name 'TokenID'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(518,32): error TS2304: Cannot find name 'NodeType'. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(520,29): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(520,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(525,27): error TS2304: Cannot find name 'Signature'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(527,36): error TS2304: Cannot find name 'TypeFlow'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(528,34): error TS2304: Cannot find name 'NodeType'. @@ -247,7 +247,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(963,27): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(969,31): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(977,32): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(981,27): error TS2304: Cannot find name 'Type'. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(985,29): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(985,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,44): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,67): error TS2304: Cannot find name 'FncFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1005,57): error TS2304: Cannot find name 'FncFlags'. @@ -1273,7 +1273,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error public target: AST, public arguments: ASTList) { ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code super(nodeType); this.minChar = this.target.minChar; } @@ -2002,7 +2002,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error constructor (public name: Identifier, public bod: ASTList, public isConstructor: boolean, public arguments: ASTList, public vars: ASTList, public scopes: ASTList, public statics: ASTList, ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code nodeType: number) { super(nodeType); From 4824e966b28a23d037a8e30b3759ff8e0407d75c Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 3 Apr 2015 17:35:42 -0700 Subject: [PATCH 4/5] Update baseline --- .../reference/convertKeywordsYes.errors.txt | 64 +++++-------------- .../baselines/reference/convertKeywordsYes.js | 54 ++++++++-------- 2 files changed, 44 insertions(+), 74 deletions(-) diff --git a/tests/baselines/reference/convertKeywordsYes.errors.txt b/tests/baselines/reference/convertKeywordsYes.errors.txt index 1a54e3615b..932fda09be 100644 --- a/tests/baselines/reference/convertKeywordsYes.errors.txt +++ b/tests/baselines/reference/convertKeywordsYes.errors.txt @@ -1,31 +1,21 @@ -tests/cases/compiler/convertKeywordsYes.ts(292,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1003: Identifier expected. -tests/cases/compiler/convertKeywordsYes.ts(293,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(293,21): error TS1005: ';' expected. -tests/cases/compiler/convertKeywordsYes.ts(294,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1003: Identifier expected. -tests/cases/compiler/convertKeywordsYes.ts(296,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1005: '{' expected. +tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(296,19): error TS1005: ';' expected. -tests/cases/compiler/convertKeywordsYes.ts(297,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(297,19): error TS1005: ';' expected. -tests/cases/compiler/convertKeywordsYes.ts(298,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(298,21): error TS1005: ';' expected. -tests/cases/compiler/convertKeywordsYes.ts(299,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(299,18): error TS1005: ';' expected. -tests/cases/compiler/convertKeywordsYes.ts(301,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(301,18): error TS1005: ';' expected. -tests/cases/compiler/convertKeywordsYes.ts(303,10): error TS2300: Duplicate identifier '(Missing)'. -tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1003: Identifier expected. +tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1005: '{' expected. tests/cases/compiler/convertKeywordsYes.ts(303,17): error TS1005: ';' expected. -==== tests/cases/compiler/convertKeywordsYes.ts (25 errors) ==== +==== tests/cases/compiler/convertKeywordsYes.ts (15 errors) ==== // reserved ES5 future in strict mode var constructor = 0; @@ -318,65 +308,45 @@ tests/cases/compiler/convertKeywordsYes.ts(303,17): error TS1005: ';' expected. module bigModule { class constructor { } class implements { } - -!!! error TS2300: Duplicate identifier '(Missing)'. - ~~~~~~~~~~ -!!! error TS1003: Identifier expected. class interface { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class let { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. class module { } class package { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class private { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class protected { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class public { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class set { } class static { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class get { } class yield { } - -!!! error TS2300: Duplicate identifier '(Missing)'. ~~~~~ -!!! error TS1003: Identifier expected. +!!! error TS1005: '{' expected. ~ !!! error TS1005: ';' expected. class declare { } diff --git a/tests/baselines/reference/convertKeywordsYes.js b/tests/baselines/reference/convertKeywordsYes.js index 174ff31fc1..2b17e744b6 100644 --- a/tests/baselines/reference/convertKeywordsYes.js +++ b/tests/baselines/reference/convertKeywordsYes.js @@ -505,22 +505,22 @@ var bigModule; } return constructor; })(); - var = (function () { - function () { + var default_1 = (function () { + function default_1() { } - return ; + return default_1; })(); - var = (function () { - function () { + var default_2 = (function () { + function default_2() { } - return ; + return default_2; })(); interface; { } - var = (function () { - function () { + var default_3 = (function () { + function default_3() { } - return ; + return default_3; })(); var _a = void 0; var module = (function () { @@ -528,31 +528,31 @@ var bigModule; } return module; })(); - var = (function () { - function () { + var default_4 = (function () { + function default_4() { } - return ; + return default_4; })(); package; { } - var = (function () { - function () { + var default_5 = (function () { + function default_5() { } - return ; + return default_5; })(); private; { } - var = (function () { - function () { + var default_6 = (function () { + function default_6() { } - return ; + return default_6; })(); protected; { } - var = (function () { - function () { + var default_7 = (function () { + function default_7() { } - return ; + return default_7; })(); public; { } @@ -561,10 +561,10 @@ var bigModule; } return set; })(); - var = (function () { - function () { + var default_8 = (function () { + function default_8() { } - return ; + return default_8; })(); static; { } @@ -573,10 +573,10 @@ var bigModule; } return get; })(); - var = (function () { - function () { + var default_9 = (function () { + function default_9() { } - return ; + return default_9; })(); yield; { } From 09d037fb6fd5de58ea91f7bc7ccb79d72d057e01 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 3 Apr 2015 17:59:40 -0700 Subject: [PATCH 5/5] Address code review --- src/compiler/checker.ts | 9 +- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- ...lisionArgumentsClassConstructor.errors.txt | 132 +++++++++--------- .../collisionArgumentsClassMethod.errors.txt | 116 +++++++-------- ...ationInStrictModeByDefaultInES6.errors.txt | 12 +- .../reference/parserRealSource11.errors.txt | 8 +- 7 files changed, 141 insertions(+), 140 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b4b3f956fc..58e3a71a68 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12446,10 +12446,11 @@ module ts { if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) { let nameText = declarationNameToString(identifier); - // We are checking if this parameter's name is of method or constructor so that we can give more explicit errors because - // invalid usage error particularly of "arguments" is very common mistake - if (contextNode && (contextNode.parent.kind === SyntaxKind.MethodDeclaration || contextNode.parent.kind === SyntaxKind.Constructor)) { - return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_because_class_definition_is_considered_a_strict_mode_code, nameText); + // We are checking if this name is inside class declaration or class expression (which are under class definitions inside ES6 spec.) + // if so, we would like to give more explicit invalid usage error. + // This will be particularly helpful in the case of "arguments" as such case is very common mistake. + if (getAncestor(name, SyntaxKind.ClassDeclaration) || getAncestor(name, SyntaxKind.ClassExpression)) { + return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode, nameText); } else { return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c01834293a..b4380f4d2d 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -167,7 +167,7 @@ module ts { Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, - Invalid_use_of_0_because_class_definition_is_considered_a_strict_mode_code: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' because class definition is considered a strict mode code " }, + Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fdf469bb0a..fe349b7834 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -659,7 +659,7 @@ "category": "Error", "code": 1209 }, - "Invalid use of '{0}' because class definition is considered a strict mode code ": { + "Invalid use of '{0}'. Class definitions are automatically in strict mode.": { "category": "Error", "code": 1210 }, diff --git a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt index 391e4ad24d..03bf4f9e38 100644 --- a/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassConstructor.errors.txt @@ -1,41 +1,41 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,28): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(4,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(9,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(13,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(14,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(20,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(25,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(9,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(13,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(14,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(20,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(25,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,24): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(31,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(35,24): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(36,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(41,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(44,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(47,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(51,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(52,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,24): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(31,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(35,24): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(36,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(41,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(44,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(47,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(51,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(52,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,28): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(54,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(59,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(60,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,28): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(54,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(59,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(60,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(62,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(67,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(68,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(69,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(70,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassConstructor.ts(75,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(76,31): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(79,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(80,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(84,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassConstructor.ts(62,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(67,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(68,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(69,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(70,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(75,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(76,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(79,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(80,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(84,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (38 errors) ==== @@ -45,30 +45,30 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments: any[]; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } class c12 { constructor(arguments: number, ...rest) { // error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } class c1NoError { constructor(arguments: number) { // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } @@ -76,14 +76,14 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: constructor(...restParameters) { var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } class c2NoError { constructor() { var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } @@ -92,112 +92,112 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } class c3NoError { constructor(public arguments: number) { // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } declare class c4 { constructor(i: number, ...arguments); // No error - no code gen ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } declare class c42 { constructor(arguments: number, ...rest); // No error - no code gen ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } declare class c4NoError { constructor(arguments: number); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } class c5 { constructor(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(i: any, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments: any[]; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } class c52 { constructor(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(arguments: any, ...rest) { // error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } class c5NoError { constructor(arguments: number); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(arguments: string); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(arguments: any) { // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments: any; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } declare class c6 { constructor(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } declare class c62 { constructor(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } declare class c6NoError { constructor(arguments: number); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. constructor(arguments: string); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } \ No newline at end of file diff --git a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt index 67ec130936..ea699414f1 100644 --- a/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt +++ b/tests/baselines/reference/collisionArgumentsClassMethod.errors.txt @@ -1,36 +1,36 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(2,27): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassMethod.ts(2,30): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(2,30): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(3,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassMethod.ts(6,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(8,23): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(9,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(11,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(12,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(6,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(8,23): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(9,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(11,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(12,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(13,23): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassMethod.ts(13,26): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(14,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(16,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(17,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/compiler/collisionArgumentsClassMethod.ts(13,26): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(14,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(16,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(17,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -tests/cases/compiler/collisionArgumentsClassMethod.ts(19,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(21,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(22,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(23,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(24,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(29,30): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(30,17): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(31,23): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(33,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(34,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(35,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(36,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(37,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(38,22): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/compiler/collisionArgumentsClassMethod.ts(43,13): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(19,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(21,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(22,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(23,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(24,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(29,30): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(30,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(31,23): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(33,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(34,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(35,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(36,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(37,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(38,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(43,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ==== tests/cases/compiler/collisionArgumentsClassMethod.ts (33 errors) ==== @@ -39,112 +39,112 @@ tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1100: Inva ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments: any[]; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } public foo1(arguments: number, ...rest) { //arguments is error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } public fooNoError(arguments: number) { // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } public f4(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4(i: any, ...arguments) { // error ~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments: any[]; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } public f41(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f41(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f41(arguments: any, ...rest) { // error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~~~~~~ !!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. var arguments: any; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } public f4NoError(arguments: number); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4NoError(arguments: string); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4NoError(arguments: any) { // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. var arguments: any; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } declare class c2 { public foo(i: number, ...arguments); // No error - no code gen ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public foo1(arguments: number, ...rest); // No error - no code gen ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public fooNoError(arguments: number); // No error - no code gen ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4(i: number, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4(i: string, ...arguments); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f41(arguments: number, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f41(arguments: string, ...rest); // no codegen no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4NoError(arguments: number); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. public f4NoError(arguments: string); // no error ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } class c3 { public foo(...restParameters) { var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } public fooNoError() { var arguments = 10; // no error ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. } } \ No newline at end of file diff --git a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt index 024716f91f..e1b0bb3452 100644 --- a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt +++ b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code -tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1210: Invalid use of 'eval' because class definition is considered a strict mode code -tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. +tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. +tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS2322: Type 'string' is not assignable to type 'IArguments'. Property 'callee' is missing in type 'String'. @@ -11,13 +11,13 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeBy public implements() { } public foo(arguments: any) { } ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. private bar(eval:any) { ~~~~ -!!! error TS1210: Invalid use of 'eval' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. arguments = "hello"; ~~~~~~~~~ -!!! error TS1100: Invalid use of 'arguments' in strict mode. +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'IArguments'. !!! error TS2322: Property 'callee' is missing in type 'String'. diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index 1ed2ee9393..718bda19a6 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -115,7 +115,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(504,58): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(506,22): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(507,58): error TS2304: Cannot find name 'TokenID'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(518,32): error TS2304: Cannot find name 'NodeType'. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(520,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(520,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(525,27): error TS2304: Cannot find name 'Signature'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(527,36): error TS2304: Cannot find name 'TypeFlow'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(528,34): error TS2304: Cannot find name 'NodeType'. @@ -247,7 +247,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(963,27): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(969,31): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(977,32): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(981,27): error TS2304: Cannot find name 'Type'. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(985,29): error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(985,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,44): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,67): error TS2304: Cannot find name 'FncFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1005,57): error TS2304: Cannot find name 'FncFlags'. @@ -1273,7 +1273,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error public target: AST, public arguments: ASTList) { ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. super(nodeType); this.minChar = this.target.minChar; } @@ -2002,7 +2002,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error constructor (public name: Identifier, public bod: ASTList, public isConstructor: boolean, public arguments: ASTList, public vars: ASTList, public scopes: ASTList, public statics: ASTList, ~~~~~~~~~ -!!! error TS1210: Invalid use of 'arguments' because class definition is considered a strict mode code +!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. nodeType: number) { super(nodeType);