Skip to content

Commit 43ff75a

Browse files
committed
Merge branch 'master' into typeAliases
2 parents 77d4e2f + 4ffd0b3 commit 43ff75a

File tree

409 files changed

+5167
-4625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

409 files changed

+5167
-4625
lines changed

src/compiler/checker.ts

Lines changed: 326 additions & 157 deletions
Large diffs are not rendered by default.

src/compiler/core.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ module ts {
274274
};
275275
}
276276

277+
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain {
278+
Debug.assert(!headChain.next);
279+
headChain.next = tailChain;
280+
return headChain;
281+
}
282+
277283
export function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic {
278284
Debug.assert(start >= 0, "start must be non-negative, is " + start);
279285
Debug.assert(length >= 0, "length must be non-negative, is " + length);

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,16 @@ module ts {
141141
Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." },
142142
Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." },
143143
Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." },
144-
Interface_0_cannot_simultaneously_extend_types_1_and_2_Colon: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':" },
144+
Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." },
145145
Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." },
146-
Type_0_is_not_assignable_to_type_1_Colon: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}':" },
147146
Type_0_is_not_assignable_to_type_1: { code: 2323, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." },
148147
Property_0_is_missing_in_type_1: { code: 2324, category: DiagnosticCategory.Error, key: "Property '{0}' is missing in type '{1}'." },
149148
Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: DiagnosticCategory.Error, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." },
150-
Types_of_property_0_are_incompatible_Colon: { code: 2326, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible:" },
149+
Types_of_property_0_are_incompatible: { code: 2326, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible." },
151150
Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: DiagnosticCategory.Error, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." },
152-
Types_of_parameters_0_and_1_are_incompatible_Colon: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" },
151+
Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." },
153152
Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." },
154-
Index_signatures_are_incompatible_Colon: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible:" },
153+
Index_signatures_are_incompatible: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible." },
155154
this_cannot_be_referenced_in_a_module_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." },
156155
this_cannot_be_referenced_in_current_location: { code: 2332, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." },
157156
this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." },
@@ -164,7 +163,6 @@ module ts {
164163
Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" },
165164
Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." },
166165
An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." },
167-
Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 2343, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}':" },
168166
Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." },
169167
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
170168
Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." },
@@ -174,7 +172,6 @@ module ts {
174172
Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: DiagnosticCategory.Error, key: "Only a void function can be called with the 'new' keyword." },
175173
Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: DiagnosticCategory.Error, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." },
176174
Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." },
177-
Neither_type_0_nor_type_1_is_assignable_to_the_other_Colon: { code: 2353, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other:" },
178175
No_best_common_type_exists_among_return_expressions: { code: 2354, category: DiagnosticCategory.Error, key: "No best common type exists among return expressions." },
179176
A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: DiagnosticCategory.Error, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." },
180177
An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." },
@@ -235,20 +232,16 @@ module ts {
235232
Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." },
236233
Class_name_cannot_be_0: { code: 2414, category: DiagnosticCategory.Error, key: "Class name cannot be '{0}'" },
237234
Class_0_incorrectly_extends_base_class_1: { code: 2415, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}'." },
238-
Class_0_incorrectly_extends_base_class_1_Colon: { code: 2416, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}':" },
239235
Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." },
240-
Class_static_side_0_incorrectly_extends_base_class_static_side_1_Colon: { code: 2418, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}':" },
241236
Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: DiagnosticCategory.Error, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." },
242237
Class_0_incorrectly_implements_interface_1: { code: 2420, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}'." },
243-
Class_0_incorrectly_implements_interface_1_Colon: { code: 2421, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}':" },
244238
A_class_may_only_implement_another_class_or_interface: { code: 2422, category: DiagnosticCategory.Error, key: "A class may only implement another class or interface." },
245239
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." },
246240
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." },
247241
Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." },
248242
Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." },
249243
Interface_name_cannot_be_0: { code: 2427, category: DiagnosticCategory.Error, key: "Interface name cannot be '{0}'" },
250244
All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: DiagnosticCategory.Error, key: "All declarations of an interface must have identical type parameters." },
251-
Interface_0_incorrectly_extends_interface_1_Colon: { code: 2429, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}':" },
252245
Interface_0_incorrectly_extends_interface_1: { code: 2430, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
253246
Enum_name_cannot_be_0: { code: 2431, category: DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" },
254247
In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." },
@@ -272,7 +265,9 @@ module ts {
272265
Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true },
273266
Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true },
274267
An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." },
275-
Type_alias_0_circularly_references_itself: { code: 2453, category: DiagnosticCategory.Error, key: "Type alias '{0}' circularly references itself." },
268+
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." },
269+
Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." },
270+
Type_alias_0_circularly_references_itself: { code: 2456, category: DiagnosticCategory.Error, key: "Type alias '{0}' circularly references itself." },
276271
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
277272
Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
278273
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}'." },

src/compiler/diagnosticMessages.json

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -556,15 +556,15 @@
556556
"category": "Error",
557557
"code": 2319
558558
},
559-
"Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':": {
559+
"Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.": {
560560
"category": "Error",
561561
"code": 2320
562562
},
563563
"Excessive stack depth comparing types '{0}' and '{1}'.": {
564564
"category": "Error",
565565
"code": 2321
566566
},
567-
"Type '{0}' is not assignable to type '{1}':": {
567+
"Type '{0}' is not assignable to type '{1}'.": {
568568
"category": "Error",
569569
"code": 2322
570570
},
@@ -580,23 +580,23 @@
580580
"category": "Error",
581581
"code": 2325
582582
},
583-
"Types of property '{0}' are incompatible:": {
583+
"Types of property '{0}' are incompatible.": {
584584
"category": "Error",
585585
"code": 2326
586586
},
587587
"Property '{0}' is optional in type '{1}' but required in type '{2}'.": {
588588
"category": "Error",
589589
"code": 2327
590590
},
591-
"Types of parameters '{0}' and '{1}' are incompatible:": {
591+
"Types of parameters '{0}' and '{1}' are incompatible.": {
592592
"category": "Error",
593593
"code": 2328
594594
},
595595
"Index signature is missing in type '{0}'.": {
596596
"category": "Error",
597597
"code": 2329
598598
},
599-
"Index signatures are incompatible:": {
599+
"Index signatures are incompatible.": {
600600
"category": "Error",
601601
"code": 2330
602602
},
@@ -648,10 +648,6 @@
648648
"category": "Error",
649649
"code": 2342
650650
},
651-
"Type '{0}' does not satisfy the constraint '{1}':": {
652-
"category": "Error",
653-
"code": 2343
654-
},
655651
"Type '{0}' does not satisfy the constraint '{1}'.": {
656652
"category": "Error",
657653
"code": 2344
@@ -688,10 +684,6 @@
688684
"category": "Error",
689685
"code": 2352
690686
},
691-
"Neither type '{0}' nor type '{1}' is assignable to the other:": {
692-
"category": "Error",
693-
"code": 2353
694-
},
695687
"No best common type exists among return expressions.": {
696688
"category": "Error",
697689
"code": 2354
@@ -932,18 +924,10 @@
932924
"category": "Error",
933925
"code": 2415
934926
},
935-
"Class '{0}' incorrectly extends base class '{1}':": {
936-
"category": "Error",
937-
"code": 2416
938-
},
939927
"Class static side '{0}' incorrectly extends base class static side '{1}'.": {
940928
"category": "Error",
941929
"code": 2417
942930
},
943-
"Class static side '{0}' incorrectly extends base class static side '{1}':": {
944-
"category": "Error",
945-
"code": 2418
946-
},
947931
"Type name '{0}' in extends clause does not reference constructor function for '{0}'.": {
948932
"category": "Error",
949933
"code": 2419
@@ -952,10 +936,6 @@
952936
"category": "Error",
953937
"code": 2420
954938
},
955-
"Class '{0}' incorrectly implements interface '{1}':": {
956-
"category": "Error",
957-
"code": 2421
958-
},
959939
"A class may only implement another class or interface.": {
960940
"category": "Error",
961941
"code": 2422
@@ -984,10 +964,6 @@
984964
"category": "Error",
985965
"code": 2428
986966
},
987-
"Interface '{0}' incorrectly extends interface '{1}':": {
988-
"category": "Error",
989-
"code": 2429
990-
},
991967
"Interface '{0}' incorrectly extends interface '{1}'.": {
992968
"category": "Error",
993969
"code": 2430
@@ -1084,10 +1060,18 @@
10841060
"category": "Error",
10851061
"code": 2452
10861062
},
1087-
"Type alias '{0}' circularly references itself.": {
1063+
"The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.": {
10881064
"category": "Error",
10891065
"code": 2453
10901066
},
1067+
"Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.": {
1068+
"category": "Error",
1069+
"code": 2455
1070+
},
1071+
"Type alias '{0}' circularly references itself.": {
1072+
"category": "Error",
1073+
"code": 2456
1074+
},
10911075

10921076
"Import declaration '{0}' is using private name '{1}'.": {
10931077
"category": "Error",

src/compiler/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ module ts {
10151015
inferenceCount: number; // Incremented for every inference made (whether new or not)
10161016
inferences: Type[][]; // Inferences made for each type parameter
10171017
inferredTypes: Type[]; // Inferred type for each type parameter
1018+
failedTypeParameterIndex?: number; // Index of type parameter for which inference failed
1019+
// It is optional because in contextual signature instantiation, nothing fails
10181020
}
10191021

10201022
export interface DiagnosticMessage {

0 commit comments

Comments
 (0)