mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-26 10:55:06 +03:00
Fixed bug that results in a spurious reportAbstractUsage
error when an abstract class is captured through a type[T]
. This addresses #7680. (#7681)
This commit is contained in:
parent
92f2284d24
commit
dfe428190c
@ -4267,21 +4267,21 @@ class ApplySolvedTypeVarsTransformer extends TypeVarTransformer {
|
||||
// it represents an instance of a type. If the replacement includes
|
||||
// a generic class that has not been specialized, specialize it
|
||||
// now with default type arguments.
|
||||
if (this._options.unknownIfNotFound) {
|
||||
replacement = mapSubtypes(replacement, (subtype) => {
|
||||
if (isClassInstance(subtype)) {
|
||||
// If the includeSubclasses wasn't set, force it to be set by
|
||||
// converting to/from an instantiable.
|
||||
if (!subtype.includeSubclasses) {
|
||||
subtype = ClassType.cloneAsInstance(ClassType.cloneAsInstantiable(subtype));
|
||||
}
|
||||
|
||||
return specializeWithDefaultTypeArgs(subtype);
|
||||
replacement = mapSubtypes(replacement, (subtype) => {
|
||||
if (isClassInstance(subtype)) {
|
||||
// If the includeSubclasses wasn't set, force it to be set by
|
||||
// converting to/from an instantiable.
|
||||
if (!subtype.includeSubclasses) {
|
||||
subtype = ClassType.cloneAsInstance(ClassType.cloneAsInstantiable(subtype));
|
||||
}
|
||||
|
||||
return subtype;
|
||||
});
|
||||
}
|
||||
if (this._options.unknownIfNotFound) {
|
||||
return specializeWithDefaultTypeArgs(subtype);
|
||||
}
|
||||
}
|
||||
|
||||
return subtype;
|
||||
});
|
||||
}
|
||||
|
||||
if (isTypeVar(replacement) && typeVar.isVariadicUnpacked && replacement.details.isVariadic) {
|
||||
|
Loading…
Reference in New Issue
Block a user