@zzzen/pyright-internal 1.2.0-dev.20240421 → 1.2.0-dev.20240505

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 (157) hide show
  1. package/dist/analyzer/analyzerNodeInfo.d.ts +1 -4
  2. package/dist/analyzer/analyzerNodeInfo.js +1 -11
  3. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  4. package/dist/analyzer/binder.d.ts +0 -2
  5. package/dist/analyzer/binder.js +42 -66
  6. package/dist/analyzer/binder.js.map +1 -1
  7. package/dist/analyzer/checker.js +98 -45
  8. package/dist/analyzer/checker.js.map +1 -1
  9. package/dist/analyzer/constructors.js +31 -13
  10. package/dist/analyzer/constructors.js.map +1 -1
  11. package/dist/analyzer/dataClasses.d.ts +1 -1
  12. package/dist/analyzer/dataClasses.js +23 -11
  13. package/dist/analyzer/dataClasses.js.map +1 -1
  14. package/dist/analyzer/deprecatedSymbols.js +2 -4
  15. package/dist/analyzer/deprecatedSymbols.js.map +1 -1
  16. package/dist/analyzer/namedTuples.js +0 -8
  17. package/dist/analyzer/namedTuples.js.map +1 -1
  18. package/dist/analyzer/operations.js +3 -2
  19. package/dist/analyzer/operations.js.map +1 -1
  20. package/dist/analyzer/packageTypeVerifier.js +10 -10
  21. package/dist/analyzer/parseTreeUtils.d.ts +6 -3
  22. package/dist/analyzer/parseTreeUtils.js +75 -46
  23. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  24. package/dist/analyzer/patternMatching.js +19 -13
  25. package/dist/analyzer/patternMatching.js.map +1 -1
  26. package/dist/analyzer/protocols.js +32 -13
  27. package/dist/analyzer/protocols.js.map +1 -1
  28. package/dist/analyzer/scope.d.ts +14 -7
  29. package/dist/analyzer/scope.js +28 -17
  30. package/dist/analyzer/scope.js.map +1 -1
  31. package/dist/analyzer/scopeUtils.js +3 -3
  32. package/dist/analyzer/scopeUtils.js.map +1 -1
  33. package/dist/analyzer/typeEvaluator.js +252 -207
  34. package/dist/analyzer/typeEvaluator.js.map +1 -1
  35. package/dist/analyzer/typeEvaluatorTypes.d.ts +5 -1
  36. package/dist/analyzer/typeGuards.js +35 -110
  37. package/dist/analyzer/typeGuards.js.map +1 -1
  38. package/dist/analyzer/typeUtils.js +6 -8
  39. package/dist/analyzer/typeUtils.js.map +1 -1
  40. package/dist/analyzer/typedDicts.js +4 -6
  41. package/dist/analyzer/typedDicts.js.map +1 -1
  42. package/dist/analyzer/types.js +13 -0
  43. package/dist/analyzer/types.js.map +1 -1
  44. package/dist/common/console.d.ts +12 -1
  45. package/dist/common/console.js +22 -3
  46. package/dist/common/console.js.map +1 -1
  47. package/dist/common/diagnostic.d.ts +4 -0
  48. package/dist/common/diagnostic.js +10 -4
  49. package/dist/common/diagnostic.js.map +1 -1
  50. package/dist/common/envVarUtils.d.ts +2 -2
  51. package/dist/common/envVarUtils.js +1 -2
  52. package/dist/common/envVarUtils.js.map +1 -1
  53. package/dist/common/languageServerInterface.d.ts +6 -3
  54. package/dist/common/languageServerInterface.js +11 -0
  55. package/dist/common/languageServerInterface.js.map +1 -1
  56. package/dist/common/uri/uri.d.ts +2 -0
  57. package/dist/common/uri/uri.js +3 -1
  58. package/dist/common/uri/uri.js.map +1 -1
  59. package/dist/languageServerBase.d.ts +3 -2
  60. package/dist/languageServerBase.js +13 -35
  61. package/dist/languageServerBase.js.map +1 -1
  62. package/dist/languageService/callHierarchyProvider.js +5 -2
  63. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  64. package/dist/languageService/completionProvider.js +12 -8
  65. package/dist/languageService/completionProvider.js.map +1 -1
  66. package/dist/languageService/documentSymbolCollector.js +1 -1
  67. package/dist/languageService/dynamicFeature.d.ts +18 -0
  68. package/dist/languageService/dynamicFeature.js +54 -0
  69. package/dist/languageService/dynamicFeature.js.map +1 -0
  70. package/dist/languageService/fileWatcherDynamicFeature.d.ts +12 -0
  71. package/dist/languageService/fileWatcherDynamicFeature.js +49 -0
  72. package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -0
  73. package/dist/languageService/referencesProvider.js +3 -2
  74. package/dist/languageService/referencesProvider.js.map +1 -1
  75. package/dist/localization/package.nls.cs.json +28 -26
  76. package/dist/localization/package.nls.de.json +28 -26
  77. package/dist/localization/package.nls.en-us.json +1 -1
  78. package/dist/localization/package.nls.es.json +27 -25
  79. package/dist/localization/package.nls.fr.json +28 -26
  80. package/dist/localization/package.nls.it.json +28 -26
  81. package/dist/localization/package.nls.ja.json +28 -26
  82. package/dist/localization/package.nls.ko.json +28 -26
  83. package/dist/localization/package.nls.pl.json +27 -25
  84. package/dist/localization/package.nls.pt-br.json +28 -26
  85. package/dist/localization/package.nls.qps-ploc.json +25 -23
  86. package/dist/localization/package.nls.ru.json +28 -26
  87. package/dist/localization/package.nls.tr.json +28 -26
  88. package/dist/localization/package.nls.zh-cn.json +28 -26
  89. package/dist/localization/package.nls.zh-tw.json +28 -26
  90. package/dist/parser/parseNodes.d.ts +2 -2
  91. package/dist/parser/tokenizer.js +7 -1
  92. package/dist/parser/tokenizer.js.map +1 -1
  93. package/dist/tests/checker.test.js +8 -0
  94. package/dist/tests/checker.test.js.map +1 -1
  95. package/dist/tests/envVarUtils.test.js +20 -0
  96. package/dist/tests/envVarUtils.test.js.map +1 -1
  97. package/dist/tests/fourslash/{completions.importDunderNames.fourslash.js → completions.import.dunderNames.fourslash.js} +1 -1
  98. package/dist/tests/fourslash/completions.import.dunderNames.fourslash.js.map +1 -0
  99. package/dist/tests/fourslash/{completions.importsDuplicates.fourslash.js → completions.import.duplicates.fourslash.js} +1 -1
  100. package/dist/tests/fourslash/{completions.importsDuplicates.fourslash.js.map → completions.import.duplicates.fourslash.js.map} +1 -1
  101. package/dist/tests/fourslash/completions.import.exactMatch.fourslash.js +29 -0
  102. package/dist/tests/fourslash/completions.import.exactMatch.fourslash.js.map +1 -0
  103. package/dist/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.js +14 -0
  104. package/dist/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.js.map +1 -0
  105. package/dist/tests/fourslash/completions.import.interimFile.fourslash.disabled.d.ts +1 -0
  106. package/dist/tests/fourslash/{completions.importInterimFile.fourslash.disabled.js → completions.import.interimFile.fourslash.disabled.js} +1 -1
  107. package/dist/tests/fourslash/completions.import.interimFile.fourslash.disabled.js.map +1 -0
  108. package/dist/tests/fourslash/{completions.importPrivateNoPytyped.fourslash.js → completions.import.privateNoPytyped.fourslash.js} +1 -1
  109. package/dist/tests/fourslash/completions.import.privateNoPytyped.fourslash.js.map +1 -0
  110. package/dist/tests/fourslash/{completions.importPytyped.fourslash.js → completions.import.pytyped.fourslash.js} +1 -1
  111. package/dist/tests/fourslash/completions.import.pytyped.fourslash.js.map +1 -0
  112. package/dist/tests/fourslash/{completions.importPytypedLocal.fourslash.js → completions.import.pytypedLocal.fourslash.js} +1 -1
  113. package/dist/tests/fourslash/completions.import.pytypedLocal.fourslash.js.map +1 -0
  114. package/dist/tests/fourslash/completions.import.submodule.fourslash.d.ts +1 -0
  115. package/dist/tests/fourslash/{completions.importSubmodule.fourslash.js → completions.import.submodule.fourslash.js} +1 -1
  116. package/dist/tests/fourslash/completions.import.submodule.fourslash.js.map +1 -0
  117. package/dist/tests/harness/fourslash/testState.js +1 -1
  118. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  119. package/dist/tests/harness/vfs/pathValidation.js +2 -1
  120. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  121. package/dist/tests/parser.test.js +7 -2
  122. package/dist/tests/parser.test.js.map +1 -1
  123. package/dist/tests/typeEvaluator1.test.js +60 -480
  124. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  125. package/dist/tests/typeEvaluator2.test.js +0 -482
  126. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  127. package/dist/tests/typeEvaluator3.test.js +0 -604
  128. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  129. package/dist/tests/typeEvaluator4.test.js +5 -423
  130. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  131. package/dist/tests/typeEvaluator5.test.js +2 -2
  132. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  133. package/dist/tests/typeEvaluator6.test.d.ts +1 -0
  134. package/dist/tests/typeEvaluator6.test.js +712 -0
  135. package/dist/tests/typeEvaluator6.test.js.map +1 -0
  136. package/dist/tests/typeEvaluator7.test.d.ts +1 -0
  137. package/dist/tests/typeEvaluator7.test.js +677 -0
  138. package/dist/tests/typeEvaluator7.test.js.map +1 -0
  139. package/dist/tests/typeEvaluator8.test.d.ts +1 -0
  140. package/dist/tests/typeEvaluator8.test.js +660 -0
  141. package/dist/tests/typeEvaluator8.test.js.map +1 -0
  142. package/dist/workspaceFactory.d.ts +3 -1
  143. package/dist/workspaceFactory.js.map +1 -1
  144. package/package.json +1 -1
  145. package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +0 -1
  146. package/dist/tests/fourslash/completions.importInterimFile.fourslash.disabled.js.map +0 -1
  147. package/dist/tests/fourslash/completions.importPrivateNoPytyped.fourslash.js.map +0 -1
  148. package/dist/tests/fourslash/completions.importPytyped.fourslash.js.map +0 -1
  149. package/dist/tests/fourslash/completions.importPytypedLocal.fourslash.js.map +0 -1
  150. package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +0 -1
  151. /package/dist/tests/fourslash/{completions.importDunderNames.fourslash.d.ts → completions.import.dunderNames.fourslash.d.ts} +0 -0
  152. /package/dist/tests/fourslash/{completions.importPrivateNoPytyped.fourslash.d.ts → completions.import.duplicates.fourslash.d.ts} +0 -0
  153. /package/dist/tests/fourslash/{completions.importInterimFile.fourslash.disabled.d.ts → completions.import.exactMatch.fourslash.d.ts} +0 -0
  154. /package/dist/tests/fourslash/{completions.importSubmodule.fourslash.d.ts → completions.import.excludeAlreadyImported.fourslash.d.ts} +0 -0
  155. /package/dist/tests/fourslash/{completions.importPytyped.fourslash.d.ts → completions.import.privateNoPytyped.fourslash.d.ts} +0 -0
  156. /package/dist/tests/fourslash/{completions.importPytypedLocal.fourslash.d.ts → completions.import.pytyped.fourslash.d.ts} +0 -0
  157. /package/dist/tests/fourslash/{completions.importsDuplicates.fourslash.d.ts → completions.import.pytypedLocal.fourslash.d.ts} +0 -0
@@ -397,7 +397,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
397
397
  // This signifies an incomplete stub file that obscures type errors.
398
398
  if (this._fileInfo.isStubFile && node.name.value === '__getattr__') {
399
399
  const scope = (0, scopeUtils_1.getScopeForNode)(node);
400
- if ((scope === null || scope === void 0 ? void 0 : scope.type) === 3 /* ScopeType.Module */) {
400
+ if ((scope === null || scope === void 0 ? void 0 : scope.type) === 4 /* ScopeType.Module */) {
401
401
  this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompleteStub, localize_1.LocMessage.stubUsesGetAttr(), node.name);
402
402
  }
403
403
  }
@@ -741,9 +741,9 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
741
741
  if ((0, types_1.isClassInstance)(annotationType) && types_1.ClassType.isBuiltIn(annotationType, 'TypeAlias')) {
742
742
  const scope = (0, scopeUtils_1.getScopeForNode)(node);
743
743
  if (scope) {
744
- if (scope.type !== 2 /* ScopeType.Class */ &&
745
- scope.type !== 3 /* ScopeType.Module */ &&
746
- scope.type !== 4 /* ScopeType.Builtin */) {
744
+ if (scope.type !== 3 /* ScopeType.Class */ &&
745
+ scope.type !== 4 /* ScopeType.Module */ &&
746
+ scope.type !== 5 /* ScopeType.Builtin */) {
747
747
  this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAliasNotInModuleOrClass(), node.leftExpression.typeAnnotation);
748
748
  }
749
749
  }
@@ -767,31 +767,37 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
767
767
  if (baseType) {
768
768
  (0, typeUtils_1.doForEachSubtype)(baseType, (subtype) => {
769
769
  const tupleType = (0, typeUtils_1.getSpecializedTupleType)(subtype);
770
- if ((0, types_1.isClassInstance)(subtype) &&
771
- (tupleType === null || tupleType === void 0 ? void 0 : tupleType.tupleTypeArguments) &&
772
- !(0, typeUtils_1.isUnboundedTupleClass)(tupleType) &&
773
- !this._evaluator.isTypeSubsumedByOtherType(tupleType, baseType, /* allowAnyToSubsume */ false)) {
774
- const tupleLength = tupleType.tupleTypeArguments.length;
775
- if (node.items.length === 1 &&
776
- !node.trailingComma &&
777
- node.items[0].argumentCategory === 0 /* ArgumentCategory.Simple */ &&
778
- !node.items[0].name) {
779
- const subscriptType = this._evaluator.getType(node.items[0].valueExpression);
780
- if (subscriptType &&
781
- (0, types_1.isClassInstance)(subscriptType) &&
782
- types_1.ClassType.isBuiltIn(subscriptType, 'int') &&
783
- (0, typeUtils_1.isLiteralType)(subscriptType) &&
784
- typeof subscriptType.literalValue === 'number') {
785
- if ((subscriptType.literalValue >= 0 && subscriptType.literalValue >= tupleLength) ||
786
- (subscriptType.literalValue < 0 && subscriptType.literalValue + tupleLength < 0)) {
787
- this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.tupleIndexOutOfRange().format({
788
- index: subscriptType.literalValue,
789
- type: this._evaluator.printType(subtype),
790
- }), node);
791
- }
792
- }
793
- }
770
+ if (!(0, types_1.isClassInstance)(subtype) || !(tupleType === null || tupleType === void 0 ? void 0 : tupleType.tupleTypeArguments) || (0, typeUtils_1.isUnboundedTupleClass)(tupleType)) {
771
+ return;
772
+ }
773
+ const tupleLength = tupleType.tupleTypeArguments.length;
774
+ if (node.items.length !== 1 ||
775
+ node.trailingComma ||
776
+ node.items[0].argumentCategory !== 0 /* ArgumentCategory.Simple */ ||
777
+ node.items[0].name) {
778
+ return;
779
+ }
780
+ const subscriptType = this._evaluator.getType(node.items[0].valueExpression);
781
+ if (!subscriptType ||
782
+ !(0, types_1.isClassInstance)(subscriptType) ||
783
+ !types_1.ClassType.isBuiltIn(subscriptType, 'int') ||
784
+ !(0, typeUtils_1.isLiteralType)(subscriptType) ||
785
+ typeof subscriptType.literalValue !== 'number') {
786
+ return;
794
787
  }
788
+ if ((subscriptType.literalValue < 0 || subscriptType.literalValue < tupleLength) &&
789
+ (subscriptType.literalValue >= 0 || subscriptType.literalValue + tupleLength >= 0)) {
790
+ return;
791
+ }
792
+ // This can be an expensive check, so we save it for the end once we
793
+ // are about to emit a diagnostic.
794
+ if (this._evaluator.isTypeSubsumedByOtherType(tupleType, baseType, /* allowAnyToSubsume */ false)) {
795
+ return;
796
+ }
797
+ this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.tupleIndexOutOfRange().format({
798
+ index: subscriptType.literalValue,
799
+ type: this._evaluator.printType(subtype),
800
+ }), node);
795
801
  });
796
802
  }
797
803
  return true;
@@ -1043,12 +1049,41 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
1043
1049
  return true;
1044
1050
  }
1045
1051
  visitTypeParameter(node) {
1052
+ var _a, _b, _c, _d;
1053
+ // Verify that there are no live type variables with the same
1054
+ // name in outer scopes.
1055
+ let curNode = (_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent;
1056
+ let foundDuplicate = false;
1057
+ while (curNode) {
1058
+ const typeVarScopeNode = ParseTreeUtils.getTypeVarScopeNode(curNode);
1059
+ if (!typeVarScopeNode) {
1060
+ break;
1061
+ }
1062
+ if (typeVarScopeNode.nodeType === 10 /* ParseNodeType.Class */) {
1063
+ const classType = (_c = this._evaluator.getTypeOfClass(typeVarScopeNode)) === null || _c === void 0 ? void 0 : _c.classType;
1064
+ if (classType === null || classType === void 0 ? void 0 : classType.details.typeParameters.some((param) => param.details.name === node.name.value)) {
1065
+ foundDuplicate = true;
1066
+ break;
1067
+ }
1068
+ }
1069
+ else if (typeVarScopeNode.nodeType === 28 /* ParseNodeType.Function */) {
1070
+ const functionType = (_d = this._evaluator.getTypeOfFunction(typeVarScopeNode)) === null || _d === void 0 ? void 0 : _d.functionType;
1071
+ if (functionType === null || functionType === void 0 ? void 0 : functionType.details.typeParameters.some((param) => param.details.name === node.name.value)) {
1072
+ foundDuplicate = true;
1073
+ break;
1074
+ }
1075
+ }
1076
+ curNode = typeVarScopeNode.parent;
1077
+ }
1078
+ if (foundDuplicate) {
1079
+ this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeVarUsedByOuterScope().format({ name: node.name.value }), node.name);
1080
+ }
1046
1081
  return false;
1047
1082
  }
1048
1083
  visitTypeAlias(node) {
1049
1084
  const scope = (0, scopeUtils_1.getScopeForNode)(node);
1050
1085
  if (scope) {
1051
- if (scope.type !== 2 /* ScopeType.Class */ && scope.type !== 3 /* ScopeType.Module */ && scope.type !== 4 /* ScopeType.Builtin */) {
1086
+ if (scope.type !== 3 /* ScopeType.Class */ && scope.type !== 4 /* ScopeType.Module */ && scope.type !== 5 /* ScopeType.Builtin */) {
1052
1087
  this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAliasStatementBadScope(), node.name);
1053
1088
  }
1054
1089
  }
@@ -2010,8 +2045,9 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2010
2045
  // Report unaccessed type parameters.
2011
2046
  const accessedSymbolSet = this._fileInfo.accessedSymbolSet;
2012
2047
  for (const paramList of this._typeParameterLists) {
2048
+ const typeParamScope = AnalyzerNodeInfo.getScope(paramList);
2013
2049
  for (const param of paramList.parameters) {
2014
- const symbol = AnalyzerNodeInfo.getTypeParameterSymbol(param.name);
2050
+ const symbol = typeParamScope === null || typeParamScope === void 0 ? void 0 : typeParamScope.symbolTable.get(param.name.value);
2015
2051
  if (!symbol) {
2016
2052
  // This can happen if the code is unreachable.
2017
2053
  return;
@@ -2123,11 +2159,18 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2123
2159
  if (decl.type === 1 /* DeclarationType.Variable */) {
2124
2160
  if (decl.inferredTypeSource) {
2125
2161
  if (sawAssignment) {
2126
- // We check for assignment of Final instance and class variables
2127
- // the type evaluator because we need to take into account whether
2128
- // the assignment is within an `__init__` method, so ignore class
2129
- // scopes here.
2130
- if (scopeType !== 2 /* ScopeType.Class */) {
2162
+ let exemptAssignment = false;
2163
+ if (scopeType === 3 /* ScopeType.Class */) {
2164
+ // We check for assignment of Final instance and class variables
2165
+ // in the type evaluator because we need to take into account whether
2166
+ // the assignment is within an `__init__` method, so ignore class
2167
+ // scopes here.
2168
+ const classOrFunc = ParseTreeUtils.getEnclosingClassOrFunction(decl.node);
2169
+ if ((classOrFunc === null || classOrFunc === void 0 ? void 0 : classOrFunc.nodeType) === 28 /* ParseNodeType.Function */) {
2170
+ exemptAssignment = true;
2171
+ }
2172
+ }
2173
+ if (!exemptAssignment) {
2131
2174
  reportRedeclaration = true;
2132
2175
  }
2133
2176
  }
@@ -2856,7 +2899,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2856
2899
  _isSymbolPrivate(nameValue, scopeType) {
2857
2900
  // All variables within the scope of a function or a list
2858
2901
  // comprehension are considered private.
2859
- if (scopeType === 1 /* ScopeType.Function */ || scopeType === 0 /* ScopeType.ListComprehension */) {
2902
+ if (scopeType === 2 /* ScopeType.Function */ || scopeType === 1 /* ScopeType.ListComprehension */) {
2860
2903
  return true;
2861
2904
  }
2862
2905
  // See if the symbol is private.
@@ -2865,7 +2908,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2865
2908
  }
2866
2909
  if (SymbolNameUtils.isProtectedName(nameValue)) {
2867
2910
  // Protected names outside of a class scope are considered private.
2868
- const isClassScope = scopeType === 2 /* ScopeType.Class */;
2911
+ const isClassScope = scopeType === 3 /* ScopeType.Class */;
2869
2912
  return !isClassScope;
2870
2913
  }
2871
2914
  return false;
@@ -2959,6 +3002,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2959
3002
  name: type.details.name,
2960
3003
  });
2961
3004
  }
3005
+ else if ((0, types_1.isClassInstance)(type) && overload.details.name === '__call__') {
3006
+ deprecatedMessage = overload.details.deprecatedMessage;
3007
+ errorMessage = localize_1.LocMessage.deprecatedFunction().format({
3008
+ name: node.value,
3009
+ });
3010
+ }
2962
3011
  }
2963
3012
  });
2964
3013
  }
@@ -2970,15 +3019,16 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2970
3019
  node.value === subtype.details.name) {
2971
3020
  deprecatedMessage = subtype.details.deprecatedMessage;
2972
3021
  errorMessage = localize_1.LocMessage.deprecatedClass().format({ name: subtype.details.name });
3022
+ return;
2973
3023
  }
2974
- else {
2975
- // See if this is part of a call to a constructor.
2976
- getDeprecatedMessageForOverloadedCall(this._evaluator, subtype);
2977
- }
3024
+ getDeprecatedMessageForOverloadedCall(this._evaluator, subtype);
3025
+ return;
2978
3026
  }
2979
- else if ((0, types_1.isFunction)(subtype)) {
3027
+ if ((0, types_1.isFunction)(subtype)) {
2980
3028
  if (subtype.details.deprecatedMessage !== undefined) {
2981
- if (!subtype.details.name || node.value === subtype.details.name) {
3029
+ if (!subtype.details.name ||
3030
+ subtype.details.name === '__call__' ||
3031
+ node.value === subtype.details.name) {
2982
3032
  deprecatedMessage = subtype.details.deprecatedMessage;
2983
3033
  errorMessage = getDeprecatedMessageForFunction(subtype);
2984
3034
  }
@@ -4742,7 +4792,10 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
4742
4792
  isClassVar = true;
4743
4793
  }
4744
4794
  }
4745
- if (isBaseClassVar !== isClassVar) {
4795
+ // Allow TypedDict members to have the same name as class variables in the
4796
+ // base class because TypedDict members are not really instance members.
4797
+ const ignoreTypedDictOverride = types_1.ClassType.isTypedDictClass(childClassType) && !isClassVar;
4798
+ if (isBaseClassVar !== isClassVar && !ignoreTypedDictOverride) {
4746
4799
  const unformattedMessage = overrideSymbol.isClassVar()
4747
4800
  ? localize_1.LocMessage.classVarOverridesInstanceVar()
4748
4801
  : localize_1.LocMessage.instanceVarOverridesClassVar();
@@ -4932,7 +4985,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
4932
4985
  if (functionType.details.name === '__init__' && functionType.details.methodClass) {
4933
4986
  const typeVars = (0, typeUtils_1.getTypeVarArgumentsRecursive)(paramInfo.type);
4934
4987
  if (typeVars.some((typeVar) => { var _a; return typeVar.scopeId === ((_a = functionType.details.methodClass) === null || _a === void 0 ? void 0 : _a.details.typeVarScopeId); })) {
4935
- this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.initMethodSelfParamTypeVar(), paramInfo.typeAnnotation);
4988
+ this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeVarUse, localize_1.LocMessage.initMethodSelfParamTypeVar(), paramInfo.typeAnnotation);
4936
4989
  }
4937
4990
  }
4938
4991
  // If this is a protocol class, the self and cls parameters can be bound