Skip to content

Commit

Permalink
Update LKG 08/25
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanchalai Tanglertsampan committed Aug 25, 2016
1 parent 3ed8bca commit d6dac6a
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 33 deletions.
22 changes: 19 additions & 3 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,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 @@ -13931,7 +13932,7 @@ var ts;
}
}
function getDeclarationOfAliasSymbol(symbol) {
return ts.findMap(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
}
function getTargetOfImportEqualsDeclaration(node) {
if (node.moduleReference.kind === 240) {
Expand Down Expand Up @@ -14063,6 +14064,7 @@ var ts;
if (!links.target) {
links.target = resolvingSymbol;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
var target = getTargetOfAliasDeclaration(node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
Expand Down Expand Up @@ -14092,6 +14094,7 @@ var ts;
if (!links.referenced) {
links.referenced = true;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
if (node.kind === 235) {
checkExpressionCached(node.expression);
}
Expand Down Expand Up @@ -18221,6 +18224,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);
}
}
function isRelatedTo(source, target, reportErrors, headMessage) {
var result;
if (source === target)
Expand Down Expand Up @@ -18299,6 +18312,9 @@ var ts;
}
}
if (reportErrors) {
if (source.flags & 2588672 && target.flags & 8190) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return 0;
Expand Down Expand Up @@ -37334,7 +37350,7 @@ var ts;
var classifiableNames;
var resolvedTypeReferenceDirectives = ts.createMap();
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
var currentNodeModulesDepth = 0;
var modulesWithElidedImports = ts.createMap();
var sourceFilesFoundSearchingNodeModules = ts.createMap();
Expand Down Expand Up @@ -39091,7 +39107,7 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
Expand Down
30 changes: 24 additions & 6 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,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 @@ -4803,7 +4804,7 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
Expand Down Expand Up @@ -14927,7 +14928,7 @@ var ts;
}
}
function getDeclarationOfAliasSymbol(symbol) {
return ts.findMap(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
}
function getTargetOfImportEqualsDeclaration(node) {
if (node.moduleReference.kind === 240) {
Expand Down Expand Up @@ -15059,6 +15060,7 @@ var ts;
if (!links.target) {
links.target = resolvingSymbol;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
var target = getTargetOfAliasDeclaration(node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
Expand Down Expand Up @@ -15088,6 +15090,7 @@ var ts;
if (!links.referenced) {
links.referenced = true;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
if (node.kind === 235) {
checkExpressionCached(node.expression);
}
Expand Down Expand Up @@ -19217,6 +19220,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);
}
}
function isRelatedTo(source, target, reportErrors, headMessage) {
var result;
if (source === target)
Expand Down Expand Up @@ -19295,6 +19308,9 @@ var ts;
}
}
if (reportErrors) {
if (source.flags & 2588672 && target.flags & 8190) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return 0;
Expand Down Expand Up @@ -38330,7 +38346,7 @@ var ts;
var classifiableNames;
var resolvedTypeReferenceDirectives = ts.createMap();
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
var currentNodeModulesDepth = 0;
var modulesWithElidedImports = ts.createMap();
var sourceFilesFoundSearchingNodeModules = ts.createMap();
Expand Down Expand Up @@ -44734,11 +44750,14 @@ var ts;
var pos_3 = this.pos;
var useJSDocScanner_1 = this.kind >= 273 && this.kind <= 285;
var processNode = function (node) {
if (pos_3 < node.pos) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
}
children.push(node);
pos_3 = node.end;
if (!isJSDocTagNode) {
pos_3 = node.end;
}
};
var processNodes = function (nodes) {
if (pos_3 < nodes.pos) {
Expand All @@ -44753,7 +44772,6 @@ var ts;
processNode(jsDocComment);
}
}
pos_3 = this.pos;
ts.forEachChild(this, processNode, processNodes);
if (pos_3 < this.end) {
this.addSyntheticNodes(children, pos_3, this.end);
Expand Down
6 changes: 6 additions & 0 deletions lib/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5257,6 +5257,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
30 changes: 24 additions & 6 deletions lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,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 @@ -4803,7 +4804,7 @@ var ts;
}
ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true } : {};
var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
Expand Down Expand Up @@ -14927,7 +14928,7 @@ var ts;
}
}
function getDeclarationOfAliasSymbol(symbol) {
return ts.findMap(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; });
}
function getTargetOfImportEqualsDeclaration(node) {
if (node.moduleReference.kind === 240) {
Expand Down Expand Up @@ -15059,6 +15060,7 @@ var ts;
if (!links.target) {
links.target = resolvingSymbol;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
var target = getTargetOfAliasDeclaration(node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
Expand Down Expand Up @@ -15088,6 +15090,7 @@ var ts;
if (!links.referenced) {
links.referenced = true;
var node = getDeclarationOfAliasSymbol(symbol);
ts.Debug.assert(!!node);
if (node.kind === 235) {
checkExpressionCached(node.expression);
}
Expand Down Expand Up @@ -19217,6 +19220,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);
}
}
function isRelatedTo(source, target, reportErrors, headMessage) {
var result;
if (source === target)
Expand Down Expand Up @@ -19295,6 +19308,9 @@ var ts;
}
}
if (reportErrors) {
if (source.flags & 2588672 && target.flags & 8190) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
reportRelationError(headMessage, source, target);
}
return 0;
Expand Down Expand Up @@ -38330,7 +38346,7 @@ var ts;
var classifiableNames;
var resolvedTypeReferenceDirectives = ts.createMap();
var fileProcessingDiagnostics = ts.createDiagnosticCollection();
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
var currentNodeModulesDepth = 0;
var modulesWithElidedImports = ts.createMap();
var sourceFilesFoundSearchingNodeModules = ts.createMap();
Expand Down Expand Up @@ -44734,11 +44750,14 @@ var ts;
var pos_3 = this.pos;
var useJSDocScanner_1 = this.kind >= 273 && this.kind <= 285;
var processNode = function (node) {
if (pos_3 < node.pos) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
}
children.push(node);
pos_3 = node.end;
if (!isJSDocTagNode) {
pos_3 = node.end;
}
};
var processNodes = function (nodes) {
if (pos_3 < nodes.pos) {
Expand All @@ -44753,7 +44772,6 @@ var ts;
processNode(jsDocComment);
}
}
pos_3 = this.pos;
ts.forEachChild(this, processNode, processNodes);
if (pos_3 < this.end) {
this.addSyntheticNodes(children, pos_3, this.end);
Expand Down
Loading

0 comments on commit d6dac6a

Please sign in to comment.