Shortened names of EvalFlags to improve readability. No functional change.

This commit is contained in:
Eric Traut 2024-07-02 13:38:58 -07:00
parent 33a72e3d6a
commit 280ed52e8c
9 changed files with 395 additions and 476 deletions

View File

@ -41,7 +41,7 @@ import { isMatchingExpression, isPartialMatchingExpression, printExpression } fr
import { getPatternSubtypeNarrowingCallback } from './patternMatching';
import { SpeculativeTypeTracker } from './typeCacheUtils';
import { narrowForKeyAssignment } from './typedDicts';
import { EvaluatorFlags, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { EvalFlags, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { getTypeNarrowingCallback } from './typeGuards';
import {
ClassType,
@ -1485,7 +1485,7 @@ export function getCodeFlowEngine(
const classType = evaluator.getTypeOfExpression(
classPatternNode.className,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
).type;
if (isInstantiableClass(classType)) {
@ -1534,12 +1534,12 @@ export function getCodeFlowEngine(
const arg1Expr = testExpression.arguments[1].valueExpression;
const arg1Type = evaluator.getTypeOfExpression(
arg1Expr,
EvaluatorFlags.AllowMissingTypeArgs |
EvaluatorFlags.EvaluateStringLiteralAsType |
EvaluatorFlags.DisallowParamSpec |
EvaluatorFlags.DisallowTypeVarTuple |
EvaluatorFlags.DisallowFinal |
EvaluatorFlags.DoNotSpecialize
EvalFlags.AllowMissingTypeArgs |
EvalFlags.StrLiteralAsType |
EvalFlags.NoParamSpec |
EvalFlags.NoTypeVarTuple |
EvalFlags.NoFinal |
EvalFlags.NoSpecialize
).type;
if (isInstantiableClass(arg1Type)) {
@ -1659,7 +1659,7 @@ export function getCodeFlowEngine(
let subtypeCount = 0;
// Evaluate the call base type.
const callTypeResult = evaluator.getTypeOfExpression(node.leftExpression, EvaluatorFlags.CallBaseDefaults);
const callTypeResult = evaluator.getTypeOfExpression(node.leftExpression, EvalFlags.CallBaseDefaults);
const callType = callTypeResult.type;
doForEachSubtype(callType, (callSubtype) => {

View File

@ -33,7 +33,7 @@ import { getClassFullName, getEnclosingClassOrFunction, getScopeIdForNode, getTy
import { evaluateStaticBoolExpression } from './staticExpressions';
import { Symbol, SymbolFlags } from './symbol';
import { isPrivateName } from './symbolNameUtils';
import { EvaluatorFlags, FunctionArgument, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { EvalFlags, FunctionArgument, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import {
AnyType,
ClassType,
@ -225,7 +225,7 @@ export function synthesizeDataClassMethods(
if (statement.rightExpression.nodeType === ParseNodeType.Call) {
const callTypeResult = evaluator.getTypeOfExpression(
statement.rightExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const callType = callTypeResult.type;
@ -458,7 +458,7 @@ export function synthesizeDataClassMethods(
if (statement.rightExpression.nodeType === ParseNodeType.Call) {
const callType = evaluator.getTypeOfExpression(
statement.rightExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
).type;
if (

View File

@ -33,7 +33,7 @@ import {
createProperty,
validatePropertyMethod,
} from './properties';
import { EvaluatorFlags, FunctionArgument, TypeEvaluator } from './typeEvaluatorTypes';
import { EvalFlags, FunctionArgument, TypeEvaluator } from './typeEvaluatorTypes';
import { isPartlyUnknown, isProperty } from './typeUtils';
import {
ClassType,
@ -85,9 +85,9 @@ export function getFunctionInfoFromDecorators(
for (const decoratorNode of node.decorators) {
// Some stub files (e.g. builtins.pyi) rely on forward declarations of decorators.
let evaluatorFlags = fileInfo.isStubFile ? EvaluatorFlags.AllowForwardReferences : EvaluatorFlags.None;
let evaluatorFlags = fileInfo.isStubFile ? EvalFlags.ForwardRefs : EvalFlags.None;
if (decoratorNode.expression.nodeType !== ParseNodeType.Call) {
evaluatorFlags |= EvaluatorFlags.CallBaseDefaults;
evaluatorFlags |= EvalFlags.CallBaseDefaults;
}
const decoratorTypeResult = evaluator.getTypeOfExpression(decoratorNode.expression, evaluatorFlags);
@ -143,9 +143,9 @@ export function applyFunctionDecorator(
const fileInfo = getFileInfo(decoratorNode);
// Some stub files (e.g. builtins.pyi) rely on forward declarations of decorators.
let evaluatorFlags = fileInfo.isStubFile ? EvaluatorFlags.AllowForwardReferences : EvaluatorFlags.None;
let evaluatorFlags = fileInfo.isStubFile ? EvalFlags.ForwardRefs : EvalFlags.None;
if (decoratorNode.expression.nodeType !== ParseNodeType.Call) {
evaluatorFlags |= EvaluatorFlags.CallBaseDefaults;
evaluatorFlags |= EvalFlags.CallBaseDefaults;
}
const decoratorTypeResult = evaluator.getTypeOfExpression(decoratorNode.expression, evaluatorFlags);
@ -167,7 +167,7 @@ export function applyFunctionDecorator(
if (decoratorNode.expression.nodeType === ParseNodeType.Call) {
const decoratorCallType = evaluator.getTypeOfExpression(
decoratorNode.expression.leftExpression,
evaluatorFlags | EvaluatorFlags.CallBaseDefaults
evaluatorFlags | EvalFlags.CallBaseDefaults
).type;
if (isFunction(decoratorCallType)) {
@ -201,7 +201,7 @@ export function applyFunctionDecorator(
if (decoratorNode.expression.nodeType === ParseNodeType.MemberAccess) {
const baseType = evaluator.getTypeOfExpression(
decoratorNode.expression.leftExpression,
evaluatorFlags | EvaluatorFlags.MemberAccessBaseDefaults
evaluatorFlags | EvalFlags.MemberAccessBaseDefaults
).type;
if (isProperty(baseType)) {
@ -298,16 +298,16 @@ export function applyClassDecorator(
decoratorNode: DecoratorNode
): Type {
const fileInfo = getFileInfo(decoratorNode);
let flags = fileInfo.isStubFile ? EvaluatorFlags.AllowForwardReferences : EvaluatorFlags.None;
let flags = fileInfo.isStubFile ? EvalFlags.ForwardRefs : EvalFlags.None;
if (decoratorNode.expression.nodeType !== ParseNodeType.Call) {
flags |= EvaluatorFlags.CallBaseDefaults;
flags |= EvalFlags.CallBaseDefaults;
}
const decoratorType = evaluator.getTypeOfExpression(decoratorNode.expression, flags).type;
if (decoratorNode.expression.nodeType === ParseNodeType.Call) {
const decoratorCallType = evaluator.getTypeOfExpression(
decoratorNode.expression.leftExpression,
flags | EvaluatorFlags.CallBaseDefaults
flags | EvalFlags.CallBaseDefaults
).type;
if (isFunction(decoratorCallType)) {
@ -367,7 +367,7 @@ export function applyClassDecorator(
callNode = decoratorNode.expression;
const decoratorCallType = evaluator.getTypeOfExpression(
callNode.leftExpression,
flags | EvaluatorFlags.CallBaseDefaults
flags | EvalFlags.CallBaseDefaults
).type;
dataclassBehaviors = getDataclassDecoratorBehaviors(decoratorCallType);
} else {
@ -391,9 +391,9 @@ export function applyClassDecorator(
function getTypeOfDecorator(evaluator: TypeEvaluator, node: DecoratorNode, functionOrClassType: Type): Type {
// Evaluate the type of the decorator expression.
let flags = getFileInfo(node).isStubFile ? EvaluatorFlags.AllowForwardReferences : EvaluatorFlags.None;
let flags = getFileInfo(node).isStubFile ? EvalFlags.ForwardRefs : EvalFlags.None;
if (node.expression.nodeType !== ParseNodeType.Call) {
flags |= EvaluatorFlags.CallBaseDefaults;
flags |= EvalFlags.CallBaseDefaults;
}
const decoratorTypeResult = evaluator.getTypeOfExpression(node.expression, flags);

View File

@ -14,7 +14,7 @@ import { VariableDeclaration } from './declaration';
import { getClassFullName, getEnclosingClass, getTypeSourceId } from './parseTreeUtils';
import { Symbol, SymbolFlags } from './symbol';
import { isPrivateName, isSingleDunderName } from './symbolNameUtils';
import { EvaluatorFlags, FunctionArgument, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { EvalFlags, FunctionArgument, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { enumerateLiteralsForType } from './typeGuards';
import { MemberAccessFlags, computeMroLinearization, lookUpClassMember, makeInferenceContext } from './typeUtils';
import {
@ -369,7 +369,7 @@ export function transformTypeForEnumMember(
let assignedType: Type | undefined;
if (valueTypeExprNode) {
const evalFlags = getFileInfo(valueTypeExprNode).isStubFile ? EvaluatorFlags.ConvertEllipsisToAny : undefined;
const evalFlags = getFileInfo(valueTypeExprNode).isStubFile ? EvalFlags.ConvertEllipsisToAny : undefined;
assignedType = evaluator.getTypeOfExpression(valueTypeExprNode, evalFlags).type;
}

View File

@ -25,7 +25,7 @@ import { getFileInfo } from './analyzerNodeInfo';
import { getEnclosingLambda, isWithinLoop, operatorSupportsChaining, printOperator } from './parseTreeUtils';
import { getScopeForNode } from './scopeUtils';
import { evaluateStaticBoolExpression } from './staticExpressions';
import { EvaluatorFlags, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { EvalFlags, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import {
InferenceContext,
convertToInstantiable,
@ -501,7 +501,7 @@ export function validateBinaryOperation(
export function getTypeOfBinaryOperation(
evaluator: TypeEvaluator,
node: BinaryOperationNode,
flags: EvaluatorFlags,
flags: EvalFlags,
inferenceContext: InferenceContext | undefined
): TypeResult {
const leftExpression = node.leftExpression;
@ -622,7 +622,7 @@ export function getTypeOfBinaryOperation(
const fileInfo = getFileInfo(node);
const unionNotationSupported =
fileInfo.isStubFile ||
(flags & EvaluatorFlags.AllowForwardReferences) !== 0 ||
(flags & EvalFlags.ForwardRefs) !== 0 ||
fileInfo.executionEnvironment.pythonVersion.isGreaterOrEqualTo(pythonVersion3_10);
if (!unionNotationSupported) {
@ -648,12 +648,12 @@ export function getTypeOfBinaryOperation(
adjustedLeftType = evaluator.reportMissingTypeArguments(
node.leftExpression,
adjustedLeftType,
flags | EvaluatorFlags.ExpectingInstantiableType
flags | EvalFlags.InstantiableType
);
adjustedRightType = evaluator.reportMissingTypeArguments(
node.rightExpression,
adjustedRightType,
flags | EvaluatorFlags.ExpectingInstantiableType
flags | EvalFlags.InstantiableType
);
let newUnion = combineTypes([adjustedLeftType, adjustedRightType]);
@ -703,7 +703,7 @@ export function getTypeOfBinaryOperation(
}
}
if ((flags & EvaluatorFlags.ExpectingTypeExpression) !== 0) {
if ((flags & EvalFlags.TypeExpression) !== 0) {
// Exempt "|" because it might be a union operation involving unknowns.
if (node.operator !== OperatorType.BitwiseOr) {
evaluator.addDiagnostic(DiagnosticRule.reportInvalidTypeForm, LocMessage.binaryOperationNotAllowed(), node);
@ -947,10 +947,10 @@ export function getTypeOfAugmentedAssignment(
export function getTypeOfUnaryOperation(
evaluator: TypeEvaluator,
node: UnaryOperationNode,
flags: EvaluatorFlags,
flags: EvalFlags,
inferenceContext: InferenceContext | undefined
): TypeResult {
if ((flags & EvaluatorFlags.ExpectingTypeExpression) !== 0) {
if ((flags & EvalFlags.TypeExpression) !== 0) {
evaluator.addDiagnostic(DiagnosticRule.reportInvalidTypeForm, LocMessage.unaryOperationNotAllowed(), node);
return { type: UnknownType.create() };
}
@ -1082,12 +1082,12 @@ export function getTypeOfUnaryOperation(
export function getTypeOfTernaryOperation(
evaluator: TypeEvaluator,
node: TernaryNode,
flags: EvaluatorFlags,
flags: EvalFlags,
inferenceContext: InferenceContext | undefined
): TypeResult {
const fileInfo = getFileInfo(node);
if ((flags & EvaluatorFlags.ExpectingTypeExpression) !== 0) {
if ((flags & EvalFlags.TypeExpression) !== 0) {
evaluator.addDiagnostic(DiagnosticRule.reportInvalidTypeForm, LocMessage.ternaryNotAllowed(), node);
return { type: UnknownType.create() };
}

View File

@ -31,7 +31,7 @@ import {
import { CodeFlowReferenceExpressionNode } from './codeFlowTypes';
import { addConstraintsForExpectedType } from './constraintSolver';
import { getTypeVarScopesForNode, isMatchingExpression } from './parseTreeUtils';
import { EvaluatorFlags, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import { EvalFlags, TypeEvaluator, TypeResult } from './typeEvaluatorTypes';
import {
enumerateLiteralsForType,
narrowTypeForDiscriminatedDictEntryComparison,
@ -679,7 +679,7 @@ function narrowTypeBasedOnClassPattern(
pattern: PatternClassNode,
isPositiveTest: boolean
): Type {
let exprType = evaluator.getTypeOfExpression(pattern.className, EvaluatorFlags.CallBaseDefaults).type;
let exprType = evaluator.getTypeOfExpression(pattern.className, EvalFlags.CallBaseDefaults).type;
// If this is a class (but not a type alias that refers to a class),
// specialize it with Unknown type arguments.
@ -1829,7 +1829,7 @@ function wrapTypeInList(evaluator: TypeEvaluator, node: ParseNode, type: Type):
}
export function validateClassPattern(evaluator: TypeEvaluator, pattern: PatternClassNode) {
let exprType = evaluator.getTypeOfExpression(pattern.className, EvaluatorFlags.CallBaseDefaults).type;
let exprType = evaluator.getTypeOfExpression(pattern.className, EvalFlags.CallBaseDefaults).type;
// If the expression is a type alias or other special form, treat it
// as the special form rather than the class.
@ -1931,7 +1931,7 @@ export function getPatternSubtypeNarrowingCallback(
if (ClassType.isBuiltIn(indexType, ['int', 'str'])) {
const unnarrowedReferenceTypeResult = evaluator.getTypeOfExpression(
subjectExpression.baseExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const unnarrowedReferenceType = unnarrowedReferenceTypeResult.type;
@ -2027,7 +2027,7 @@ export function getPatternSubtypeNarrowingCallback(
) {
const unnarrowedReferenceTypeResult = evaluator.getTypeOfExpression(
subjectExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const unnarrowedReferenceType = unnarrowedReferenceTypeResult.type;

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,7 @@ import {
// a list) before the type is considered an "Any".
export const maxSubtypesForInferredType = 64;
export const enum EvaluatorFlags {
export const enum EvalFlags {
None = 0,
// Interpret an ellipsis type annotation to mean "Any".
@ -65,106 +65,107 @@ export const enum EvaluatorFlags {
// Normally a generic named type is specialized with "Any"
// types. This flag indicates that specialization shouldn't take
// place.
DoNotSpecialize = 1 << 1,
NoSpecialize = 1 << 1,
// Allow forward references. Don't report unbound errors.
AllowForwardReferences = 1 << 2,
ForwardRefs = 1 << 2,
// Treat string literal as a type.
EvaluateStringLiteralAsType = 1 << 3,
StrLiteralAsType = 1 << 3,
// 'Final' is not allowed in this context.
DisallowFinal = 1 << 4,
NoFinal = 1 << 4,
// A ParamSpec isn't allowed in this context.
DisallowParamSpec = 1 << 5,
NoParamSpec = 1 << 5,
// A TypeVarTuple isn't allowed in this context.
DisallowTypeVarTuple = 1 << 6,
NoTypeVarTuple = 1 << 6,
// Expression is expected to be an instantiable type rather
// than an instance (object)
ExpectingInstantiableType = 1 << 7,
InstantiableType = 1 << 7,
// A type expression imposes grammatical and semantic limits on an
// expression. If this flag is set, illegal type expressions are
// flagged as errors.
ExpectingTypeExpression = 1 << 8,
TypeExpression = 1 << 8,
// Suppress the reportMissingTypeArgument diagnostic in this context.
AllowMissingTypeArgs = 1 << 9,
// The Generic class type is allowed in this context. It is
// normally not allowed if ExpectingType is set.
AllowGenericClassType = 1 << 10,
AllowGeneric = 1 << 10,
// TypeVars within this expression must not refer to type vars
// used in an outer scope.
DisallowTypeVarsWithScopeId = 1 << 11,
NoTypeVarWithScopeId = 1 << 11,
// TypeVars within this expression do not need to refer to type vars
// used in an outer scope.
AllowTypeVarsWithoutScopeId = 1 << 12,
AllowTypeVarWithoutScopeId = 1 << 12,
// TypeVars within this expression that are otherwise not
// associated with an outer scope should be associated with
// the containing function's scope.
AssociateTypeVarsWithCurrentScope = 1 << 13,
TypeVarGetsCurScope = 1 << 13,
// When a new class-scoped TypeVar is used within a class
// declaration, make sure that it is not used to parameterize
// a base class whose TypeVar variance is inconsistent.
EnforceTypeVarVarianceConsistency = 1 << 14,
EnforceVarianceConsistency = 1 << 14,
// Used for PEP 526-style variable type annotations
VariableTypeAnnotation = 1 << 15,
VarTypeAnnotation = 1 << 15,
// 'ClassVar' is not allowed in this context.
DisallowClassVar = 1 << 17,
NoClassVar = 1 << 17,
// 'Generic' cannot be used without type arguments in this context.
DisallowNakedGeneric = 1 << 18,
NoNakedGeneric = 1 << 18,
// The node is not parsed by the interpreter because it is within
// a comment or a string literal.
NotParsedByInterpreter = 1 << 19,
NotParsed = 1 << 19,
// Required and NotRequired are allowed in this context.
AllowRequired = 1 << 20,
// Allow Unpack annotation for a tuple or TypeVarTuple.
AllowUnpackedTupleOrTypeVarTuple = 1 << 21,
AllowUnpackedTuple = 1 << 21,
// Allow Unpack annotation for TypedDict.
AllowUnpackedTypedDict = 1 << 22,
// Even though an expression is enclosed in a string literal,
// the interpreter (within a source file, not a stub) still
// parses the expression and generates parse errors.
InterpreterParsesStringLiteral = 1 << 22,
// Allow Unpack annotation for TypedDict.
AllowUnpackedTypedDict = 1 << 23,
ParsesStringLiteral = 1 << 23,
// Do not convert special forms to their corresponding runtime
// objects even when expecting a type expression.
SkipConvertSpecialFormToRuntimeObject = 1 << 25,
NoConvertSpecialForm = 1 << 25,
// Protocol and TypedDict are not allowed in this context.
DisallowNonTypeSpecialForms = 1 << 26,
// Certain special forms (Protocol, TypedDict, etc.) are not allowed
// in this context.
NoNonTypeSpecialForms = 1 << 26,
// Allow use of the Concatenate special form.
AllowConcatenate = 1 << 27,
// Do not infer literal types within a tuple (used for tuples nested within
// other container classes).
StripLiteralTypeForTuple = 1 << 28,
StripTupleLiterals = 1 << 28,
// Defaults used for evaluating the LHS of a call expression.
CallBaseDefaults = DoNotSpecialize,
CallBaseDefaults = NoSpecialize,
// Defaults used for evaluating the LHS of a member access expression.
IndexBaseDefaults = DoNotSpecialize,
IndexBaseDefaults = NoSpecialize,
// Defaults used for evaluating the LHS of a member access expression.
MemberAccessBaseDefaults = DoNotSpecialize,
MemberAccessBaseDefaults = NoSpecialize,
}
export interface TypeResult<T extends Type = Type> {
@ -470,7 +471,7 @@ export interface TypeEvaluator {
getTypeResult: (node: ExpressionNode) => TypeResult | undefined;
getTypeResultForDecorator: (node: DecoratorNode) => TypeResult | undefined;
getCachedType: (node: ExpressionNode) => Type | undefined;
getTypeOfExpression: (node: ExpressionNode, flags?: EvaluatorFlags, context?: InferenceContext) => TypeResult;
getTypeOfExpression: (node: ExpressionNode, flags?: EvalFlags, context?: InferenceContext) => TypeResult;
getTypeOfAnnotation: (node: ExpressionNode, options?: AnnotationTypeOptions) => Type;
getTypeOfClass: (node: ClassNode) => ClassTypeResult | undefined;
getTypeOfFunction: (node: FunctionNode) => FunctionTypeResult | undefined;
@ -648,7 +649,7 @@ export interface TypeEvaluator {
flags: AssignTypeFlags,
recursionCount: number
) => boolean;
reportMissingTypeArguments: (node: ExpressionNode, type: Type, flags: EvaluatorFlags) => Type;
reportMissingTypeArguments: (node: ExpressionNode, type: Type, flags: EvalFlags) => Type;
isFinalVariable: (symbol: Symbol) => boolean;
isFinalVariableDeclaration: (decl: Declaration) => boolean;
@ -680,7 +681,7 @@ export interface TypeEvaluator {
disposeEvaluator: () => void;
useSpeculativeMode: <T>(speculativeNode: ParseNode | undefined, callback: () => T) => T;
isSpeculativeModeInUse: (node: ParseNode | undefined) => boolean;
setTypeResultForNode: (node: ParseNode, typeResult: TypeResult, flags?: EvaluatorFlags) => void;
setTypeResultForNode: (node: ParseNode, typeResult: TypeResult, flags?: EvalFlags) => void;
checkForCancellation: () => void;
printControlFlowGraph: (

View File

@ -30,7 +30,7 @@ import { ScopeType } from './scope';
import { getScopeForNode } from './scopeUtils';
import { Symbol, SymbolFlags } from './symbol';
import { getTypedDictMembersForClass } from './typedDicts';
import { EvaluatorFlags, TypeEvaluator } from './typeEvaluatorTypes';
import { EvalFlags, TypeEvaluator } from './typeEvaluatorTypes';
import {
ClassType,
ClassTypeFlags,
@ -219,7 +219,7 @@ export function getTypeNarrowingCallback(
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
const callType = evaluator.getTypeOfExpression(
testExpression.leftExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
).type;
if (isInstantiableClass(callType) && ClassType.isBuiltIn(callType, 'type')) {
@ -512,7 +512,7 @@ export function getTypeNarrowingCallback(
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
const callTypeResult = evaluator.getTypeOfExpression(
testExpression.leftExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const callType = callTypeResult.type;
@ -618,7 +618,7 @@ export function getTypeNarrowingCallback(
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
const callTypeResult = evaluator.getTypeOfExpression(
testExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const callType = callTypeResult.type;
@ -629,12 +629,12 @@ export function getTypeNarrowingCallback(
const isInstanceCheck = callType.details.builtInName === 'isinstance';
const arg1TypeResult = evaluator.getTypeOfExpression(
arg1Expr,
EvaluatorFlags.AllowMissingTypeArgs |
EvaluatorFlags.EvaluateStringLiteralAsType |
EvaluatorFlags.DisallowParamSpec |
EvaluatorFlags.DisallowTypeVarTuple |
EvaluatorFlags.DisallowFinal |
EvaluatorFlags.DoNotSpecialize
EvalFlags.AllowMissingTypeArgs |
EvalFlags.StrLiteralAsType |
EvalFlags.NoParamSpec |
EvalFlags.NoTypeVarTuple |
EvalFlags.NoFinal |
EvalFlags.NoSpecialize
);
const arg1Type = arg1TypeResult.type;
@ -676,7 +676,7 @@ export function getTypeNarrowingCallback(
if (ParseTreeUtils.isMatchingExpression(reference, arg0Expr)) {
const callTypeResult = evaluator.getTypeOfExpression(
testExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const callType = callTypeResult.type;
@ -711,7 +711,7 @@ export function getTypeNarrowingCallback(
if (ParseTreeUtils.isMatchingExpression(reference, testExpression.arguments[0].valueExpression)) {
const callTypeResult = evaluator.getTypeOfExpression(
testExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const callType = callTypeResult.type;
@ -743,7 +743,7 @@ export function getTypeNarrowingCallback(
const callTypeResult = evaluator.getTypeOfExpression(
testExpression.leftExpression,
EvaluatorFlags.CallBaseDefaults
EvalFlags.CallBaseDefaults
);
const callType = callTypeResult.type;