mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 07:55:56 +03:00
Simplified isinstance code. No functional change.
This commit is contained in:
parent
7724fce513
commit
7d146aad07
@ -3918,8 +3918,7 @@ export class Checker extends ParseTreeWalker {
|
||||
varType,
|
||||
filterType,
|
||||
filterType,
|
||||
isInstanceCheck,
|
||||
/* isTypeIsCheck */ false
|
||||
isInstanceCheck
|
||||
);
|
||||
const filterIsSubclass = isIsinstanceFilterSubclass(
|
||||
this._evaluator,
|
||||
|
@ -1211,8 +1211,7 @@ export function isIsinstanceFilterSuperclass(
|
||||
concreteVarType: ClassType,
|
||||
filterType: Type,
|
||||
concreteFilterType: ClassType,
|
||||
isInstanceCheck: boolean,
|
||||
isTypeIsCheck: boolean
|
||||
isInstanceCheck: boolean
|
||||
) {
|
||||
if (isTypeVar(filterType) || concreteFilterType.literalValue !== undefined) {
|
||||
return isTypeSame(convertToInstance(filterType), varType);
|
||||
@ -1221,7 +1220,7 @@ export function isIsinstanceFilterSuperclass(
|
||||
// If the filter type represents all possible subclasses
|
||||
// of a type, we can't make any statements about its superclass
|
||||
// relationship with concreteVarType.
|
||||
if (!isTypeIsCheck && concreteFilterType.includeSubclasses) {
|
||||
if (concreteFilterType.includeSubclasses) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1370,8 +1369,7 @@ function narrowTypeForIsInstanceInternal(
|
||||
concreteVarType,
|
||||
filterType,
|
||||
concreteFilterType,
|
||||
isInstanceCheck,
|
||||
isTypeIsCheck
|
||||
isInstanceCheck
|
||||
);
|
||||
filterIsSubclass = isIsinstanceFilterSubclass(
|
||||
evaluator,
|
||||
@ -2485,8 +2483,7 @@ function narrowTypeForClassComparison(
|
||||
concreteSubtype,
|
||||
classType,
|
||||
classType,
|
||||
/* isInstanceCheck */ false,
|
||||
/* isTypeIsCheck */ false
|
||||
/* isInstanceCheck */ false
|
||||
)
|
||||
) {
|
||||
return undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user