@zzzen/pyright-internal 1.2.0-dev.20230226 → 1.2.0-dev.20230312

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 (148) hide show
  1. package/dist/analyzer/binder.d.ts +0 -1
  2. package/dist/analyzer/binder.js +32 -95
  3. package/dist/analyzer/binder.js.map +1 -1
  4. package/dist/analyzer/checker.js +48 -31
  5. package/dist/analyzer/checker.js.map +1 -1
  6. package/dist/analyzer/codeFlowEngine.js +4 -4
  7. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  8. package/dist/analyzer/commentUtils.js +11 -1
  9. package/dist/analyzer/commentUtils.js.map +1 -1
  10. package/dist/analyzer/constructorTransform.d.ts +1 -0
  11. package/dist/analyzer/constructorTransform.js +19 -2
  12. package/dist/analyzer/constructorTransform.js.map +1 -1
  13. package/dist/analyzer/declaration.d.ts +2 -4
  14. package/dist/analyzer/declaration.js +6 -1
  15. package/dist/analyzer/declaration.js.map +1 -1
  16. package/dist/analyzer/declarationUtils.d.ts +1 -5
  17. package/dist/analyzer/declarationUtils.js +2 -47
  18. package/dist/analyzer/declarationUtils.js.map +1 -1
  19. package/dist/analyzer/docStringConversion.js +9 -3
  20. package/dist/analyzer/docStringConversion.js.map +1 -1
  21. package/dist/analyzer/packageTypeVerifier.js +40 -40
  22. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  23. package/dist/analyzer/parseTreeUtils.d.ts +4 -2
  24. package/dist/analyzer/parseTreeUtils.js +77 -2
  25. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  26. package/dist/analyzer/patternMatching.js +20 -1
  27. package/dist/analyzer/patternMatching.js.map +1 -1
  28. package/dist/analyzer/program.d.ts +1 -0
  29. package/dist/analyzer/program.js +154 -13
  30. package/dist/analyzer/program.js.map +1 -1
  31. package/dist/analyzer/properties.js +3 -2
  32. package/dist/analyzer/properties.js.map +1 -1
  33. package/dist/analyzer/protocols.js +4 -2
  34. package/dist/analyzer/protocols.js.map +1 -1
  35. package/dist/analyzer/pythonPathUtils.js +27 -13
  36. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  37. package/dist/analyzer/service.js +6 -1
  38. package/dist/analyzer/service.js.map +1 -1
  39. package/dist/analyzer/sourceFile.js +12 -1
  40. package/dist/analyzer/sourceFile.js.map +1 -1
  41. package/dist/analyzer/symbol.js +1 -4
  42. package/dist/analyzer/symbol.js.map +1 -1
  43. package/dist/analyzer/symbolUtils.d.ts +0 -3
  44. package/dist/analyzer/symbolUtils.js +1 -14
  45. package/dist/analyzer/symbolUtils.js.map +1 -1
  46. package/dist/analyzer/typeDocStringUtils.js +5 -3
  47. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  48. package/dist/analyzer/typeEvaluator.js +642 -259
  49. package/dist/analyzer/typeEvaluator.js.map +1 -1
  50. package/dist/analyzer/typeEvaluatorTypes.d.ts +11 -2
  51. package/dist/analyzer/typeGuards.js +2 -2
  52. package/dist/analyzer/typeGuards.js.map +1 -1
  53. package/dist/analyzer/typePrinter.js +63 -55
  54. package/dist/analyzer/typePrinter.js.map +1 -1
  55. package/dist/analyzer/typeUtils.d.ts +2 -0
  56. package/dist/analyzer/typeUtils.js +22 -3
  57. package/dist/analyzer/typeUtils.js.map +1 -1
  58. package/dist/analyzer/typedDicts.d.ts +2 -1
  59. package/dist/analyzer/typedDicts.js +83 -57
  60. package/dist/analyzer/typedDicts.js.map +1 -1
  61. package/dist/analyzer/types.d.ts +3 -1
  62. package/dist/analyzer/types.js +8 -0
  63. package/dist/analyzer/types.js.map +1 -1
  64. package/dist/commands/dumpFileDebugInfoCommand.js +78 -0
  65. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  66. package/dist/common/collectionUtils.d.ts +1 -0
  67. package/dist/common/collectionUtils.js +8 -1
  68. package/dist/common/collectionUtils.js.map +1 -1
  69. package/dist/common/extensibility.js +25 -1
  70. package/dist/common/extensibility.js.map +1 -1
  71. package/dist/common/positionUtils.d.ts +2 -0
  72. package/dist/common/positionUtils.js +15 -1
  73. package/dist/common/positionUtils.js.map +1 -1
  74. package/dist/languageServerBase.js +9 -1
  75. package/dist/languageServerBase.js.map +1 -1
  76. package/dist/languageService/callHierarchyProvider.js +4 -2
  77. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  78. package/dist/languageService/completionProvider.d.ts +4 -2
  79. package/dist/languageService/completionProvider.js +252 -191
  80. package/dist/languageService/completionProvider.js.map +1 -1
  81. package/dist/languageService/completionProviderUtils.d.ts +1 -1
  82. package/dist/languageService/completionProviderUtils.js +3 -3
  83. package/dist/languageService/completionProviderUtils.js.map +1 -1
  84. package/dist/languageService/definitionProvider.js +2 -1
  85. package/dist/languageService/definitionProvider.js.map +1 -1
  86. package/dist/languageService/documentSymbolProvider.js +2 -1
  87. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  88. package/dist/languageService/hoverProvider.js +11 -3
  89. package/dist/languageService/hoverProvider.js.map +1 -1
  90. package/dist/languageService/importAdder.js +4 -1
  91. package/dist/languageService/importAdder.js.map +1 -1
  92. package/dist/languageService/indentationUtils.d.ts +1 -1
  93. package/dist/languageService/indentationUtils.js +22 -12
  94. package/dist/languageService/indentationUtils.js.map +1 -1
  95. package/dist/languageService/renameModuleProvider.d.ts +1 -1
  96. package/dist/languageService/renameModuleProvider.js +28 -8
  97. package/dist/languageService/renameModuleProvider.js.map +1 -1
  98. package/dist/languageService/tooltipUtils.js +2 -1
  99. package/dist/languageService/tooltipUtils.js.map +1 -1
  100. package/dist/localization/localize.d.ts +12 -2
  101. package/dist/localization/localize.js +5 -1
  102. package/dist/localization/localize.js.map +1 -1
  103. package/dist/localization/package.nls.en-us.json +6 -2
  104. package/dist/parser/parser.js +40 -25
  105. package/dist/parser/parser.js.map +1 -1
  106. package/dist/parser/tokenizer.js +1 -1
  107. package/dist/pyright.js +1 -1
  108. package/dist/pyright.js.map +1 -1
  109. package/dist/tests/completions.test.js +445 -0
  110. package/dist/tests/completions.test.js.map +1 -1
  111. package/dist/tests/docStringConversion.test.js +23 -0
  112. package/dist/tests/docStringConversion.test.js.map +1 -1
  113. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js +13 -3
  114. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
  115. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js +7 -2
  116. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
  117. package/dist/tests/fourslash/completions.errorNodes.fourslash.d.ts +1 -0
  118. package/dist/tests/fourslash/completions.errorNodes.fourslash.js +24 -0
  119. package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -0
  120. package/dist/tests/fourslash/hover.slots.fourslash.d.ts +1 -0
  121. package/dist/tests/fourslash/hover.slots.fourslash.js +16 -0
  122. package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -0
  123. package/dist/tests/hoverProvider.test.js +1 -1
  124. package/dist/tests/hoverProvider.test.js.map +1 -1
  125. package/dist/tests/importAdder.test.js +13 -0
  126. package/dist/tests/importAdder.test.js.map +1 -1
  127. package/dist/tests/indentationUtils.reindent.test.js +21 -0
  128. package/dist/tests/indentationUtils.reindent.test.js.map +1 -1
  129. package/dist/tests/moveSymbol.importAdder.test.js +137 -31
  130. package/dist/tests/moveSymbol.importAdder.test.js.map +1 -1
  131. package/dist/tests/moveSymbol.insertion.test.js +98 -0
  132. package/dist/tests/moveSymbol.insertion.test.js.map +1 -1
  133. package/dist/tests/moveSymbol.misc.test.js +27 -0
  134. package/dist/tests/moveSymbol.misc.test.js.map +1 -1
  135. package/dist/tests/renameModuleTestUtils.d.ts +1 -1
  136. package/dist/tests/renameModuleTestUtils.js +9 -5
  137. package/dist/tests/renameModuleTestUtils.js.map +1 -1
  138. package/dist/tests/typeEvaluator1.test.js +8 -0
  139. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  140. package/dist/tests/typeEvaluator2.test.js +5 -1
  141. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  142. package/dist/tests/typeEvaluator3.test.js +20 -4
  143. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  144. package/dist/tests/typeEvaluator4.test.js +4 -0
  145. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  146. package/dist/tests/typeEvaluator5.test.js +6 -0
  147. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  148. package/package.json +1 -1
@@ -46,7 +46,6 @@ const parseNodes_1 = require("../parser/parseNodes");
46
46
  const stringTokenUtils_1 = require("../parser/stringTokenUtils");
47
47
  const AnalyzerNodeInfo = __importStar(require("./analyzerNodeInfo"));
48
48
  const declaration_1 = require("./declaration");
49
- const declarationUtils_1 = require("./declarationUtils");
50
49
  const importResolver_1 = require("./importResolver");
51
50
  const importStatementUtils_1 = require("./importStatementUtils");
52
51
  const ParseTreeUtils = __importStar(require("./parseTreeUtils"));
@@ -271,20 +270,22 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
271
270
  const functionTypeParam = functionTypeResult.functionType.details.parameters.find((p) => { var _a; return p.name === ((_a = param.name) === null || _a === void 0 ? void 0 : _a.value); });
272
271
  if (functionTypeParam) {
273
272
  const paramType = functionTypeParam.type;
274
- if ((0, types_1.isUnknown)(paramType) ||
275
- ((0, types_1.isTypeVar)(paramType) &&
276
- paramType.details.isSynthesized &&
277
- !paramType.details.isSynthesizedSelf)) {
278
- this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType, diagnosticRules_1.DiagnosticRule.reportUnknownParameterType, localize_1.Localizer.Diagnostic.paramTypeUnknown().format({ paramName: param.name.value }), param.name);
279
- }
280
- else if ((0, typeUtils_1.isPartlyUnknown)(paramType)) {
281
- const diagAddendum = new diagnostic_1.DiagnosticAddendum();
282
- diagAddendum.addMessage(localize_1.Localizer.DiagnosticAddendum.paramType().format({
283
- paramType: this._evaluator.printType(paramType, { expandTypeAlias: true }),
284
- }));
285
- this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType, diagnosticRules_1.DiagnosticRule.reportUnknownParameterType, localize_1.Localizer.Diagnostic.paramTypePartiallyUnknown().format({
286
- paramName: param.name.value,
287
- }) + diagAddendum.getString(), param.name);
273
+ if (this._fileInfo.diagnosticRuleSet.reportUnknownParameterType !== 'none') {
274
+ if ((0, types_1.isUnknown)(paramType) ||
275
+ ((0, types_1.isTypeVar)(paramType) &&
276
+ paramType.details.isSynthesized &&
277
+ !paramType.details.isSynthesizedSelf)) {
278
+ this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType, diagnosticRules_1.DiagnosticRule.reportUnknownParameterType, localize_1.Localizer.Diagnostic.paramTypeUnknown().format({ paramName: param.name.value }), param.name);
279
+ }
280
+ else if ((0, typeUtils_1.isPartlyUnknown)(paramType)) {
281
+ const diagAddendum = new diagnostic_1.DiagnosticAddendum();
282
+ diagAddendum.addMessage(localize_1.Localizer.DiagnosticAddendum.paramType().format({
283
+ paramType: this._evaluator.printType(paramType, { expandTypeAlias: true }),
284
+ }));
285
+ this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType, diagnosticRules_1.DiagnosticRule.reportUnknownParameterType, localize_1.Localizer.Diagnostic.paramTypePartiallyUnknown().format({
286
+ paramName: param.name.value,
287
+ }) + diagAddendum.getString(), param.name);
288
+ }
288
289
  }
289
290
  let hasAnnotation = false;
290
291
  if (functionTypeParam.typeAnnotation) {
@@ -296,7 +297,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
296
297
  hasAnnotation = true;
297
298
  }
298
299
  }
299
- if (!hasAnnotation) {
300
+ if (!hasAnnotation && this._fileInfo.diagnosticRuleSet.reportMissingParameterType !== 'none') {
300
301
  this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingParameterType, diagnosticRules_1.DiagnosticRule.reportMissingParameterType, localize_1.Localizer.Diagnostic.paramAnnotationMissing().format({ name: param.name.value }), param.name);
301
302
  }
302
303
  }
@@ -716,6 +717,20 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
716
717
  this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportTypeCommentUsage, diagnosticRules_1.DiagnosticRule.reportTypeCommentUsage, localize_1.Localizer.Diagnostic.typeCommentDeprecated(), node.typeAnnotationComment);
717
718
  }
718
719
  }
720
+ // If this isn't a class or global scope, explicit type aliases are not allowed.
721
+ if (node.leftExpression.nodeType === 54 /* TypeAnnotation */) {
722
+ const annotationType = this._evaluator.getTypeOfAnnotation(node.leftExpression.typeAnnotation);
723
+ if ((0, types_1.isClassInstance)(annotationType) && types_1.ClassType.isBuiltIn(annotationType, 'TypeAlias')) {
724
+ const scope = (0, scopeUtils_1.getScopeForNode)(node);
725
+ if (scope) {
726
+ if (scope.type !== 2 /* Class */ &&
727
+ scope.type !== 3 /* Module */ &&
728
+ scope.type !== 4 /* Builtin */) {
729
+ this._evaluator.addError(localize_1.Localizer.Diagnostic.typeAliasNotInModuleOrClass(), node.leftExpression.typeAnnotation);
730
+ }
731
+ }
732
+ }
733
+ }
719
734
  return true;
720
735
  }
721
736
  visitAssignmentExpression(node) {
@@ -1875,14 +1890,14 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
1875
1890
  }
1876
1891
  }
1877
1892
  _reportMultipleFinalDeclarations(name, symbol, scopeType) {
1878
- if (!(0, symbolUtils_1.isFinalVariable)(symbol)) {
1893
+ if (!this._evaluator.isFinalVariable(symbol)) {
1879
1894
  return;
1880
1895
  }
1881
1896
  const decls = symbol.getDeclarations();
1882
1897
  let sawFinal = false;
1883
1898
  let sawAssignment = false;
1884
1899
  decls.forEach((decl) => {
1885
- if ((0, declarationUtils_1.isFinalVariableDeclaration)(decl)) {
1900
+ if (this._evaluator.isFinalVariableDeclaration(decl)) {
1886
1901
  if (sawFinal) {
1887
1902
  this._evaluator.addError(localize_1.Localizer.Diagnostic.finalRedeclaration().format({ name }), decl.node);
1888
1903
  }
@@ -1928,7 +1943,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
1928
1943
  }
1929
1944
  _reportMultipleTypeAliasDeclarations(name, symbol) {
1930
1945
  const decls = symbol.getDeclarations();
1931
- const typeAliasDecl = decls.find((decl) => (0, declarationUtils_1.isExplicitTypeAliasDeclaration)(decl));
1946
+ const typeAliasDecl = decls.find((decl) => this._evaluator.isExplicitTypeAliasDeclaration(decl));
1932
1947
  // If this is a type alias, there should be only one declaration.
1933
1948
  if (typeAliasDecl && decls.length > 1) {
1934
1949
  decls.forEach((decl) => {
@@ -1939,6 +1954,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
1939
1954
  }
1940
1955
  }
1941
1956
  _reportIncompatibleDeclarations(name, symbol) {
1957
+ var _a, _b, _c, _d;
1942
1958
  // If there's one or more declaration with a declared type,
1943
1959
  // all other declarations should match. The only exception is
1944
1960
  // for functions that have an overload.
@@ -2045,13 +2061,13 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2045
2061
  }
2046
2062
  }
2047
2063
  else if (otherDecl.type === 5 /* Function */) {
2048
- const primaryType = this._evaluator.getTypeForDeclaration(primaryDecl);
2064
+ const primaryType = (_a = this._evaluator.getTypeForDeclaration(primaryDecl)) === null || _a === void 0 ? void 0 : _a.type;
2049
2065
  let duplicateIsOk = false;
2050
2066
  // If the return type has not yet been inferred, do so now.
2051
2067
  if (primaryType && (0, types_1.isFunction)(primaryType)) {
2052
2068
  this._evaluator.getFunctionInferredReturnType(primaryType);
2053
2069
  }
2054
- const otherType = this._evaluator.getTypeForDeclaration(otherDecl);
2070
+ const otherType = (_b = this._evaluator.getTypeForDeclaration(otherDecl)) === null || _b === void 0 ? void 0 : _b.type;
2055
2071
  const suite1 = ParseTreeUtils.getEnclosingSuite(primaryDecl.node);
2056
2072
  const suite2 = ParseTreeUtils.getEnclosingSuite(otherDecl.node);
2057
2073
  // Allow same-signature overrides in cases where the declarations
@@ -2095,12 +2111,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
2095
2111
  }
2096
2112
  }
2097
2113
  else if (otherDecl.type === 1 /* Variable */) {
2098
- const primaryType = this._evaluator.getTypeForDeclaration(primaryDecl);
2114
+ const primaryType = (_c = this._evaluator.getTypeForDeclaration(primaryDecl)) === null || _c === void 0 ? void 0 : _c.type;
2099
2115
  if (otherDecl.typeAnnotationNode) {
2100
2116
  if (otherDecl.node.nodeType === 38 /* Name */) {
2101
2117
  let duplicateIsOk = false;
2102
2118
  // It's OK if they both have the same declared type.
2103
- const otherType = this._evaluator.getTypeForDeclaration(otherDecl);
2119
+ const otherType = (_d = this._evaluator.getTypeForDeclaration(otherDecl)) === null || _d === void 0 ? void 0 : _d.type;
2104
2120
  if (primaryType && otherType && (0, types_1.isTypeSame)(primaryType, otherType)) {
2105
2121
  duplicateIsOk = true;
2106
2122
  }
@@ -3007,7 +3023,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
3007
3023
  const parentSymbol = (0, typeUtils_1.lookUpClassMember)(classType, name, 1 /* SkipOriginalClass */);
3008
3024
  if (parentSymbol &&
3009
3025
  (0, types_1.isInstantiableClass)(parentSymbol.classType) &&
3010
- (0, symbolUtils_1.isFinalVariable)(parentSymbol.symbol) &&
3026
+ this._evaluator.isFinalVariable(parentSymbol.symbol) &&
3011
3027
  !SymbolNameUtils.isPrivateName(name)) {
3012
3028
  const decl = localSymbol.getDeclarations()[0];
3013
3029
  this._evaluator.addError(localize_1.Localizer.Diagnostic.finalRedeclarationBySubclass().format({
@@ -3144,12 +3160,13 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
3144
3160
  // Verify that the parameter types match.
3145
3161
  let paramIndex = 1;
3146
3162
  initOnlySymbolMap.forEach((symbol, fieldName) => {
3163
+ var _a;
3147
3164
  if (paramIndex >= paramListDetails.params.length) {
3148
3165
  return;
3149
3166
  }
3150
3167
  const param = paramListDetails.params[paramIndex].param;
3151
3168
  if (param.hasDeclaredType && param.typeAnnotation) {
3152
- const fieldType = this._evaluator.getDeclaredTypeOfSymbol(symbol);
3169
+ const fieldType = (_a = this._evaluator.getDeclaredTypeOfSymbol(symbol)) === null || _a === void 0 ? void 0 : _a.type;
3153
3170
  const paramType = types_1.FunctionType.getEffectiveParameterType(postInitType, paramListDetails.params[paramIndex].index);
3154
3171
  const assignTypeDiag = new diagnostic_1.DiagnosticAddendum();
3155
3172
  if (fieldType && !this._evaluator.assignType(paramType, fieldType, assignTypeDiag)) {
@@ -3653,7 +3670,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
3653
3670
  }
3654
3671
  // If the symbol has no declaration, and the type is inferred,
3655
3672
  // skip this check.
3656
- if (!symbol.hasTypedDeclarations() && !(0, symbolUtils_1.isFinalVariable)(symbol)) {
3673
+ if (!symbol.hasTypedDeclarations() && !this._evaluator.isFinalVariable(symbol)) {
3657
3674
  return;
3658
3675
  }
3659
3676
  // Get the symbol type defined in this class.
@@ -3874,8 +3891,8 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
3874
3891
  }
3875
3892
  }
3876
3893
  // Verify that there is not a Final mismatch.
3877
- const isBaseVarFinal = (0, symbolUtils_1.isFinalVariable)(baseClassAndSymbol.symbol);
3878
- const overrideFinalVarDecl = decls.find((d) => (0, declarationUtils_1.isFinalVariableDeclaration)(d));
3894
+ const isBaseVarFinal = this._evaluator.isFinalVariable(baseClassAndSymbol.symbol);
3895
+ const overrideFinalVarDecl = decls.find((d) => this._evaluator.isFinalVariableDeclaration(d));
3879
3896
  if (!isBaseVarFinal && overrideFinalVarDecl) {
3880
3897
  const diag = this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride, diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, localize_1.Localizer.Diagnostic.variableFinalOverride().format({
3881
3898
  name: memberName,
@@ -3939,7 +3956,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
3939
3956
  // __new__ overrides should have a "cls" parameter.
3940
3957
  if (node.parameters.length === 0 ||
3941
3958
  !node.parameters[0].name ||
3942
- !['cls', '_cls', '__cls', '__mcls'].some((name) => node.parameters[0].name.value === name)) {
3959
+ !['cls', '_cls', '__cls', '__mcls', 'mcls', 'mcs'].some((name) => node.parameters[0].name.value === name)) {
3943
3960
  this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName, diagnosticRules_1.DiagnosticRule.reportSelfClsParameterName, localize_1.Localizer.Diagnostic.newClsParam(), node.parameters.length > 0 ? node.parameters[0] : node.name);
3944
3961
  }
3945
3962
  if (classType) {
@@ -4012,9 +4029,9 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
4012
4029
  }
4013
4030
  // Instance methods should have a "self" parameter.
4014
4031
  if (firstParamIsSimple && paramName !== 'self') {
4015
- // Special-case metaclasses, which can use "cls".
4032
+ // Special-case metaclasses, which can use "cls" or several variants.
4016
4033
  let isLegalMetaclassName = false;
4017
- if (paramName === 'cls') {
4034
+ if (['cls', 'mcls', 'mcs'].some((name) => name === paramName)) {
4018
4035
  const classTypeInfo = this._evaluator.getTypeOfClass(classNode);
4019
4036
  const typeType = this._evaluator.getBuiltInType(classNode, 'type');
4020
4037
  if (typeType &&