Adding error message for empty tuple types.

This commit is contained in:
Anders Hejlsberg 2014-08-13 11:13:24 -07:00
parent ef52312644
commit 92b367741b
3 changed files with 9 additions and 4 deletions

View File

@ -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}'." },

View File

@ -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
},

View File

@ -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);
}