Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh committed Oct 9, 2018
1 parent 8038e14 commit ec0cfab
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 64 deletions.
6 changes: 6 additions & 0 deletions lib/enu/diagnosticMessages.generated.json.lcg
Expand Up @@ -3339,6 +3339,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSDoc_type_0_circularly_references_itself_2587" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSDoc type '{0}' circularly references itself.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.]]></Val>
Expand Down
35 changes: 26 additions & 9 deletions lib/tsc.js
Expand Up @@ -60,7 +60,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
var ts;
(function (ts) {
ts.versionMajorMinor = "3.1";
ts.version = ts.versionMajorMinor + ".1";
ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
ts.emptyArray = [];
Expand Down Expand Up @@ -3495,6 +3495,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
Expand Down Expand Up @@ -21970,6 +21971,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
bindJSDoc(node);
return;
}
switch (node.kind) {
Expand Down Expand Up @@ -25719,7 +25721,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277);
if (lastLocation.commonJsModuleIndicator && name === "exports") {
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
Expand Down Expand Up @@ -26423,7 +26425,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
if (!exported || moduleSymbol.exports.size === 1) {
if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
Expand Down Expand Up @@ -28196,6 +28198,8 @@ var ts;
return !!target.resolvedReturnType;
case 4:
return !!target.immediateBaseConstraint;
case 6:
return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
Expand Down Expand Up @@ -31266,11 +31270,20 @@ var ts;
return getTypeOfSymbol(symbol);
}
function getJSDocTypeReference(node, symbol, typeArguments) {
if (!pushTypeResolution(symbol, 6)) {
return errorType;
}
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
if (!popTypeResolution()) {
getSymbolLinks(symbol).resolvedJSDocType = errorType;
error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
return errorType;
}
if (referenceType || assignedType) {
return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
Expand Down Expand Up @@ -40665,12 +40678,16 @@ var ts;
return result;
}
function isJSConstructor(node) {
if (node && ts.isInJSFile(node)) {
if (!node || !ts.isInJSFile(node)) {
return false;
}
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
undefined;
if (func) {
if (ts.getJSDocClassTag(node))
return true;
var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
undefined;
var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
Expand Down Expand Up @@ -40703,7 +40720,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
Expand Down
40 changes: 29 additions & 11 deletions lib/tsserver.js
Expand Up @@ -88,7 +88,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
ts.version = ts.versionMajorMinor + ".1";
ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
Expand Down Expand Up @@ -5453,6 +5453,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
Expand Down Expand Up @@ -27086,6 +27087,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
bindJSDoc(node);
return;
}
switch (node.kind) {
Expand Down Expand Up @@ -30776,6 +30778,7 @@ var ts;
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var CheckMode;
(function (CheckMode) {
Expand Down Expand Up @@ -31535,7 +31538,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
if (lastLocation.commonJsModuleIndicator && name === "exports") {
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
Expand Down Expand Up @@ -32338,7 +32341,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
if (!exported || moduleSymbol.exports.size === 1) {
if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
Expand Down Expand Up @@ -34285,6 +34288,8 @@ var ts;
return !!target.resolvedReturnType;
case 4 /* ImmediateBaseConstraint */:
return !!target.immediateBaseConstraint;
case 6 /* JSDocTypeReference */:
return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
Expand Down Expand Up @@ -37777,7 +37782,7 @@ var ts;
if (type) {
return type;
}
// JS are 'string' or 'number', not an enum type.
// JS enums are 'string' or 'number', not an enum type.
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
var links = getNodeLinks(enumTag);
Expand Down Expand Up @@ -37815,12 +37820,21 @@ var ts;
* the type of this reference is just the type of the value we resolved to.
*/
function getJSDocTypeReference(node, symbol, typeArguments) {
if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
return errorType;
}
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
if (!popTypeResolution()) {
getSymbolLinks(symbol).resolvedJSDocType = errorType;
error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
return errorType;
}
if (referenceType || assignedType) {
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
Expand Down Expand Up @@ -37945,7 +37959,7 @@ var ts;
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
type = getTypeReferenceType(node, symbol);
}
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
// type reference in checkTypeReferenceNode.
links.resolvedSymbol = symbol;
links.resolvedType = type;
Expand Down Expand Up @@ -48904,14 +48918,18 @@ var ts;
* file.
*/
function isJSConstructor(node) {
if (node && ts.isInJSFile(node)) {
if (!node || !ts.isInJSFile(node)) {
return false;
}
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
undefined;
if (func) {
// If the node has a @class tag, treat it like a constructor.
if (ts.getJSDocClassTag(node))
return true;
// If the symbol of the node has members, treat it like a constructor.
var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
undefined;
var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
Expand Down Expand Up @@ -48944,7 +48962,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
Expand Down

0 comments on commit ec0cfab

Please sign in to comment.