addressed CR feedback

This commit is contained in:
Vladimir Matveev
2015-01-12 11:31:54 -08:00
parent ecac4a519d
commit c25f3eb9a3
4 changed files with 7 additions and 7 deletions

View File

@@ -5608,7 +5608,7 @@ module ts {
var isConstEnum = isConstEnumObjectType(objectType);
if (isConstEnum &&
(!node.argumentExpression || node.argumentExpression.kind !== SyntaxKind.StringLiteral)) {
error(node.argumentExpression, Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string);
error(node.argumentExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return unknownType;
}

View File

@@ -369,7 +369,7 @@ module ts {
Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true },
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." },
Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: DiagnosticCategory.Error, key: "Index expression arguments in 'const' enums must be of type 'string'.", isEarly: true },
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal.", isEarly: true },
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." },
const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." },
Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'.", isEarly: true },

View File

@@ -1572,7 +1572,7 @@
"category": "Error",
"code": 4084
},
"Index expression arguments in 'const' enums must be of type 'string'.": {
"A const enum member can only be accessed using a string literal.": {
"category": "Error",
"code": 4085,
"isEarly": true

View File

@@ -3,8 +3,8 @@ tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier
tests/cases/compiler/constEnumErrors.ts(12,9): error TS4083: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(14,9): error TS4083: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(15,10): error TS4083: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(22,13): error TS4085: Index expression arguments in 'const' enums must be of type 'string'.
tests/cases/compiler/constEnumErrors.ts(24,13): error TS4085: Index expression arguments in 'const' enums must be of type 'string'.
tests/cases/compiler/constEnumErrors.ts(22,13): error TS4085: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(24,13): error TS4085: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(26,9): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(27,10): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(32,5): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
@@ -47,11 +47,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member
var y0 = E2[1]
~
!!! error TS4085: Index expression arguments in 'const' enums must be of type 'string'.
!!! error TS4085: A const enum member can only be accessed using a string literal.
var name = "A";
var y1 = E2[name];
~~~~
!!! error TS4085: Index expression arguments in 'const' enums must be of type 'string'.
!!! error TS4085: A const enum member can only be accessed using a string literal.
var x = E2;
~~