@zzzen/pyright-internal 1.2.0-dev.20240225 → 1.2.0-dev.20240310
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/backgroundAnalysisProgram.d.ts +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +4 -3
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +20 -10
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +5 -4
- package/dist/analyzer/codeFlowEngine.js +32 -20
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/enums.js +9 -2
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importStatementUtils.d.ts +2 -1
- package/dist/analyzer/importStatementUtils.js +6 -1
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/operations.js +29 -5
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +14 -6
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parameterUtils.js +4 -3
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +2 -0
- package/dist/analyzer/parseTreeUtils.js +30 -4
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/service.d.ts +6 -1
- package/dist/analyzer/service.js +8 -5
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +3 -3
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +112 -72
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeGuards.js +7 -5
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +2 -0
- package/dist/analyzer/typeUtils.js +41 -5
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/types.js +1 -1
- package/dist/analyzer/types.js.map +1 -1
- package/dist/common/configOptions.d.ts +2 -2
- package/dist/common/configOptions.js +21 -4
- package/dist/common/configOptions.js.map +1 -1
- package/dist/languageServerBase.d.ts +2 -2
- package/dist/languageServerBase.js +1 -8
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +4 -1
- package/dist/languageService/completionProvider.js +19 -19
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +1 -0
- package/dist/localization/localize.js +1 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +6 -4
- package/dist/localization/package.nls.de.json +6 -4
- package/dist/localization/package.nls.en-us.json +1 -0
- package/dist/localization/package.nls.es.json +6 -4
- package/dist/localization/package.nls.fr.json +8 -6
- package/dist/localization/package.nls.it.json +5 -3
- package/dist/localization/package.nls.ja.json +6 -4
- package/dist/localization/package.nls.ko.json +6 -4
- package/dist/localization/package.nls.pl.json +6 -4
- package/dist/localization/package.nls.pt-br.json +6 -4
- package/dist/localization/package.nls.qps-ploc.json +6 -4
- package/dist/localization/package.nls.ru.json +6 -4
- package/dist/localization/package.nls.tr.json +6 -4
- package/dist/localization/package.nls.zh-cn.json +3 -1
- package/dist/localization/package.nls.zh-tw.json +6 -4
- package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.js +22 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.nameconflict.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.nameconflict.fourslash.js +17 -0
- package/dist/tests/fourslash/import.nameconflict.fourslash.js.map +1 -0
- package/dist/tests/importStatementUtils.test.js +27 -2
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/tokenizer.test.js +22 -0
- package/dist/tests/tokenizer.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +5 -1
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +1 -1
- package/dist/tests/typeEvaluator3.test.js +21 -1
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +2 -2
- package/dist/tests/typeEvaluator5.test.js +1 -3
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"typeDocStringUtils.js","sourceRoot":"","sources":["../../../../../src/analyzer/typeDocStringUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAUiC;AACjC,2EAA6D;AAC7D,2DAAoE;AACpE,6CAU2B;AAC3B,+DAAsE;AAItE,2CAMqB;AAErB,MAAM,qCAAqC,GACvC;kDACqC;+CACF;gDACA,CAAC;AAExC,SAAS,sBAAsB,CAAC,IAA2C,EAAE,SAAqB;IAC9F,IAAI,IAAI,CAAC,QAAQ,4CAAoC,EAAE;QACnD,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7B,OAAO,KAAK,CAAC;SAChB;QACD,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC5B;IAED,+DAA+D;IAC/D,+BAA+B;IAC/B,OAAO,CACH,IAAI,CAAC,OAAO,CAAC,
|
1
|
+
{"version":3,"file":"typeDocStringUtils.js","sourceRoot":"","sources":["../../../../../src/analyzer/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EAAE;QACxC,SAAS,GAAG,oCAAoC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;KAC5F;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,SAAS,oCAAoC,CAAC,YAAiC,EAAE,YAA0B;IACvG,IAAI,SAAS,GAAG,iCAAiC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,SAAS,IAAI,IAAA,yBAAU,EAAC,YAAY,CAAC,GAAG,CAAC,EAAE;QAC5C,MAAM,SAAS,GAAG,YAAY,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;QACtE,SAAS,GAAG,iCAAiC,CAAC,SAAS,CAAC,CAAC;KAC5D;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,SAAS,iCAAiC,CAAC,KAAiD;IACxF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,MAAM,SAAS,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,SAAS,EAAE;YACX,OAAO,SAAS,CAAC;SACpB;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
@@ -805,6 +805,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
805
805
|
const exprTypeResult = getTypeOfExpression(node.expression, flags, (0, typeUtils_1.makeInferenceContext)(effectiveExpectedType));
|
806
806
|
const typeResult = {
|
807
807
|
type: getTypeOfAwaitable(exprTypeResult.type, node.expression),
|
808
|
+
isIncomplete: exprTypeResult.isIncomplete,
|
809
|
+
typeErrors: exprTypeResult.typeErrors,
|
808
810
|
};
|
809
811
|
if (exprTypeResult.isIncomplete) {
|
810
812
|
typeResult.isIncomplete = true;
|
@@ -1549,7 +1551,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1549
1551
|
// see if we can find a better signature from the `__new__` method.
|
1550
1552
|
if (!constructorType || isObjectInit || isDefaultParams) {
|
1551
1553
|
const newMethodResult = (0, constructors_1.getBoundNewMethod)(evaluatorInterface, callNode, subtype, 0 /* MemberAccessFlags.Default */);
|
1552
|
-
if (newMethodResult && !newMethodResult.typeErrors
|
1554
|
+
if (newMethodResult && !newMethodResult.typeErrors) {
|
1553
1555
|
if ((0, types_1.isFunction)(newMethodResult.type) &&
|
1554
1556
|
newMethodResult.type.details.fullName !== 'builtins.object.__new__') {
|
1555
1557
|
constructorType = newMethodResult.type;
|
@@ -2032,14 +2034,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2032
2034
|
// Although isFlowNodeReachable indicates that the node is reachable, it
|
2033
2035
|
// may not be reachable if we apply "never narrowing".
|
2034
2036
|
function isFlowNodeReachableUsingNeverNarrowing(node, flowNode) {
|
2035
|
-
const analyzer = getCodeFlowAnalyzerForNode(node.id);
|
2037
|
+
const analyzer = getCodeFlowAnalyzerForNode(node.id, /* typeAtStart */ undefined);
|
2036
2038
|
if (checkCodeFlowTooComplex(node)) {
|
2037
2039
|
return true;
|
2038
2040
|
}
|
2039
|
-
const codeFlowResult = analyzer.getTypeFromCodeFlow(flowNode,
|
2040
|
-
|
2041
|
-
|
2042
|
-
/* typeAtStart */ types_1.UnboundType.create());
|
2041
|
+
const codeFlowResult = analyzer.getTypeFromCodeFlow(flowNode, /* reference */ undefined, {
|
2042
|
+
typeAtStart: { type: types_1.UnboundType.create() },
|
2043
|
+
});
|
2043
2044
|
return codeFlowResult.type !== undefined && !(0, types_1.isNever)(codeFlowResult.type);
|
2044
2045
|
}
|
2045
2046
|
// Determines whether there is a code flow path from sourceNode to sinkNode.
|
@@ -2194,8 +2195,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2194
2195
|
if (expectedTypeDiagAddendum) {
|
2195
2196
|
diagAddendum = expectedTypeDiagAddendum;
|
2196
2197
|
}
|
2197
|
-
|
2198
|
-
|
2198
|
+
if (!isTypeIncomplete) {
|
2199
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssignmentType, localize_1.LocMessage.typeAssignmentMismatch().format(printSrcDestTypes(type, declaredType)) +
|
2200
|
+
diagAddendum.getString(), srcExpression !== null && srcExpression !== void 0 ? srcExpression : nameNode, (_c = (_b = diagAddendum.getEffectiveTextRange()) !== null && _b !== void 0 ? _b : srcExpression) !== null && _c !== void 0 ? _c : nameNode);
|
2201
|
+
}
|
2199
2202
|
// Replace the assigned type with the (unnarrowed) declared type.
|
2200
2203
|
destType = declaredType;
|
2201
2204
|
}
|
@@ -2218,12 +2221,15 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2218
2221
|
}
|
2219
2222
|
}
|
2220
2223
|
}
|
2221
|
-
const
|
2224
|
+
const varDeclIndex = declarations.findIndex((decl) => decl.type === 1 /* DeclarationType.Variable */);
|
2225
|
+
const varDecl = varDeclIndex >= 0 ? declarations[varDeclIndex] : undefined;
|
2226
|
+
// Are there any non-var decls before the var decl?
|
2227
|
+
const nonVarDecl = declarations.find((decl, index) => varDeclIndex < index && decl.type !== 1 /* DeclarationType.Variable */);
|
2222
2228
|
if (varDecl && varDecl.type === 1 /* DeclarationType.Variable */) {
|
2223
2229
|
if (varDecl.isConstant) {
|
2224
2230
|
// A constant variable can be assigned only once. If this
|
2225
2231
|
// isn't the first assignment, generate an error.
|
2226
|
-
if (nameNode !== (0, declarationUtils_1.getNameNodeForDeclaration)(declarations[0])) {
|
2232
|
+
if (nameNode !== (0, declarationUtils_1.getNameNodeForDeclaration)(declarations[0]) || !!nonVarDecl) {
|
2227
2233
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportConstantRedefinition, localize_1.LocMessage.constantRedefinition().format({ name: nameValue }), nameNode);
|
2228
2234
|
}
|
2229
2235
|
}
|
@@ -2967,6 +2973,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2967
2973
|
// type. If it's declared inside our execution scope, it generally starts
|
2968
2974
|
// as unbound at the start of the code flow.
|
2969
2975
|
let typeAtStart = effectiveType;
|
2976
|
+
let isTypeAtStartIncomplete = false;
|
2970
2977
|
if (!symbolWithScope.isBeyondExecutionScope && symbol.isInitiallyUnbound()) {
|
2971
2978
|
typeAtStart = types_1.UnboundType.create();
|
2972
2979
|
// Is this a module-level scope? If so, see if it's an alias of a builtin.
|
@@ -2979,8 +2986,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2979
2986
|
}
|
2980
2987
|
}
|
2981
2988
|
}
|
2982
|
-
|
2983
|
-
|
2989
|
+
if (symbolWithScope.isBeyondExecutionScope) {
|
2990
|
+
const outerScopeTypeResult = getCodeFlowTypeForCapturedVariable(node, symbolWithScope, effectiveType);
|
2991
|
+
if (outerScopeTypeResult === null || outerScopeTypeResult === void 0 ? void 0 : outerScopeTypeResult.type) {
|
2992
|
+
type = outerScopeTypeResult.type;
|
2993
|
+
typeAtStart = type;
|
2994
|
+
isTypeAtStartIncomplete = !!outerScopeTypeResult.isIncomplete;
|
2995
|
+
}
|
2996
|
+
}
|
2997
|
+
const codeFlowTypeResult = getFlowTypeOfReference(node, /* startNode */ undefined, {
|
2998
|
+
targetSymbolId: symbol.id,
|
2999
|
+
typeAtStart: { type: typeAtStart, isIncomplete: isTypeAtStartIncomplete },
|
2984
3000
|
skipConditionalNarrowing: (flags & 256 /* EvaluatorFlags.ExpectingTypeAnnotation */) !== 0,
|
2985
3001
|
});
|
2986
3002
|
if (codeFlowTypeResult.type) {
|
@@ -2989,15 +3005,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2989
3005
|
if (codeFlowTypeResult.isIncomplete) {
|
2990
3006
|
isIncomplete = true;
|
2991
3007
|
}
|
2992
|
-
if (!codeFlowTypeResult.type && symbolWithScope.isBeyondExecutionScope) {
|
2993
|
-
const outerScopeTypeResult = getCodeFlowTypeForCapturedVariable(node, symbolWithScope, effectiveType);
|
2994
|
-
if (outerScopeTypeResult === null || outerScopeTypeResult === void 0 ? void 0 : outerScopeTypeResult.type) {
|
2995
|
-
type = outerScopeTypeResult.type;
|
2996
|
-
}
|
2997
|
-
if (outerScopeTypeResult === null || outerScopeTypeResult === void 0 ? void 0 : outerScopeTypeResult.isIncomplete) {
|
2998
|
-
isIncomplete = true;
|
2999
|
-
}
|
3000
|
-
}
|
3001
3008
|
}
|
3002
3009
|
// Detect, report, and fill in missing type arguments if appropriate.
|
3003
3010
|
type = reportMissingTypeArguments(node, type, flags);
|
@@ -3133,7 +3140,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3133
3140
|
if (symbolWithScope.symbol.isInitiallyUnbound()) {
|
3134
3141
|
typeAtStart = types_1.UnboundType.create();
|
3135
3142
|
}
|
3136
|
-
return getFlowTypeOfReference(node,
|
3143
|
+
return getFlowTypeOfReference(node, innerScopeNode, {
|
3144
|
+
targetSymbolId: symbolWithScope.symbol.id,
|
3145
|
+
typeAtStart: { type: typeAtStart },
|
3146
|
+
});
|
3137
3147
|
}
|
3138
3148
|
}
|
3139
3149
|
}
|
@@ -3457,9 +3467,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3457
3467
|
}
|
3458
3468
|
}
|
3459
3469
|
// See if we can refine the type based on code flow analysis.
|
3460
|
-
const codeFlowTypeResult = getFlowTypeOfReference(node,
|
3461
|
-
|
3462
|
-
isTypeAtStartIncomplete,
|
3470
|
+
const codeFlowTypeResult = getFlowTypeOfReference(node, /* startNode */ undefined, {
|
3471
|
+
targetSymbolId: symbol_1.indeterminateSymbolId,
|
3472
|
+
typeAtStart: { type: typeAtStart, isIncomplete: isTypeAtStartIncomplete },
|
3463
3473
|
skipConditionalNarrowing: (flags & 256 /* EvaluatorFlags.ExpectingTypeAnnotation */) !== 0,
|
3464
3474
|
});
|
3465
3475
|
if (codeFlowTypeResult.type) {
|
@@ -4385,11 +4395,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
4385
4395
|
});
|
4386
4396
|
if (baseTypeSupportsIndexNarrowing) {
|
4387
4397
|
// Before performing code flow analysis, update the cache to prevent recursion.
|
4388
|
-
writeTypeCache(node, indexTypeResult, flags);
|
4398
|
+
writeTypeCache(node, { ...indexTypeResult, isIncomplete: true }, flags);
|
4389
4399
|
// See if we can refine the type based on code flow analysis.
|
4390
|
-
const codeFlowTypeResult = getFlowTypeOfReference(node,
|
4391
|
-
|
4392
|
-
|
4400
|
+
const codeFlowTypeResult = getFlowTypeOfReference(node, /* startNode */ undefined, {
|
4401
|
+
targetSymbolId: symbol_1.indeterminateSymbolId,
|
4402
|
+
typeAtStart: {
|
4403
|
+
type: indexTypeResult.type,
|
4404
|
+
isIncomplete: !!baseTypeResult.isIncomplete || !!indexTypeResult.isIncomplete,
|
4405
|
+
},
|
4393
4406
|
skipConditionalNarrowing: (flags & 256 /* EvaluatorFlags.ExpectingTypeAnnotation */) !== 0,
|
4394
4407
|
});
|
4395
4408
|
if (codeFlowTypeResult.type) {
|
@@ -4750,8 +4763,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
4750
4763
|
return createLiteralType(concreteSubtype, node, flags);
|
4751
4764
|
}
|
4752
4765
|
if (types_1.ClassType.isBuiltIn(concreteSubtype, 'InitVar')) {
|
4753
|
-
// Special-case InitVar, used in
|
4766
|
+
// Special-case InitVar, used in dataclasses.
|
4754
4767
|
const typeArgs = getTypeArgs(node, flags);
|
4768
|
+
if ((flags & 256 /* EvaluatorFlags.ExpectingTypeAnnotation */) !== 0) {
|
4769
|
+
if ((flags & 32768 /* EvaluatorFlags.VariableTypeAnnotation */) === 0) {
|
4770
|
+
addError(localize_1.LocMessage.initVarNotAllowed(), node.baseExpression);
|
4771
|
+
}
|
4772
|
+
}
|
4755
4773
|
if (typeArgs.length === 1) {
|
4756
4774
|
return typeArgs[0].type;
|
4757
4775
|
}
|
@@ -6690,12 +6708,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
6690
6708
|
if (expandedCallType.details.name === 'type' && argList.length === 1) {
|
6691
6709
|
const argType = getTypeOfArgument(argList[0]).type;
|
6692
6710
|
const returnType = (0, typeUtils_1.mapSubtypes)(argType, (subtype) => {
|
6711
|
+
var _a;
|
6712
|
+
if ((0, types_1.isInstantiableClass)(subtype)) {
|
6713
|
+
return (_a = subtype.details.effectiveMetaclass) !== null && _a !== void 0 ? _a : types_1.AnyType.create();
|
6714
|
+
}
|
6693
6715
|
if ((0, types_1.isClassInstance)(subtype) ||
|
6694
6716
|
((0, types_1.isTypeVar)(subtype) && types_1.TypeBase.isInstance(subtype)) ||
|
6695
6717
|
(0, typeUtils_1.isNoneInstance)(subtype)) {
|
6696
6718
|
return (0, typeUtils_1.convertToInstantiable)(stripLiteralValue(subtype));
|
6697
6719
|
}
|
6698
|
-
|
6720
|
+
if ((0, types_1.isFunction)(subtype) && types_1.TypeBase.isInstance(subtype)) {
|
6699
6721
|
return types_1.FunctionType.cloneAsInstantiable(subtype);
|
6700
6722
|
}
|
6701
6723
|
return types_1.AnyType.create();
|
@@ -8981,6 +9003,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8981
9003
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.newTypeAnyOrUnknown(), (_c = argList[1].node) !== null && _c !== void 0 ? _c : errorNode);
|
8982
9004
|
isBaseClassAny = true;
|
8983
9005
|
}
|
9006
|
+
// Specifically disallow Annotated.
|
9007
|
+
if (baseClass.specialForm &&
|
9008
|
+
(0, types_1.isInstantiableClass)(baseClass.specialForm) &&
|
9009
|
+
types_1.ClassType.isBuiltIn(baseClass.specialForm, 'Annotated')) {
|
9010
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.newTypeNotAClass(), argList[1].node || errorNode);
|
9011
|
+
return undefined;
|
9012
|
+
}
|
8984
9013
|
if (!(0, types_1.isInstantiableClass)(baseClass)) {
|
8985
9014
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.newTypeNotAClass(), argList[1].node || errorNode);
|
8986
9015
|
return undefined;
|
@@ -13857,12 +13886,30 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
13857
13886
|
}
|
13858
13887
|
return undefined;
|
13859
13888
|
}
|
13860
|
-
function getCodeFlowAnalyzerForNode(nodeId) {
|
13861
|
-
let
|
13862
|
-
if (
|
13863
|
-
|
13864
|
-
|
13865
|
-
|
13889
|
+
function getCodeFlowAnalyzerForNode(nodeId, typeAtStart) {
|
13890
|
+
let entries = codeFlowAnalyzerCache.get(nodeId);
|
13891
|
+
if (entries) {
|
13892
|
+
const cachedEntry = entries.find((entry) => {
|
13893
|
+
if (!typeAtStart || !entry.typeAtStart) {
|
13894
|
+
return !typeAtStart && !entry.typeAtStart;
|
13895
|
+
}
|
13896
|
+
if (!typeAtStart.isIncomplete !== !entry.typeAtStart.isIncomplete) {
|
13897
|
+
return false;
|
13898
|
+
}
|
13899
|
+
return (0, types_1.isTypeSame)(typeAtStart.type, entry.typeAtStart.type);
|
13900
|
+
});
|
13901
|
+
if (cachedEntry) {
|
13902
|
+
return cachedEntry.codeFlowAnalyzer;
|
13903
|
+
}
|
13904
|
+
}
|
13905
|
+
// Allocate a new code flow analyzer.
|
13906
|
+
const analyzer = codeFlowEngine.createCodeFlowAnalyzer(typeAtStart);
|
13907
|
+
if (entries) {
|
13908
|
+
entries.push({ typeAtStart, codeFlowAnalyzer: analyzer });
|
13909
|
+
}
|
13910
|
+
else {
|
13911
|
+
entries = [{ typeAtStart, codeFlowAnalyzer: analyzer }];
|
13912
|
+
codeFlowAnalyzerCache.set(nodeId, entries);
|
13866
13913
|
}
|
13867
13914
|
return analyzer;
|
13868
13915
|
}
|
@@ -13872,7 +13919,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
13872
13919
|
// flow analysis starts from the reference node, but startNode can be
|
13873
13920
|
// specified to override this in a few special cases (functions and
|
13874
13921
|
// lambdas) to support analysis of captured variables.
|
13875
|
-
function getFlowTypeOfReference(reference,
|
13922
|
+
function getFlowTypeOfReference(reference, startNode, options) {
|
13876
13923
|
var _a;
|
13877
13924
|
// See if this execution scope requires code flow for this reference expression.
|
13878
13925
|
const referenceKey = (0, codeFlowTypes_1.createKeyForReference)(reference);
|
@@ -13895,13 +13942,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
13895
13942
|
analyzer = getCodeFlowAnalyzerForReturnTypeInferenceContext();
|
13896
13943
|
}
|
13897
13944
|
else {
|
13898
|
-
analyzer = getCodeFlowAnalyzerForNode(executionNode.id);
|
13945
|
+
analyzer = getCodeFlowAnalyzerForNode(executionNode.id, options === null || options === void 0 ? void 0 : options.typeAtStart);
|
13899
13946
|
}
|
13900
13947
|
const flowNode = AnalyzerNodeInfo.getFlowNode(startNode !== null && startNode !== void 0 ? startNode : reference);
|
13901
13948
|
if (flowNode === undefined) {
|
13902
13949
|
return { type: undefined, isIncomplete: false };
|
13903
13950
|
}
|
13904
|
-
return analyzer.getTypeFromCodeFlow(flowNode, reference,
|
13951
|
+
return analyzer.getTypeFromCodeFlow(flowNode, reference, options);
|
13905
13952
|
}
|
13906
13953
|
// Specializes the specified (potentially generic) class type using
|
13907
13954
|
// the specified type arguments, reporting errors as appropriate.
|
@@ -14006,10 +14053,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
14006
14053
|
return createRequiredOrReadOnlyType(classType, errorNode, typeArgs, flags);
|
14007
14054
|
}
|
14008
14055
|
case 'ReadOnly': {
|
14009
|
-
|
14010
|
-
return createRequiredOrReadOnlyType(classType, errorNode, typeArgs, flags);
|
14011
|
-
}
|
14012
|
-
break;
|
14056
|
+
return createRequiredOrReadOnlyType(classType, errorNode, typeArgs, flags);
|
14013
14057
|
}
|
14014
14058
|
case 'Self': {
|
14015
14059
|
return { type: createSelfType(classType, errorNode, typeArgs, flags) };
|
@@ -15561,7 +15605,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15561
15605
|
// into account argument types to infer the return type.
|
15562
15606
|
function getFunctionEffectiveReturnType(type, args, inferTypeIfNeeded = true) {
|
15563
15607
|
const specializedReturnType = types_1.FunctionType.getSpecializedReturnType(type, /* includeInferred */ false);
|
15564
|
-
if (specializedReturnType) {
|
15608
|
+
if (specializedReturnType && !(0, types_1.isUnknown)(specializedReturnType)) {
|
15565
15609
|
return adjustCallableReturnType(specializedReturnType, /* trackedSignatures */ undefined);
|
15566
15610
|
}
|
15567
15611
|
if (inferTypeIfNeeded) {
|
@@ -15707,7 +15751,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15707
15751
|
const prevTypeCache = returnTypeInferenceTypeCache;
|
15708
15752
|
returnTypeInferenceContextStack.push({
|
15709
15753
|
functionNode,
|
15710
|
-
codeFlowAnalyzer: codeFlowEngine.createCodeFlowAnalyzer(),
|
15754
|
+
codeFlowAnalyzer: codeFlowEngine.createCodeFlowAnalyzer(/* typeAtStart */ undefined),
|
15711
15755
|
});
|
15712
15756
|
try {
|
15713
15757
|
returnTypeInferenceTypeCache = new Map();
|
@@ -15906,22 +15950,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15906
15950
|
}
|
15907
15951
|
}
|
15908
15952
|
}
|
15909
|
-
// See if the dest type is a TypedDict class and the source is a compatible dict.
|
15910
|
-
if (types_1.ClassType.isTypedDictClass(destType) && types_1.ClassType.isBuiltIn(srcType, 'dict')) {
|
15911
|
-
if (srcType.typeArguments &&
|
15912
|
-
srcType.typeArguments.length === 2 &&
|
15913
|
-
(0, types_1.isClassInstance)(srcType.typeArguments[0]) &&
|
15914
|
-
types_1.ClassType.isBuiltIn(srcType.typeArguments[0], 'str')) {
|
15915
|
-
const dictValueType = (0, typedDicts_1.getTypedDictDictEquivalent)(evaluatorInterface, destType, recursionCount);
|
15916
|
-
if (dictValueType &&
|
15917
|
-
assignType(dictValueType, srcType.typeArguments[1],
|
15918
|
-
/* diag */ undefined,
|
15919
|
-
/* destTypeVarContext */ undefined,
|
15920
|
-
/* srcTypeVarContext */ undefined, 1 /* AssignTypeFlags.EnforceInvariance */, recursionCount + 1)) {
|
15921
|
-
return true;
|
15922
|
-
}
|
15923
|
-
}
|
15924
|
-
}
|
15925
15953
|
// Handle special-case type promotions.
|
15926
15954
|
if (destType.includePromotions) {
|
15927
15955
|
const promotionList = typePromotions.get(destType.details.fullName);
|
@@ -16168,15 +16196,23 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16168
16196
|
if ((0, types_1.isVariadicTypeVar)(destTypeArgs[destUnboundedOrVariadicIndex].type)) {
|
16169
16197
|
if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
|
16170
16198
|
const removedArgs = srcTypeArgs.splice(destUnboundedOrVariadicIndex, srcArgsToCapture);
|
16171
|
-
|
16172
|
-
|
16173
|
-
|
16174
|
-
|
16175
|
-
|
16176
|
-
|
16177
|
-
|
16178
|
-
|
16179
|
-
|
16199
|
+
let variadicTuple;
|
16200
|
+
// If we're left with a single unpacked variadic type var, there's no
|
16201
|
+
// need to wrap it in a nested tuple.
|
16202
|
+
if (removedArgs.length === 1 && (0, types_1.isUnpackedVariadicTypeVar)(removedArgs[0].type)) {
|
16203
|
+
variadicTuple = removedArgs[0].type;
|
16204
|
+
}
|
16205
|
+
else {
|
16206
|
+
// Package up the remaining type arguments into a tuple object.
|
16207
|
+
variadicTuple = makeTupleObject(removedArgs.map((typeArg) => {
|
16208
|
+
return {
|
16209
|
+
type: typeArg.type,
|
16210
|
+
isUnbounded: typeArg.isUnbounded,
|
16211
|
+
isOptional: typeArg.isOptional,
|
16212
|
+
};
|
16213
|
+
}),
|
16214
|
+
/* isUnpackedTuple */ true);
|
16215
|
+
}
|
16180
16216
|
srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
|
16181
16217
|
type: variadicTuple,
|
16182
16218
|
isUnbounded: false,
|
@@ -17396,6 +17432,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
17396
17432
|
if ((0, types_1.isTypeSame)(destType, srcSubtype, { ignorePseudoGeneric: true }, recursionCount)) {
|
17397
17433
|
return false;
|
17398
17434
|
}
|
17435
|
+
if ((0, typeUtils_1.isIncompleteUnknown)(srcSubtype)) {
|
17436
|
+
return false;
|
17437
|
+
}
|
17399
17438
|
const destTypeVarName = types_1.TypeVarType.getNameWithScope(destType);
|
17400
17439
|
// Determine which conditions on this type apply to this type variable.
|
17401
17440
|
// There might be more than one of them.
|
@@ -18373,9 +18412,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
18373
18412
|
!(0, symbolNameUtils_1.isPrivateOrProtectedName)(baseParam.name || '') &&
|
18374
18413
|
baseParamDetails.params[i].source !== parameterUtils_1.ParameterSource.PositionOnly &&
|
18375
18414
|
baseParam.category === 0 /* ParameterCategory.Simple */ &&
|
18415
|
+
enforceParamNames &&
|
18376
18416
|
baseParam.name !== overrideParam.name) {
|
18377
18417
|
if (overrideParam.category === 0 /* ParameterCategory.Simple */) {
|
18378
|
-
if (
|
18418
|
+
if (!baseParam.isNameSynthesized) {
|
18379
18419
|
if (overrideParamDetails.params[i].source === parameterUtils_1.ParameterSource.PositionOnly) {
|
18380
18420
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideParamNamePositionOnly().format({
|
18381
18421
|
index: i + 1,
|