mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 16:06:39 +03:00
Removed redundant check.
This commit is contained in:
parent
29f1b15cb7
commit
977db37df2
@ -19740,8 +19740,6 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
}
|
||||
}
|
||||
|
||||
// If we're using ReverseTypeVarMatching and the source is a TypeVar,
|
||||
// the logic below will handle this case.
|
||||
if ((flags & CanAssignFlags.ReverseTypeVarMatching) === 0 || !isTypeVar(srcType)) {
|
||||
if (
|
||||
!canAssignTypeToTypeVar(
|
||||
@ -20938,8 +20936,6 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
return false;
|
||||
}
|
||||
|
||||
// We may need to reverse the type var mapping to populate the type
|
||||
// var map of the
|
||||
let specializedSrcType = srcType;
|
||||
let specializedDestType = destType;
|
||||
let reverseMatchingFailed = false;
|
||||
@ -20966,18 +20962,16 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
specializedSrcType = applySolvedTypeVars(srcType, srcTypeVarContext);
|
||||
|
||||
if (requiresSpecialization(specializedSrcType)) {
|
||||
if (requiresSpecialization(specializedSrcType)) {
|
||||
reverseMatchingFailed = !canAssignType(
|
||||
specializedSrcType,
|
||||
specializedDestType,
|
||||
/* diag */ undefined,
|
||||
srcTypeVarContext,
|
||||
(flags & ~CanAssignFlags.ReverseTypeVarMatching) | CanAssignFlags.IgnoreTypeVarScope,
|
||||
recursionCount
|
||||
);
|
||||
reverseMatchingFailed = !canAssignType(
|
||||
specializedSrcType,
|
||||
specializedDestType,
|
||||
/* diag */ undefined,
|
||||
srcTypeVarContext,
|
||||
(flags & ~CanAssignFlags.ReverseTypeVarMatching) | CanAssignFlags.IgnoreTypeVarScope,
|
||||
recursionCount
|
||||
);
|
||||
|
||||
specializedSrcType = applySolvedTypeVars(srcType, srcTypeVarContext);
|
||||
}
|
||||
specializedSrcType = applySolvedTypeVars(srcType, srcTypeVarContext);
|
||||
}
|
||||
|
||||
if (reverseMatchingFailed) {
|
||||
|
@ -128,7 +128,8 @@ export function createTypeEvaluatorWithTracker(
|
||||
run('getCallSignatureInfo', () => typeEvaluator.getCallSignatureInfo(n, i, a), n),
|
||||
getAbstractMethods: (c) => run('getAbstractMethods', () => typeEvaluator.getAbstractMethods(c), c),
|
||||
narrowConstrainedTypeVar: typeEvaluator.narrowConstrainedTypeVar,
|
||||
canAssignType: (d, s, a, m, f) => run('canAssignType', () => typeEvaluator.canAssignType(d, s, a, m, f), d),
|
||||
canAssignType: (d, s, a, c, f, r) =>
|
||||
run('canAssignType', () => typeEvaluator.canAssignType(d, s, a, c, f, r), d),
|
||||
canOverrideMethod: (b, o, d, e) =>
|
||||
run('canOverrideMethod', () => typeEvaluator.canOverrideMethod(b, o, d, e), o),
|
||||
assignTypeToExpression: typeEvaluator.assignTypeToExpression,
|
||||
|
Loading…
Reference in New Issue
Block a user