Skip to content

Commit cbeea38

Browse files
2 parents fee50a6 + 52b0808 commit cbeea38

8 files changed

+86
-86
lines changed

src/compiler/diagnosticInformationMap.generated.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,15 @@ module ts {
304304
super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." },
305305
A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." },
306306
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." },
307+
Enum_declarations_must_all_be_const_or_non_const: { code: 2469, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
308+
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2470, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
309+
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: 2471, 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." },
310+
A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2472, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." },
311+
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2473, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." },
312+
const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2474, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." },
313+
Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
314+
let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." },
315+
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
307316
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
308317
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
309318
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -373,15 +382,6 @@ module ts {
373382
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
374383
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
375384
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." },
376-
Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
377-
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." },
378-
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." },
379-
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." },
380-
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." },
381-
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'." },
382-
Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
383-
let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 4089, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." },
384-
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 4090, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
385385
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
386386
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
387387
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },

src/compiler/diagnosticMessages.json

+36-36
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,42 @@
12081208
"category": "Error",
12091209
"code": 2468
12101210
},
1211+
"Enum declarations must all be const or non-const.": {
1212+
"category": "Error",
1213+
"code": 2469
1214+
},
1215+
"In 'const' enum declarations member initializer must be constant expression.": {
1216+
"category": "Error",
1217+
"code": 2470
1218+
},
1219+
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
1220+
"category": "Error",
1221+
"code": 2471
1222+
},
1223+
"A const enum member can only be accessed using a string literal.": {
1224+
"category": "Error",
1225+
"code": 2472
1226+
},
1227+
"'const' enum member initializer was evaluated to a non-finite value.": {
1228+
"category": "Error",
1229+
"code": 2473
1230+
},
1231+
"'const' enum member initializer was evaluated to disallowed value 'NaN'.": {
1232+
"category": "Error",
1233+
"code": 2474
1234+
},
1235+
"Property '{0}' does not exist on 'const' enum '{1}'.": {
1236+
"category": "Error",
1237+
"code": 2475
1238+
},
1239+
"'let' is not allowed to be used as a name in 'let' or 'const' declarations.": {
1240+
"category": "Error",
1241+
"code": 2476
1242+
},
1243+
"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": {
1244+
"category": "Error",
1245+
"code": 2477
1246+
},
12111247

12121248
"Import declaration '{0}' is using private name '{1}'.": {
12131249
"category": "Error",
@@ -1485,42 +1521,6 @@
14851521
"category": "Error",
14861522
"code": 4081
14871523
},
1488-
"Enum declarations must all be const or non-const.": {
1489-
"category": "Error",
1490-
"code": 4082
1491-
},
1492-
"In 'const' enum declarations member initializer must be constant expression.": {
1493-
"category": "Error",
1494-
"code": 4083
1495-
},
1496-
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
1497-
"category": "Error",
1498-
"code": 4084
1499-
},
1500-
"A const enum member can only be accessed using a string literal.": {
1501-
"category": "Error",
1502-
"code": 4085
1503-
},
1504-
"'const' enum member initializer was evaluated to a non-finite value.": {
1505-
"category": "Error",
1506-
"code": 4086
1507-
},
1508-
"'const' enum member initializer was evaluated to disallowed value 'NaN'.": {
1509-
"category": "Error",
1510-
"code": 4087
1511-
},
1512-
"Property '{0}' does not exist on 'const' enum '{1}'.": {
1513-
"category": "Error",
1514-
"code": 4088
1515-
},
1516-
"'let' is not allowed to be used as a name in 'let' or 'const' declarations.": {
1517-
"category": "Error",
1518-
"code": 4089
1519-
},
1520-
"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": {
1521-
"category": "Error",
1522-
"code": 4090
1523-
},
15241524
"The current host does not support the '{0}' option.": {
15251525
"category": "Error",
15261526
"code": 5001

tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
2-
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS4090: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
3-
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS4090: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
1+
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
2+
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
3+
tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
44

55

66
==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ====
@@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS
1212

1313
var x = 0;
1414
~
15-
!!! error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
15+
!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
1616
}
1717

1818

@@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS
2222
{
2323
var y = 0;
2424
~
25-
!!! error TS4090: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
25+
!!! error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'.
2626
}
2727
}
2828

@@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS
3131
const z = 0;
3232
var z = 0
3333
~
34-
!!! error TS4090: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
34+
!!! error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'.
3535
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS4088: Property 'B' does not exist on 'const' enum 'E'.
1+
tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2475: Property 'B' does not exist on 'const' enum 'E'.
22

33

44
==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ====
55
const enum E { A }
66
var x = E["B"]
77
~~~
8-
!!! error TS4088: Property 'B' does not exist on 'const' enum 'E'.
8+
!!! error TS2475: Property 'B' does not exist on 'const' enum 'E'.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'.
22
tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'.
3-
tests/cases/compiler/constEnumErrors.ts(12,9): error TS4083: In 'const' enum declarations member initializer must be constant expression.
4-
tests/cases/compiler/constEnumErrors.ts(14,9): error TS4083: In 'const' enum declarations member initializer must be constant expression.
5-
tests/cases/compiler/constEnumErrors.ts(15,10): error TS4083: In 'const' enum declarations member initializer must be constant expression.
6-
tests/cases/compiler/constEnumErrors.ts(22,13): error TS4085: A const enum member can only be accessed using a string literal.
7-
tests/cases/compiler/constEnumErrors.ts(24,13): error TS4085: A const enum member can only be accessed using a string literal.
8-
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.
9-
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.
10-
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.
11-
tests/cases/compiler/constEnumErrors.ts(40,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value.
12-
tests/cases/compiler/constEnumErrors.ts(41,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value.
13-
tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
3+
tests/cases/compiler/constEnumErrors.ts(12,9): error TS2470: In 'const' enum declarations member initializer must be constant expression.
4+
tests/cases/compiler/constEnumErrors.ts(14,9): error TS2470: In 'const' enum declarations member initializer must be constant expression.
5+
tests/cases/compiler/constEnumErrors.ts(15,10): error TS2470: In 'const' enum declarations member initializer must be constant expression.
6+
tests/cases/compiler/constEnumErrors.ts(22,13): error TS2472: A const enum member can only be accessed using a string literal.
7+
tests/cases/compiler/constEnumErrors.ts(24,13): error TS2472: A const enum member can only be accessed using a string literal.
8+
tests/cases/compiler/constEnumErrors.ts(26,9): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
9+
tests/cases/compiler/constEnumErrors.ts(27,10): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
10+
tests/cases/compiler/constEnumErrors.ts(32,5): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
11+
tests/cases/compiler/constEnumErrors.ts(40,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
12+
tests/cases/compiler/constEnumErrors.ts(41,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
13+
tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
1414

1515

1616
==== tests/cases/compiler/constEnumErrors.ts (13 errors) ====
@@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member
3131
// forward reference to the element of the same enum
3232
X = Y,
3333
~
34-
!!! error TS4083: In 'const' enum declarations member initializer must be constant expression.
34+
!!! error TS2470: In 'const' enum declarations member initializer must be constant expression.
3535
// forward reference to the element of the same enum
3636
Y = E1.Z,
3737
~~~~
38-
!!! error TS4083: In 'const' enum declarations member initializer must be constant expression.
38+
!!! error TS2470: In 'const' enum declarations member initializer must be constant expression.
3939
Y1 = E1["Z"]
4040
~~~~~~~
41-
!!! error TS4083: In 'const' enum declarations member initializer must be constant expression.
41+
!!! error TS2470: In 'const' enum declarations member initializer must be constant expression.
4242
}
4343

4444
const enum E2 {
@@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member
4747

4848
var y0 = E2[1]
4949
~
50-
!!! error TS4085: A const enum member can only be accessed using a string literal.
50+
!!! error TS2472: A const enum member can only be accessed using a string literal.
5151
var name = "A";
5252
var y1 = E2[name];
5353
~~~~
54-
!!! error TS4085: A const enum member can only be accessed using a string literal.
54+
!!! error TS2472: A const enum member can only be accessed using a string literal.
5555

5656
var x = E2;
5757
~~
58-
!!! 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.
58+
!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
5959
var y = [E2];
6060
~~
61-
!!! 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.
61+
!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
6262

6363
function foo(t: any): void {
6464
}
6565

6666
foo(E2);
6767
~~
68-
!!! 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.
68+
!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
6969

7070
const enum NaNOrInfinity {
7171
A = 9007199254740992,
@@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member
7575
E = D * D,
7676
F = E * E, // overflow
7777
~~~~~
78-
!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value.
78+
!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
7979
G = 1 / 0, // overflow
8080
~~~~~
81-
!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value.
81+
!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value.
8282
H = 0 / 0 // NaN
8383
~~~~~
84-
!!! error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
84+
!!! error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
8585
}

0 commit comments

Comments
 (0)