Fixed regression relating to type inference for non-generic classes that have unannotated constructors (so-called "pseudo-generic classes").

This commit is contained in:
Eric Traut 2021-11-17 23:03:51 -08:00
parent 15d6cb74ce
commit bda1e0b822
2 changed files with 2 additions and 4 deletions

View File

@ -11333,7 +11333,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
// A ClassVar should not allow TypeVars or generic types parameterized
// by TypeVars.
if (requiresSpecialization(type)) {
if (requiresSpecialization(type, /* ignorePseudoGeneric */ true)) {
const fileInfo = AnalyzerNodeInfo.getFileInfo(errorNode);
addDiagnostic(

View File

@ -2468,9 +2468,7 @@ export function requiresSpecialization(type: Type, ignorePseudoGeneric = false,
);
}
// If there are any type parameters, we need to specialize
// since there are no corresponding type arguments.
return !ClassType.isPseudoGenericClass(type) && ClassType.getTypeParameters(type).length > 0;
return ClassType.getTypeParameters(type).length > 0;
}
case TypeCategory.Function: {