Skip to content

Commit

Permalink
Support reporting via a flag, though temporarily ignore it.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed May 12, 2015
1 parent abd44b1 commit e21f7cf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6558,7 +6558,7 @@ module ts {
if (index < 0) {

// Check for type arguments inferred as '{}'.
if (originalCandidate.typeParameters && inferenceResult) {
if (/*compilerOptions.noInferredEmptyObject &&*/ originalCandidate.typeParameters && inferenceResult) {
for (var i = 0, len = typeArgumentTypes.length; i < len; i++) {

if (typeArgumentTypes[i] === emptyObjectType && getInferenceCandidates(inferenceResult, i).length === 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ module ts {
{
name: "noImplicitAny",
type: "boolean",
description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,
description: Diagnostics.Raise_an_error_when_the_any_type_is_inferred_for_a_declaration
},
{
name: "noInferredEmptyObject",
type: "boolean",
description: Diagnostics.Raise_an_error_when_inferring_for_type_arguments
},
{
name: "noLib",
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/diagnosticInformationMap.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,13 @@ module ts {
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
Raise_an_error_when_the_any_type_is_inferred_for_a_declaration: { code: 6052, category: DiagnosticCategory.Message, key: "Raise an error when the 'any' type is inferred for a declaration." },
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Raise_an_error_when_inferring_for_type_arguments: { code: 6058, category: DiagnosticCategory.Message, key: "Raise an error when inferring '{}' for type arguments." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@
"category": "Error",
"code": 6051
},
"Raise error on expressions and declarations with an implied 'any' type.": {
"Raise an error when the 'any' type is inferred for a declaration.": {
"category": "Message",
"code": 6052
},
Expand All @@ -1848,6 +1848,10 @@
"category": "Message",
"code": 6057
},
"Raise an error when inferring '{}' for type arguments.": {
"category": "Message",
"code": 6058
},

"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
Expand Down
1 change: 1 addition & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,7 @@ module ts {
noEmitOnError?: boolean;
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noInferredEmptyObject?: boolean;
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
Expand Down

0 comments on commit e21f7cf

Please sign in to comment.