Skip to content

Commit 61a404d

Browse files
committed
Update LKG
1 parent 6336925 commit 61a404d

File tree

4 files changed

+345
-239
lines changed

4 files changed

+345
-239
lines changed

bin/tsc.js

Lines changed: 78 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,8 @@ var ts;
12771277
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
12781278
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
12791279
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
1280+
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
1281+
Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
12801282
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
12811283
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}'." },
12821284
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}'." },
@@ -1431,7 +1433,6 @@ var ts;
14311433
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
14321434
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
14331435
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
1434-
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
14351436
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
14361437
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
14371438
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
@@ -8583,7 +8584,6 @@ var ts;
85838584
var undefinedType = createIntrinsicType(32 | 262144, "undefined");
85848585
var nullType = createIntrinsicType(64 | 262144, "null");
85858586
var unknownType = createIntrinsicType(1, "unknown");
8586-
var resolvingType = createIntrinsicType(1, "__resolving__");
85878587
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
85888588
var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
85898589
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
@@ -8613,6 +8613,8 @@ var ts;
86138613
var emitExtends = false;
86148614
var emitDecorate = false;
86158615
var emitParam = false;
8616+
var resolutionTargets = [];
8617+
var resolutionResults = [];
86168618
var mergedSymbols = [];
86178619
var symbolLinks = [];
86188620
var nodeLinks = [];
@@ -8832,9 +8834,9 @@ var ts;
88328834
}
88338835
else if (location.kind === 228 ||
88348836
(location.kind === 206 && location.name.kind === 8)) {
8835-
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931);
8837+
result = getSymbolOfNode(location).exports["default"];
88368838
var localSymbol = ts.getLocalSymbolForExportDefault(result);
8837-
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
8839+
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
88388840
break loop;
88398841
}
88408842
result = undefined;
@@ -9163,7 +9165,8 @@ var ts;
91639165
}
91649166
var symbol;
91659167
if (name.kind === 65) {
9166-
symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name);
9168+
var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0;
9169+
symbol = resolveName(name, name.text, meaning, message, name);
91679170
if (!symbol) {
91689171
return undefined;
91699172
}
@@ -10134,6 +10137,26 @@ var ts;
1013410137
});
1013510138
}
1013610139
}
10140+
function pushTypeResolution(target) {
10141+
var i = 0;
10142+
var count = resolutionTargets.length;
10143+
while (i < count && resolutionTargets[i] !== target) {
10144+
i++;
10145+
}
10146+
if (i < count) {
10147+
do {
10148+
resolutionResults[i++] = false;
10149+
} while (i < count);
10150+
return false;
10151+
}
10152+
resolutionTargets.push(target);
10153+
resolutionResults.push(true);
10154+
return true;
10155+
}
10156+
function popTypeResolution() {
10157+
resolutionTargets.pop();
10158+
return resolutionResults.pop();
10159+
}
1013710160
function getRootDeclaration(node) {
1013810161
while (node.kind === 153) {
1013910162
node = node.parent.parent;
@@ -10311,20 +10334,23 @@ var ts;
1031110334
if (declaration.kind === 215) {
1031210335
return links.type = checkExpression(declaration.expression);
1031310336
}
10314-
links.type = resolvingType;
10315-
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
10316-
if (links.type === resolvingType) {
10317-
links.type = type;
10337+
if (!pushTypeResolution(symbol)) {
10338+
return unknownType;
1031810339
}
10319-
}
10320-
else if (links.type === resolvingType) {
10321-
links.type = anyType;
10322-
if (compilerOptions.noImplicitAny) {
10323-
var diagnostic = symbol.valueDeclaration.type ?
10324-
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
10325-
ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
10326-
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
10340+
var type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
10341+
if (!popTypeResolution()) {
10342+
if (symbol.valueDeclaration.type) {
10343+
type = unknownType;
10344+
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
10345+
}
10346+
else {
10347+
type = anyType;
10348+
if (compilerOptions.noImplicitAny) {
10349+
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
10350+
}
10351+
}
1032710352
}
10353+
links.type = type;
1032810354
}
1032910355
return links.type;
1033010356
}
@@ -10345,13 +10371,10 @@ var ts;
1034510371
}
1034610372
function getTypeOfAccessors(symbol) {
1034710373
var links = getSymbolLinks(symbol);
10348-
checkAndStoreTypeOfAccessors(symbol, links);
10349-
return links.type;
10350-
}
10351-
function checkAndStoreTypeOfAccessors(symbol, links) {
10352-
links = links || getSymbolLinks(symbol);
1035310374
if (!links.type) {
10354-
links.type = resolvingType;
10375+
if (!pushTypeResolution(symbol)) {
10376+
return unknownType;
10377+
}
1035510378
var getter = ts.getDeclarationOfKind(symbol, 137);
1035610379
var setter = ts.getDeclarationOfKind(symbol, 138);
1035710380
var type;
@@ -10376,17 +10399,16 @@ var ts;
1037610399
}
1037710400
}
1037810401
}
10379-
if (links.type === resolvingType) {
10380-
links.type = type;
10381-
}
10382-
}
10383-
else if (links.type === resolvingType) {
10384-
links.type = anyType;
10385-
if (compilerOptions.noImplicitAny) {
10386-
var getter = ts.getDeclarationOfKind(symbol, 137);
10387-
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
10402+
if (!popTypeResolution()) {
10403+
type = anyType;
10404+
if (compilerOptions.noImplicitAny) {
10405+
var getter_1 = ts.getDeclarationOfKind(symbol, 137);
10406+
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
10407+
}
1038810408
}
10409+
links.type = type;
1038910410
}
10411+
return links.type;
1039010412
}
1039110413
function getTypeOfFuncClassEnumModule(symbol) {
1039210414
var links = getSymbolLinks(symbol);
@@ -10548,17 +10570,16 @@ var ts;
1054810570
function getDeclaredTypeOfTypeAlias(symbol) {
1054910571
var links = getSymbolLinks(symbol);
1055010572
if (!links.declaredType) {
10551-
links.declaredType = resolvingType;
10573+
if (!pushTypeResolution(links)) {
10574+
return unknownType;
10575+
}
1055210576
var declaration = ts.getDeclarationOfKind(symbol, 204);
1055310577
var type = getTypeFromTypeNode(declaration.type);
10554-
if (links.declaredType === resolvingType) {
10555-
links.declaredType = type;
10578+
if (!popTypeResolution()) {
10579+
type = unknownType;
10580+
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
1055610581
}
10557-
}
10558-
else if (links.declaredType === resolvingType) {
10559-
links.declaredType = unknownType;
10560-
var declaration = ts.getDeclarationOfKind(symbol, 204);
10561-
error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
10582+
links.declaredType = type;
1056210583
}
1056310584
return links.declaredType;
1056410585
}
@@ -11097,7 +11118,9 @@ var ts;
1109711118
}
1109811119
function getReturnTypeOfSignature(signature) {
1109911120
if (!signature.resolvedReturnType) {
11100-
signature.resolvedReturnType = resolvingType;
11121+
if (!pushTypeResolution(signature)) {
11122+
return unknownType;
11123+
}
1110111124
var type;
1110211125
if (signature.target) {
1110311126
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
@@ -11108,21 +11131,19 @@ var ts;
1110811131
else {
1110911132
type = getReturnTypeFromBody(signature.declaration);
1111011133
}
11111-
if (signature.resolvedReturnType === resolvingType) {
11112-
signature.resolvedReturnType = type;
11113-
}
11114-
}
11115-
else if (signature.resolvedReturnType === resolvingType) {
11116-
signature.resolvedReturnType = anyType;
11117-
if (compilerOptions.noImplicitAny) {
11118-
var declaration = signature.declaration;
11119-
if (declaration.name) {
11120-
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
11121-
}
11122-
else {
11123-
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
11134+
if (!popTypeResolution()) {
11135+
type = anyType;
11136+
if (compilerOptions.noImplicitAny) {
11137+
var declaration = signature.declaration;
11138+
if (declaration.name) {
11139+
error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name));
11140+
}
11141+
else {
11142+
error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
11143+
}
1112411144
}
1112511145
}
11146+
signature.resolvedReturnType = type;
1112611147
}
1112711148
return signature.resolvedReturnType;
1112811149
}
@@ -14372,10 +14393,9 @@ var ts;
1437214393
if (isContextSensitive(node)) {
1437314394
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
1437414395
}
14375-
if (!node.type) {
14376-
signature.resolvedReturnType = resolvingType;
14396+
if (!node.type && !signature.resolvedReturnType) {
1437714397
var returnType = getReturnTypeFromBody(node, contextualMapper);
14378-
if (signature.resolvedReturnType === resolvingType) {
14398+
if (!signature.resolvedReturnType) {
1437914399
signature.resolvedReturnType = returnType;
1438014400
}
1438114401
}
@@ -15156,7 +15176,7 @@ var ts;
1515615176
}
1515715177
}
1515815178
}
15159-
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
15179+
getTypeOfAccessors(getSymbolOfNode(node));
1516015180
}
1516115181
checkFunctionLikeDeclaration(node);
1516215182
}

0 commit comments

Comments
 (0)