@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.
- package/dist/analyzer/binder.d.ts +0 -1
- package/dist/analyzer/binder.js +32 -95
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +48 -31
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.js +4 -4
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/commentUtils.js +11 -1
- package/dist/analyzer/commentUtils.js.map +1 -1
- package/dist/analyzer/constructorTransform.d.ts +1 -0
- package/dist/analyzer/constructorTransform.js +19 -2
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +2 -4
- package/dist/analyzer/declaration.js +6 -1
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +1 -5
- package/dist/analyzer/declarationUtils.js +2 -47
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +9 -3
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +40 -40
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +4 -2
- package/dist/analyzer/parseTreeUtils.js +77 -2
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/patternMatching.js +20 -1
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +1 -0
- package/dist/analyzer/program.js +154 -13
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +3 -2
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +4 -2
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js +27 -13
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/service.js +6 -1
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js +12 -1
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/symbol.js +1 -4
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/symbolUtils.d.ts +0 -3
- package/dist/analyzer/symbolUtils.js +1 -14
- package/dist/analyzer/symbolUtils.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +5 -3
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +642 -259
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +11 -2
- package/dist/analyzer/typeGuards.js +2 -2
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.js +63 -55
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +2 -0
- package/dist/analyzer/typeUtils.js +22 -3
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.d.ts +2 -1
- package/dist/analyzer/typedDicts.js +83 -57
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +3 -1
- package/dist/analyzer/types.js +8 -0
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +78 -0
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/collectionUtils.d.ts +1 -0
- package/dist/common/collectionUtils.js +8 -1
- package/dist/common/collectionUtils.js.map +1 -1
- package/dist/common/extensibility.js +25 -1
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/positionUtils.d.ts +2 -0
- package/dist/common/positionUtils.js +15 -1
- package/dist/common/positionUtils.js.map +1 -1
- package/dist/languageServerBase.js +9 -1
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +4 -2
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +4 -2
- package/dist/languageService/completionProvider.js +252 -191
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +1 -1
- package/dist/languageService/completionProviderUtils.js +3 -3
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.js +2 -1
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.js +2 -1
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.js +11 -3
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importAdder.js +4 -1
- package/dist/languageService/importAdder.js.map +1 -1
- package/dist/languageService/indentationUtils.d.ts +1 -1
- package/dist/languageService/indentationUtils.js +22 -12
- package/dist/languageService/indentationUtils.js.map +1 -1
- package/dist/languageService/renameModuleProvider.d.ts +1 -1
- package/dist/languageService/renameModuleProvider.js +28 -8
- package/dist/languageService/renameModuleProvider.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +2 -1
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/localization/localize.d.ts +12 -2
- package/dist/localization/localize.js +5 -1
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +6 -2
- package/dist/parser/parser.js +40 -25
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/tests/completions.test.js +445 -0
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/docStringConversion.test.js +23 -0
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js +13 -3
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js +7 -2
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.errorNodes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.errorNodes.fourslash.js +24 -0
- package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.slots.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.slots.fourslash.js +16 -0
- package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -0
- package/dist/tests/hoverProvider.test.js +1 -1
- package/dist/tests/hoverProvider.test.js.map +1 -1
- package/dist/tests/importAdder.test.js +13 -0
- package/dist/tests/importAdder.test.js.map +1 -1
- package/dist/tests/indentationUtils.reindent.test.js +21 -0
- package/dist/tests/indentationUtils.reindent.test.js.map +1 -1
- package/dist/tests/moveSymbol.importAdder.test.js +137 -31
- package/dist/tests/moveSymbol.importAdder.test.js.map +1 -1
- package/dist/tests/moveSymbol.insertion.test.js +98 -0
- package/dist/tests/moveSymbol.insertion.test.js.map +1 -1
- package/dist/tests/moveSymbol.misc.test.js +27 -0
- package/dist/tests/moveSymbol.misc.test.js.map +1 -1
- package/dist/tests/renameModuleTestUtils.d.ts +1 -1
- package/dist/tests/renameModuleTestUtils.js +9 -5
- package/dist/tests/renameModuleTestUtils.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +8 -0
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +5 -1
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +20 -4
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +4 -0
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +6 -0
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/package.json +1 -1
package/dist/analyzer/checker.js
CHANGED
@@ -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 (
|
275
|
-
((0, types_1.
|
276
|
-
paramType
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
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 (!
|
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 (
|
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) =>
|
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
|
-
|
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() && !
|
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 =
|
3878
|
-
const overrideFinalVarDecl = decls.find((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 (
|
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 &&
|