Fixed bug that results in false negative when a list or set expression includes more than 64 elements and is being evaluated with a bidirectional inference context. This addresses #8314.

This commit is contained in:
Eric Traut 2024-07-06 11:51:09 -07:00
parent 1c85d650ae
commit 228bd84c54

View File

@ -13303,7 +13303,7 @@ export function createTypeEvaluator(
}
}
const result = getTypeOfDictionaryInferred(node, flags, /* hasExpectedType */ !!inferenceContext);
const result = getTypeOfDictionaryInferred(node, flags, /* hasExpectedType */ !!inferenceContext?.expectedType);
return { ...result, expectedTypeDiagAddendum };
}
@ -13877,7 +13877,7 @@ export function createTypeEvaluator(
const typeResult = getTypeOfListOrSetInferred(
node,
flags,
/* hasExpectedType */ inferenceContext !== undefined
/* hasExpectedType */ !!inferenceContext?.expectedType
);
return { ...typeResult, expectedTypeDiagAddendum };
}
@ -14043,7 +14043,7 @@ export function createTypeEvaluator(
typeErrors = true;
}
if (index < maxEntriesToUseForInference) {
if (hasExpectedType || index < maxEntriesToUseForInference) {
entryTypes.push(entryTypeResult.type);
}