Fixed bug that results in a crash in very specific circumstances that involve binding a method parameterized by a function-scoped ParamSpec. This addresses #8823. (#8824)

This commit is contained in:
Eric Traut 2024-08-23 19:31:04 -07:00 committed by GitHub
parent 020dea1381
commit acc52c7420
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26700,9 +26700,18 @@ export function createTypeEvaluator(
// evaluating (and caching) the inferred return type if there is no defined return type.
getEffectiveReturnType(memberType);
const specializedFunction = solveAndApplyConstraints(memberType, constraints) as FunctionType;
const specializedFunction = solveAndApplyConstraints(memberType, constraints);
if (isFunction(specializedFunction)) {
return FunctionType.clone(specializedFunction, stripFirstParam, baseType);
}
return FunctionType.clone(specializedFunction, stripFirstParam, baseType);
if (isOverloaded(specializedFunction)) {
// For overloaded functions, use the first overload. This isn't
// strictly correct, but this is an extreme edge case.
return FunctionType.clone(OverloadedType.getOverloads(specializedFunction)[0], stripFirstParam, baseType);
}
return undefined;
}
function isFinalVariable(symbol: Symbol): boolean {