mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 17:41:26 -06:00
Add InferencePriority.Circularity per CR feedback
This commit is contained in:
parent
86d9153374
commit
abc61a0949
@ -15696,7 +15696,7 @@ namespace ts {
|
||||
inferencePriority = Math.min(inferencePriority, status);
|
||||
return;
|
||||
}
|
||||
(visited || (visited = createMap<number>())).set(key, -1);
|
||||
(visited || (visited = createMap<number>())).set(key, InferencePriority.Circularity);
|
||||
const saveInferencePriority = inferencePriority;
|
||||
inferencePriority = InferencePriority.MaxValue;
|
||||
action(source, target);
|
||||
@ -15789,7 +15789,7 @@ namespace ts {
|
||||
inferencePriority = InferencePriority.MaxValue;
|
||||
inferFromTypes(sources[i], t);
|
||||
if (inferencePriority === priority) matched[i] = true;
|
||||
inferenceCircularity = inferenceCircularity || inferencePriority < 0;
|
||||
inferenceCircularity = inferenceCircularity || inferencePriority === InferencePriority.Circularity;
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
}
|
||||
@ -15901,7 +15901,7 @@ namespace ts {
|
||||
const symbol = isNonConstructorObject ? target.symbol : undefined;
|
||||
if (symbol) {
|
||||
if (contains(symbolStack, symbol)) {
|
||||
inferencePriority = -1;
|
||||
inferencePriority = InferencePriority.Circularity;
|
||||
return;
|
||||
}
|
||||
(symbolStack || (symbolStack = [])).push(symbol);
|
||||
|
||||
@ -4474,6 +4474,7 @@ namespace ts {
|
||||
MaxValue = 1 << 8, // Seed for inference priority tracking
|
||||
|
||||
PriorityImpliesCombination = ReturnType | MappedTypeConstraint | LiteralKeyof, // These priorities imply that the resulting type should be a combination of all candidates
|
||||
Circularity = -1, // Inference circularity (value less than all other priorities)
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user