Skip to content

Commit

Permalink
2016-08-24 [ci skip] Version: 1.201608240006.1+ddb5a00410d695d35b55c5…
Browse files Browse the repository at this point in the history
…482876a16f7c696c4b
  • Loading branch information
basarat committed Aug 24, 2016
1 parent 1dbaad7 commit 786c6d4
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bin/ntypescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5837,6 +5837,12 @@ declare namespace ts {
key: string;
message: string;
};
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Import_declaration_0_is_using_private_name_1: {
code: number;
category: DiagnosticCategory;
Expand Down
14 changes: 14 additions & 0 deletions bin/ntypescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -6265,6 +6265,7 @@ var ts;
Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" },
A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." },
An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." },
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
Expand Down Expand Up @@ -22222,6 +22223,16 @@ var ts;
}
reportError(message, sourceType, targetType);
}
function tryElaborateErrorsForPrimitivesAndObjects(source, target) {
var sourceType = typeToString(source);
var targetType = typeToString(target);
if ((globalStringType === source && stringType === target) ||
(globalNumberType === source && numberType === target) ||
(globalBooleanType === source && booleanType === target) ||
(getGlobalESSymbolType() === source && esSymbolType === target)) {
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
// Compare two types and return
// Ternary.True if they are related with no assumptions,
// Ternary.Maybe if they are related with assumptions of other relationships, or
Expand Down Expand Up @@ -22335,6 +22346,9 @@ var ts;
}
}
if (reportErrors) {
if (source.flags & 2588672 /* ObjectType */ && target.flags & 8190 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return 0 /* False */;
Expand Down
6 changes: 6 additions & 0 deletions bin/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5837,6 +5837,12 @@ declare namespace ts {
key: string;
message: string;
};
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: {
code: number;
category: DiagnosticCategory;
key: string;
message: string;
};
Import_declaration_0_is_using_private_name_1: {
code: number;
category: DiagnosticCategory;
Expand Down
14 changes: 14 additions & 0 deletions bin/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -6265,6 +6265,7 @@ var ts;
Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" },
A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." },
An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." },
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
Expand Down Expand Up @@ -22222,6 +22223,16 @@ var ts;
}
reportError(message, sourceType, targetType);
}
function tryElaborateErrorsForPrimitivesAndObjects(source, target) {
var sourceType = typeToString(source);
var targetType = typeToString(target);
if ((globalStringType === source && stringType === target) ||
(globalNumberType === source && numberType === target) ||
(globalBooleanType === source && booleanType === target) ||
(getGlobalESSymbolType() === source && esSymbolType === target)) {
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
// Compare two types and return
// Ternary.True if they are related with no assumptions,
// Ternary.Maybe if they are related with assumptions of other relationships, or
Expand Down Expand Up @@ -22335,6 +22346,9 @@ var ts;
}
}
if (reportErrors) {
if (source.flags & 2588672 /* ObjectType */ && target.flags & 8190 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return 0 /* False */;
Expand Down
2 changes: 1 addition & 1 deletion kicktravis
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2016-08-23 [ci skip] Version: 1.201608230008.1+93de502656a7a0cdf30737513d29bcb396c79662
2016-08-24 [ci skip] Version: 1.201608240006.1+ddb5a00410d695d35b55c5482876a16f7c696c4b
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ntypescript",
"version": "1.201608230008.1+93de502656a7a0cdf30737513d29bcb396c79662",
"version": "1.201608240006.1+ddb5a00410d695d35b55c5482876a16f7c696c4b",
"description": "A nicer version of microsoft/typescript packaged and released for API developers",
"main": "./bin/ntypescript.js",
"bin": {
Expand Down
15 changes: 15 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6300,6 +6300,18 @@ namespace ts {
reportError(message, sourceType, targetType);
}

function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) {
const sourceType = typeToString(source);
const targetType = typeToString(target);

if ((globalStringType === source && stringType === target) ||
(globalNumberType === source && numberType === target) ||
(globalBooleanType === source && booleanType === target) ||
(getGlobalESSymbolType() === source && esSymbolType === target)) {
reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}

// Compare two types and return
// Ternary.True if they are related with no assumptions,
// Ternary.Maybe if they are related with assumptions of other relationships, or
Expand Down Expand Up @@ -6423,6 +6435,9 @@ namespace ts {
}

if (reportErrors) {
if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.Primitive) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return Ternary.False;
Expand Down
1 change: 1 addition & 0 deletions src/compiler/diagnosticInformationMap.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ namespace ts {
Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" },
A_class_must_be_declared_after_its_base_class: { code: 2690, category: DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." },
An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." },
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
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_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
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_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
Expand Down
1 change: 1 addition & 0 deletions src/compiler/diagnosticMessages.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@
"Cannot_extend_an_interface_0_Did_you_mean_implements_2689" : "Cannot extend an interface '{0}'. Did you mean 'implements'?",
"A_class_must_be_declared_after_its_base_class_2690" : "A class must be declared after its base class.",
"An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691" : "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.",
"_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692" : "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.",
"Import_declaration_0_is_using_private_name_1_4000" : "Import declaration '{0}' is using private name '{1}'.",
"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002" : "Type parameter '{0}' of exported class has or is using private name '{1}'.",
"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004" : "Type parameter '{0}' of exported interface has or is using private name '{1}'.",
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,10 @@
"category": "Error",
"code": 2691
},
"'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.": {
"category": "Error",
"code": 2692
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
Expand Down

0 comments on commit 786c6d4

Please sign in to comment.