From 92b367741b0085b4abb5f6eddc10dd3708a80ce4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 13 Aug 2014 11:13:24 -0700 Subject: [PATCH] Adding error message for empty tuple types. --- src/compiler/diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 10 +++++++--- src/compiler/parser.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index cc789bcca11..0f13f5e6838 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -106,6 +106,7 @@ module ts { An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." }, Duplicate_identifier_0: { code: 2000, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 2018, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 2019, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d60fd2e5c4f..b913f76f58c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -416,6 +416,10 @@ "category": "Error", "code": 1121 }, + "A tuple type element list cannot be empty.": { + "category": "Error", + "code": 1122 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2000 @@ -1042,7 +1046,7 @@ "File change detected. Compiling...": { "category": "Message", "code": 6032 - }, + }, "STRING": { "category": "Message", "code": 6033 @@ -1078,8 +1082,8 @@ "Additional locations:": { "category": "Message", "code": 6041 - }, - "Compilation complete. Watching for file changes.": { + }, + "Compilation complete. Watching for file changes.": { "category": "Message", "code": 6042 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 95182051e58..4a24d1c0265 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1402,7 +1402,7 @@ module ts { var startErrorCount = file.syntacticErrors.length; node.elementTypes = parseBracketedList(ParsingContext.TupleElementTypes, parseType, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); if (!node.elementTypes.length && file.syntacticErrors.length === startErrorCount) { - grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, Diagnostics.Type_argument_list_cannot_be_empty); + grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, Diagnostics.A_tuple_type_element_list_cannot_be_empty); } return finishNode(node); }