Added support for call-site return type inference for class and instance methods. This addresses https://github.com/microsoft/pylance-release/issues/5515. (#7335)

This commit is contained in:
Eric Traut 2024-02-25 14:50:28 -07:00 committed by GitHub
parent 3232c25589
commit f7e37d51b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21435,7 +21435,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
inferTypeIfNeeded = true
) {
const specializedReturnType = FunctionType.getSpecializedReturnType(type, /* includeInferred */ false);
if (specializedReturnType) {
if (specializedReturnType && !isUnknown(specializedReturnType)) {
return adjustCallableReturnType(specializedReturnType, /* trackedSignatures */ undefined);
}