mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Merge pull request #10703 from Microsoft/fixSignatureCache
Fix call signature caching
This commit is contained in:
commit
2379000f8a
@ -143,6 +143,7 @@ namespace ts {
|
||||
|
||||
const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
const resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
|
||||
const enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
|
||||
@ -12229,10 +12230,10 @@ namespace ts {
|
||||
// or that a different candidatesOutArray was passed in. Therefore, we need to redo the work
|
||||
// to correctly fill the candidatesOutArray.
|
||||
const cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
const result = resolveSignature(node, candidatesOutArray);
|
||||
// If signature resolution originated in control flow type analysis (for example to compute the
|
||||
// assigned type in a flow assignment) we don't cache the result as it may be based on temporary
|
||||
@ -12244,7 +12245,7 @@ namespace ts {
|
||||
function getResolvedOrAnySignature(node: CallLikeExpression) {
|
||||
// If we're already in the process of resolving the given signature, don't resolve again as
|
||||
// that could cause infinite recursion. Instead, return anySignature.
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
|
||||
function getInferredClassType(symbol: Symbol) {
|
||||
|
||||
2200
tests/baselines/reference/fixSignatureCaching.errors.txt
Normal file
2200
tests/baselines/reference/fixSignatureCaching.errors.txt
Normal file
File diff suppressed because one or more lines are too long
1902
tests/baselines/reference/fixSignatureCaching.js
Normal file
1902
tests/baselines/reference/fixSignatureCaching.js
Normal file
File diff suppressed because one or more lines are too long
985
tests/cases/conformance/fixSignatureCaching.ts
Normal file
985
tests/cases/conformance/fixSignatureCaching.ts
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user