@zzzen/pyright-internal 1.2.0-dev.20231217 → 1.2.0-dev.20231224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/analyzer/binder.js +10 -7
  2. package/dist/analyzer/binder.js.map +1 -1
  3. package/dist/analyzer/codeFlowEngine.js +7 -2
  4. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  5. package/dist/analyzer/operations.d.ts +1 -1
  6. package/dist/analyzer/operations.js +16 -1
  7. package/dist/analyzer/operations.js.map +1 -1
  8. package/dist/analyzer/packageTypeVerifier.d.ts +5 -1
  9. package/dist/analyzer/packageTypeVerifier.js +58 -40
  10. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  11. package/dist/analyzer/parameterUtils.js +1 -1
  12. package/dist/analyzer/parameterUtils.js.map +1 -1
  13. package/dist/analyzer/protocols.js +18 -6
  14. package/dist/analyzer/protocols.js.map +1 -1
  15. package/dist/analyzer/typeEvaluator.js +57 -70
  16. package/dist/analyzer/typeEvaluator.js.map +1 -1
  17. package/dist/analyzer/typeEvaluatorTypes.d.ts +4 -4
  18. package/dist/analyzer/typeGuards.js +7 -6
  19. package/dist/analyzer/typeGuards.js.map +1 -1
  20. package/dist/analyzer/typeUtils.d.ts +1 -1
  21. package/dist/analyzer/typeUtils.js +11 -4
  22. package/dist/analyzer/typeUtils.js.map +1 -1
  23. package/dist/analyzer/typeVarContext.d.ts +0 -1
  24. package/dist/analyzer/typeVarContext.js +4 -5
  25. package/dist/analyzer/typeVarContext.js.map +1 -1
  26. package/dist/analyzer/types.d.ts +2 -2
  27. package/dist/analyzer/types.js +7 -6
  28. package/dist/analyzer/types.js.map +1 -1
  29. package/dist/common/uri/webUri.js +1 -25
  30. package/dist/common/uri/webUri.js.map +1 -1
  31. package/dist/languageService/documentSymbolCollector.js +1 -1
  32. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  33. package/dist/localization/localize.d.ts +3 -0
  34. package/dist/localization/localize.js +3 -0
  35. package/dist/localization/localize.js.map +1 -1
  36. package/dist/localization/package.nls.en-us.json +3 -0
  37. package/dist/pyright.js +7 -4
  38. package/dist/pyright.js.map +1 -1
  39. package/dist/tests/fourslash/fourslash.d.ts +1 -0
  40. package/dist/tests/fourslash/fourslash.js +2 -2
  41. package/dist/tests/fourslash/rename.parens.fourslash.d.ts +1 -0
  42. package/dist/tests/fourslash/rename.parens.fourslash.js +20 -0
  43. package/dist/tests/fourslash/rename.parens.fourslash.js.map +1 -0
  44. package/dist/tests/fourslash/typeVerifier.fourslash.d.ts +1 -0
  45. package/dist/tests/fourslash/typeVerifier.fourslash.js +47 -0
  46. package/dist/tests/fourslash/typeVerifier.fourslash.js.map +1 -0
  47. package/dist/tests/harness/fourslash/testState.d.ts +2 -0
  48. package/dist/tests/harness/fourslash/testState.js +16 -0
  49. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  50. package/dist/tests/typeEvaluator1.test.js +1 -1
  51. package/dist/tests/typeEvaluator2.test.js +4 -0
  52. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  53. package/dist/tests/typeEvaluator3.test.js +4 -0
  54. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  55. package/dist/tests/typeEvaluator4.test.js +4 -0
  56. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  57. package/dist/tests/uri.test.js +4 -0
  58. package/dist/tests/uri.test.js.map +1 -1
  59. package/package.json +1 -1
@@ -568,7 +568,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
568
568
  break;
569
569
  }
570
570
  case 55 /* ParseNodeType.UnaryOperation */: {
571
- typeResult = (0, operations_1.getTypeOfUnaryOperation)(evaluatorInterface, node, inferenceContext);
571
+ typeResult = (0, operations_1.getTypeOfUnaryOperation)(evaluatorInterface, node, flags, inferenceContext);
572
572
  break;
573
573
  }
574
574
  case 7 /* ParseNodeType.BinaryOperation */: {
@@ -1333,7 +1333,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
1333
1333
  !types_1.ClassType.isBuiltIn(metaclass, 'type') &&
1334
1334
  !types_1.ClassType.isSameGenericClass(metaclass, objectType)) {
1335
1335
  const descMemberInfo = getTypeOfClassMemberName(errorNode, metaclass, memberName, usage,
1336
- /* diag */ undefined, flags | 512 /* MemberAccessFlags.SkipAttributeAccessOverride */, objectType);
1336
+ /* diag */ undefined, flags | 512 /* MemberAccessFlags.SkipAttributeAccessOverride */, objectType, recursionCount);
1337
1337
  if (descMemberInfo) {
1338
1338
  const isProperty = (0, types_1.isClassInstance)(descMemberInfo.type) && types_1.ClassType.isPropertyClass(descMemberInfo.type);
1339
1339
  if ((0, typeUtils_1.isDescriptorInstance)(descMemberInfo.type, /* requireSetter */ true) || isProperty) {
@@ -1353,7 +1353,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
1353
1353
  }
1354
1354
  subDiag = diag ? new diagnostic_1.DiagnosticAddendum() : undefined;
1355
1355
  // See if the member is present in the object itself.
1356
- memberInfo = getTypeOfClassMemberName(errorNode, objectType, memberName, usage, subDiag, effectiveFlags, selfType);
1356
+ memberInfo = getTypeOfClassMemberName(errorNode, objectType, memberName, usage, subDiag, effectiveFlags, selfType, recursionCount);
1357
1357
  }
1358
1358
  // If it wasn't found on the object, see if it's part of the metaclass.
1359
1359
  if (!memberInfo && metaclass && (0, types_1.isInstantiableClass)(metaclass)) {
@@ -2350,7 +2350,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2350
2350
  // Is this subtype a tuple?
2351
2351
  const tupleType = (0, typeUtils_1.getSpecializedTupleType)(subtype);
2352
2352
  if (tupleType && tupleType.tupleTypeArguments) {
2353
- const sourceEntryTypes = tupleType.tupleTypeArguments.map((t) => (0, typeUtils_1.addConditionToType)(t.type, (0, typeUtils_1.getTypeCondition)(subtype)));
2353
+ const sourceEntryTypes = tupleType.tupleTypeArguments.map((t) => (0, typeUtils_1.addConditionToType)(t.type, (0, typeUtils_1.getTypeCondition)(subtype), /* skipSelfCondition */ true));
2354
2354
  const unboundedIndex = tupleType.tupleTypeArguments.findIndex((t) => t.isUnbounded);
2355
2355
  if (unboundedIndex >= 0) {
2356
2356
  if (sourceEntryTypes.length < targetTypes.length) {
@@ -2503,7 +2503,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2503
2503
  }
2504
2504
  return subtype;
2505
2505
  }
2506
- if ((0, types_1.isTypeVar)(subtype) && !subtype.details.recursiveTypeAliasName) {
2506
+ if ((0, types_1.isTypeVar)(subtype)) {
2507
2507
  // If this is a recursive type alias placeholder
2508
2508
  // that hasn't yet been resolved, return it as is.
2509
2509
  if (subtype.details.recursiveTypeAliasName) {
@@ -2516,7 +2516,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2516
2516
  subtype.details.constraints.forEach((constraintType, constraintIndex) => {
2517
2517
  if (conditionFilter) {
2518
2518
  const typeVarName = types_1.TypeVarType.getNameWithScope(subtype);
2519
- const applicableConstraint = conditionFilter.find((filter) => filter.typeVarName === typeVarName);
2519
+ const applicableConstraint = conditionFilter.find((filter) => filter.typeVar.nameWithScope === typeVarName);
2520
2520
  // If this type variable is being constrained to a single index,
2521
2521
  // don't include the other indices.
2522
2522
  if (applicableConstraint && applicableConstraint.constraintIndex !== constraintIndex) {
@@ -2526,13 +2526,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2526
2526
  if (types_1.TypeBase.isInstantiable(subtype)) {
2527
2527
  constraintType = (0, typeUtils_1.convertToInstantiable)(constraintType);
2528
2528
  }
2529
- typesToCombine.push((0, typeUtils_1.addConditionToType)(constraintType, [
2530
- {
2531
- typeVarName: types_1.TypeVarType.getNameWithScope(subtype),
2532
- constraintIndex,
2533
- isConstrainedTypeVar: true,
2534
- },
2535
- ]));
2529
+ typesToCombine.push((0, typeUtils_1.addConditionToType)(constraintType, [{ typeVar: subtype, constraintIndex }]));
2536
2530
  });
2537
2531
  return (0, types_1.combineTypes)(typesToCombine);
2538
2532
  }
@@ -2542,17 +2536,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2542
2536
  // Fall back to a bound of "object" if no bound is provided.
2543
2537
  let boundType = (_b = (_a = subtype.details.boundType) !== null && _a !== void 0 ? _a : objectType) !== null && _b !== void 0 ? _b : types_1.UnknownType.create();
2544
2538
  boundType = types_1.TypeBase.isInstantiable(subtype) ? (0, typeUtils_1.convertToInstantiable)(boundType) : boundType;
2545
- // Handle Self and type[Self] specially.
2546
- if (subtype.details.isSynthesizedSelf && (0, types_1.isClass)(boundType)) {
2547
- return types_1.ClassType.cloneIncludeSubclasses(boundType);
2548
- }
2549
- return (0, typeUtils_1.addConditionToType)(boundType, [
2550
- {
2551
- typeVarName: types_1.TypeVarType.getNameWithScope(subtype),
2552
- constraintIndex: 0,
2553
- isConstrainedTypeVar: false,
2554
- },
2555
- ]);
2539
+ return (0, typeUtils_1.addConditionToType)(boundType, [{ typeVar: subtype, constraintIndex: 0 }]);
2556
2540
  }
2557
2541
  return subtype;
2558
2542
  });
@@ -2584,7 +2568,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2584
2568
  }
2585
2569
  if (transformedType) {
2586
2570
  // Apply the type condition if it's associated with a constrained TypeVar.
2587
- const typeCondition = (_a = (0, typeUtils_1.getTypeCondition)(subtype)) === null || _a === void 0 ? void 0 : _a.filter((condition) => condition.isConstrainedTypeVar);
2571
+ const typeCondition = (_a = (0, typeUtils_1.getTypeCondition)(subtype)) === null || _a === void 0 ? void 0 : _a.filter((condition) => condition.typeVar.details.constraints.length > 0);
2588
2572
  if (typeCondition && typeCondition.length > 0) {
2589
2573
  transformedType = (0, typeUtils_1.addConditionToType)(transformedType, typeCondition);
2590
2574
  }
@@ -3582,7 +3566,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3582
3566
  const typeResult = (_a = (0, enums_1.getTypeOfEnumMember)(evaluatorInterface, node, baseType, memberName, isIncomplete)) !== null && _a !== void 0 ? _a : getTypeOfBoundMember(node.memberName, baseType, memberName, usage, diag,
3583
3567
  /* memberAccessFlags */ undefined, baseTypeResult.bindToSelfType);
3584
3568
  if (typeResult) {
3585
- type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType));
3569
+ type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType),
3570
+ /* skipSelfCondition */ true);
3586
3571
  }
3587
3572
  if (typeResult === null || typeResult === void 0 ? void 0 : typeResult.isIncomplete) {
3588
3573
  isIncomplete = true;
@@ -7979,11 +7964,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7979
7964
  !arg0Type.details.isParamSpec &&
7980
7965
  arg0Type.details.constraints.length === 0) {
7981
7966
  typeGuardType = (0, typeUtils_1.addConditionToType)(typeGuardType, [
7982
- {
7983
- typeVarName: types_1.TypeVarType.getNameWithScope(arg0Type),
7984
- constraintIndex: 0,
7985
- isConstrainedTypeVar: false,
7986
- },
7967
+ { typeVar: arg0Type, constraintIndex: 0 },
7987
7968
  ]);
7988
7969
  }
7989
7970
  }
@@ -15009,30 +14990,32 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15009
14990
  }
15010
14991
  // Returns the type of the symbol. If the type is explicitly declared, that type
15011
14992
  // is returned. If not, the type is inferred from assignments to the symbol. All
15012
- // assigned types are evaluated and combined into a union. If a "usageNode"
15013
- // node is specified, only declarations that are outside of the current execution
15014
- // scope or that are reachable (as determined by code flow analysis) are considered.
15015
- // This helps in cases where there are cyclical dependencies between symbols.
14993
+ // assigned types are evaluated and combined into a union.
15016
14994
  function getEffectiveTypeOfSymbol(symbol) {
15017
14995
  return getEffectiveTypeOfSymbolForUsage(symbol).type;
15018
14996
  }
14997
+ // If a "usageNode" node is specified, only declarations that are outside
14998
+ // of the current execution scope or that are reachable (as determined by
14999
+ // code flow analysis) are considered. This helps in cases where there
15000
+ // are cyclical dependencies between symbols.
15019
15001
  function getEffectiveTypeOfSymbolForUsage(symbol, usageNode, useLastDecl = false) {
15020
15002
  let declaredTypeInfo;
15021
15003
  // If there's a declared type, it takes precedence over inferred types.
15022
15004
  if (symbol.hasTypedDeclarations()) {
15023
15005
  declaredTypeInfo = getDeclaredTypeOfSymbol(symbol, usageNode);
15024
15006
  const declaredType = declaredTypeInfo === null || declaredTypeInfo === void 0 ? void 0 : declaredTypeInfo.type;
15025
- const hasMetadata = !!declaredTypeInfo.isTypeAlias;
15026
- if (declaredType || !hasMetadata) {
15027
- let isIncomplete = false;
15028
- if (declaredType) {
15029
- if ((0, types_1.isFunction)(declaredType) && types_1.FunctionType.isPartiallyEvaluated(declaredType)) {
15030
- isIncomplete = true;
15031
- }
15032
- else if ((0, types_1.isClass)(declaredType) && types_1.ClassType.isPartiallyEvaluated(declaredType)) {
15033
- isIncomplete = true;
15034
- }
15007
+ let isIncomplete = false;
15008
+ if (declaredType) {
15009
+ if ((0, types_1.isFunction)(declaredType) && types_1.FunctionType.isPartiallyEvaluated(declaredType)) {
15010
+ isIncomplete = true;
15035
15011
  }
15012
+ else if ((0, types_1.isClass)(declaredType) && types_1.ClassType.isPartiallyEvaluated(declaredType)) {
15013
+ isIncomplete = true;
15014
+ }
15015
+ }
15016
+ // If the "declared" type uses a "TypeAlias" type annotation, then
15017
+ // we need to use the inferred type path to evaluate its type.
15018
+ if (declaredType || !declaredTypeInfo.isTypeAlias) {
15036
15019
  const typedDecls = symbol.getTypedDeclarations();
15037
15020
  const result = {
15038
15021
  type: declaredType !== null && declaredType !== void 0 ? declaredType : types_1.UnknownType.create(),
@@ -15045,6 +15028,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15045
15028
  return result;
15046
15029
  }
15047
15030
  }
15031
+ return inferTypeOfSymbolForUsage(symbol, usageNode, useLastDecl);
15032
+ }
15033
+ function inferTypeOfSymbolForUsage(symbol, usageNode, useLastDecl = false) {
15048
15034
  // Look in the inferred type cache to see if we've computed this already.
15049
15035
  let cacheEntries = effectiveTypeCache.get(symbol.id);
15050
15036
  const usageNodeId = usageNode ? usageNode.id : undefined;
@@ -15092,9 +15078,25 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15092
15078
  }
15093
15079
  // Determine which declarations to use for inference.
15094
15080
  const declsToConsider = [];
15081
+ let includesVariableDecl = false;
15082
+ let includesIllegalTypeAliasDecl = false;
15095
15083
  let sawExplicitTypeAlias = false;
15096
15084
  decls.forEach((decl, index) => {
15097
15085
  var _a, _b, _c;
15086
+ const resolvedDecl = (_a = resolveAliasDeclaration(decl, /* resolveLocalNames */ true, {
15087
+ allowExternallyHiddenAccess: AnalyzerNodeInfo.getFileInfo(decl.node).isStubFile,
15088
+ })) !== null && _a !== void 0 ? _a : decl;
15089
+ if (!isPossibleTypeAliasDeclaration(resolvedDecl)) {
15090
+ includesIllegalTypeAliasDecl = true;
15091
+ }
15092
+ if (resolvedDecl.type === 1 /* DeclarationType.Variable */) {
15093
+ // Exempt typing.pyi, which uses variables to define some
15094
+ // special forms like Any.
15095
+ const fileInfo = AnalyzerNodeInfo.getFileInfo(resolvedDecl.node);
15096
+ if (!fileInfo.isTypingStubFile) {
15097
+ includesVariableDecl = true;
15098
+ }
15099
+ }
15098
15100
  if (declIndexToConsider !== undefined && declIndexToConsider !== index) {
15099
15101
  return;
15100
15102
  }
@@ -15114,18 +15116,15 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15114
15116
  if (usageNode !== undefined) {
15115
15117
  if (decl.type !== 8 /* DeclarationType.Alias */) {
15116
15118
  // Is the declaration in the same execution scope as the "usageNode" node?
15119
+ // If so, we can skip it because code flow analysis will allow us
15120
+ // to determine the type in this context.
15117
15121
  const usageScope = ParseTreeUtils.getExecutionScopeNode(usageNode);
15118
15122
  const declScope = ParseTreeUtils.getExecutionScopeNode(decl.node);
15119
15123
  if (usageScope === declScope) {
15120
- if (!isFlowPathBetweenNodes(decl.node, usageNode)) {
15121
- return;
15122
- }
15124
+ return;
15123
15125
  }
15124
15126
  }
15125
15127
  }
15126
- const resolvedDecl = (_a = resolveAliasDeclaration(decl, /* resolveLocalNames */ true, {
15127
- allowExternallyHiddenAccess: AnalyzerNodeInfo.getFileInfo(decl.node).isStubFile,
15128
- })) !== null && _a !== void 0 ? _a : decl;
15129
15128
  const isExplicitTypeAlias = isExplicitTypeAliasDeclaration(resolvedDecl);
15130
15129
  const isTypeAlias = isExplicitTypeAlias || isPossibleTypeAliasOrTypedDict(resolvedDecl);
15131
15130
  if (isExplicitTypeAlias) {
@@ -15141,6 +15140,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15141
15140
  declsToConsider.push(resolvedDecl);
15142
15141
  });
15143
15142
  const result = getTypeOfSymbolForDecls(symbol, declsToConsider, effectiveTypeCacheKey);
15143
+ result.includesVariableDecl = includesVariableDecl;
15144
+ result.includesIllegalTypeAliasDecl = includesIllegalTypeAliasDecl;
15144
15145
  // Add the result to the effective type cache if it doesn't include speculative results.
15145
15146
  if (!result.includesSpeculativeResult) {
15146
15147
  addToEffectiveTypeCache(result);
@@ -15161,7 +15162,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15161
15162
  const typesToCombine = [];
15162
15163
  let isIncomplete = false;
15163
15164
  let sawPendingEvaluation = false;
15164
- let includesVariableDecl = false;
15165
15165
  let includesSpeculativeResult = false;
15166
15166
  decls.forEach((decl) => {
15167
15167
  if (pushSymbolResolution(symbol, decl)) {
@@ -15172,12 +15172,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15172
15172
  }
15173
15173
  if (type) {
15174
15174
  if (decl.type === 1 /* DeclarationType.Variable */) {
15175
- // Exempt typing.pyi, which uses variables to define some
15176
- // special forms like Any.
15177
- const fileInfo = AnalyzerNodeInfo.getFileInfo(decl.node);
15178
- if (!fileInfo.isTypingStubFile) {
15179
- includesVariableDecl = true;
15180
- }
15181
15175
  let isConstant = false;
15182
15176
  if (decl.type === 1 /* DeclarationType.Variable */) {
15183
15177
  if (decl.isConstant || isFinalVariableDeclaration(decl)) {
@@ -15239,15 +15233,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15239
15233
  else {
15240
15234
  type = types_1.UnboundType.create();
15241
15235
  }
15242
- return {
15243
- type,
15244
- isIncomplete,
15245
- includesVariableDecl,
15246
- includesIllegalTypeAliasDecl: !decls.every((decl) => isPossibleTypeAliasDeclaration(decl)),
15247
- includesSpeculativeResult,
15248
- isRecursiveDefinition: false,
15249
- evaluationAttempts,
15250
- };
15236
+ return { type, isIncomplete, includesSpeculativeResult, evaluationAttempts };
15251
15237
  }
15252
15238
  // If a declaration has an explicit type (e.g. a variable with an annotation),
15253
15239
  // this function evaluates the type and returns it. If the symbol has no
@@ -16228,7 +16214,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16228
16214
  if (types_1.TypeBase.isInstantiable(destType) === types_1.TypeBase.isInstantiable(srcType) &&
16229
16215
  srcType.condition &&
16230
16216
  srcType.condition.some((cond) => {
16231
- return !cond.isConstrainedTypeVar && cond.typeVarName === destTypeVar.nameWithScope;
16217
+ return (cond.typeVar.details.constraints.length === 0 &&
16218
+ cond.typeVar.nameWithScope === destTypeVar.nameWithScope);
16232
16219
  })) {
16233
16220
  return true;
16234
16221
  }
@@ -17019,13 +17006,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17019
17006
  const destTypeVarName = types_1.TypeVarType.getNameWithScope(destType);
17020
17007
  // Determine which conditions on this type apply to this type variable.
17021
17008
  // There might be more than one of them.
17022
- const applicableConditions = ((_a = (0, typeUtils_1.getTypeCondition)(srcSubtype)) !== null && _a !== void 0 ? _a : []).filter((constraint) => constraint.typeVarName === destTypeVarName);
17009
+ const applicableConditions = ((_a = (0, typeUtils_1.getTypeCondition)(srcSubtype)) !== null && _a !== void 0 ? _a : []).filter((constraint) => constraint.typeVar.nameWithScope === destTypeVarName);
17023
17010
  // If there are no applicable conditions, it's not assignable.
17024
17011
  if (applicableConditions.length === 0) {
17025
17012
  return true;
17026
17013
  }
17027
17014
  return !applicableConditions.some((condition) => {
17028
- if (condition.typeVarName === types_1.TypeVarType.getNameWithScope(destType)) {
17015
+ if (condition.typeVar.nameWithScope === types_1.TypeVarType.getNameWithScope(destType)) {
17029
17016
  if (destType.details.boundType) {
17030
17017
  (0, debug_1.assert)(condition.constraintIndex === 0, 'Expected constraint for bound TypeVar to have index of 0');
17031
17018
  return assignType(destType.details.boundType, srcSubtype,