@zzzen/pyright-internal 1.2.0-dev.20241013 → 1.2.0-dev.20241027
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.js +61 -37
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +3 -16
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +11 -1
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructorTransform.js +3 -6
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/dataClasses.js +9 -18
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declarationUtils.js +1 -3
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/importResolver.js +2 -10
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/operations.js +2 -2
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.js +4 -0
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/service.js +5 -5
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/symbol.d.ts +8 -3
- package/dist/analyzer/symbol.js +4 -4
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +185 -103
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +6 -8
- package/dist/analyzer/typeEvaluatorTypes.js +5 -3
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +6 -8
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +1 -1
- package/dist/analyzer/typePrinter.js +17 -17
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +7 -2
- package/dist/analyzer/typeUtils.js +35 -10
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +41 -30
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +4 -2
- package/dist/analyzer/types.js +6 -12
- package/dist/analyzer/types.js.map +1 -1
- package/dist/common/configOptions.d.ts +1 -1
- package/dist/common/configOptions.js +4 -3
- package/dist/common/configOptions.js.map +1 -1
- package/dist/languageService/completionProvider.js +5 -3
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +2 -0
- package/dist/languageService/definitionProvider.js +21 -5
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.js +5 -4
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +8 -0
- package/dist/localization/localize.js +12 -1
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +3 -1
- package/dist/localization/package.nls.de.json +3 -1
- package/dist/localization/package.nls.en-us.json +11 -2
- package/dist/localization/package.nls.es.json +3 -1
- package/dist/localization/package.nls.fr.json +3 -1
- package/dist/localization/package.nls.it.json +3 -1
- package/dist/localization/package.nls.ja.json +3 -1
- package/dist/localization/package.nls.ko.json +3 -1
- package/dist/localization/package.nls.pl.json +3 -1
- package/dist/localization/package.nls.pt-br.json +3 -1
- package/dist/localization/package.nls.qps-ploc.json +3 -1
- package/dist/localization/package.nls.ru.json +3 -1
- package/dist/localization/package.nls.tr.json +3 -1
- package/dist/localization/package.nls.zh-cn.json +3 -1
- package/dist/localization/package.nls.zh-tw.json +3 -1
- package/dist/parser/tokenizer.d.ts +1 -0
- package/dist/parser/tokenizer.js +8 -0
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/server.d.ts +1 -2
- package/dist/tests/fourslash/import.multipart2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.multipart2.fourslash.js +20 -0
- package/dist/tests/fourslash/import.multipart2.fourslash.js.map +1 -0
- package/dist/tests/typeEvaluator2.test.js +4 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +4 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +7 -3
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +9 -3
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typeEvaluator6.test.js +1 -1
- package/dist/tests/typeEvaluator8.test.js +8 -0
- package/dist/tests/typeEvaluator8.test.js.map +1 -1
- package/package.json +2 -2
@@ -158,6 +158,11 @@ const maxInferFunctionReturnRecursionCount = 12;
|
|
158
158
|
// it can increase the chance of false negatives for such recursive
|
159
159
|
// type aliases.
|
160
160
|
const maxRecursiveTypeAliasRecursionCount = 10;
|
161
|
+
// Normally a symbol can have only one type declaration, but there are
|
162
|
+
// cases where multiple are possible (e.g. a property with a setter
|
163
|
+
// and a deleter). In extreme cases, we need to limit the number of
|
164
|
+
// type declarations we consider to avoid excessive computation.
|
165
|
+
const maxTypedDeclsPerSymbol = 16;
|
161
166
|
// This switch enables a special debug mode that attempts to catch
|
162
167
|
// bugs due to inconsistent evaluation flags used when reading types
|
163
168
|
// from the type cache.
|
@@ -892,7 +897,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
892
897
|
if ((flags & 64 /* EvalFlags.NoTypeVarTuple */) === 0 && (0, types_1.isTypeVarTuple)(iterType) && !iterType.priv.isUnpacked) {
|
893
898
|
typeResult = { type: types_1.TypeVarType.cloneForUnpacked(iterType) };
|
894
899
|
}
|
895
|
-
else if ((flags &
|
900
|
+
else if ((flags & 4194304 /* EvalFlags.AllowUnpackedTuple */) !== 0 &&
|
896
901
|
(0, types_1.isInstantiableClass)(iterType) &&
|
897
902
|
types_1.ClassType.isBuiltIn(iterType, 'tuple')) {
|
898
903
|
typeResult = { type: types_1.ClassType.cloneForUnpacked(iterType) };
|
@@ -999,7 +1004,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
999
1004
|
let typeResult;
|
1000
1005
|
// In most cases, annotations within a string are not parsed by the interpreter.
|
1001
1006
|
// There are a few exceptions (e.g. the "bound" value for a TypeVar constructor).
|
1002
|
-
if ((flags &
|
1007
|
+
if ((flags & 16777216 /* EvalFlags.ParsesStringLiteral */) === 0) {
|
1003
1008
|
updatedFlags |= 524288 /* EvalFlags.NotParsed */;
|
1004
1009
|
}
|
1005
1010
|
updatedFlags &= ~1073741824 /* EvalFlags.TypeFormArg */;
|
@@ -2017,7 +2022,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
2017
2022
|
// Handle the case where the type is synthesized (used for
|
2018
2023
|
// dataclasses).
|
2019
2024
|
if (synthesizedType) {
|
2020
|
-
isObjectHashable = !(0, typeUtils_1.isNoneInstance)(synthesizedType);
|
2025
|
+
isObjectHashable = !(0, typeUtils_1.isNoneInstance)(synthesizedType.type);
|
2021
2026
|
}
|
2022
2027
|
else {
|
2023
2028
|
// Assume that if '__hash__' is declared as a variable, it is
|
@@ -2529,7 +2534,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
2529
2534
|
// Is this subtype a tuple?
|
2530
2535
|
const tupleType = (0, typeUtils_1.getSpecializedTupleType)(subtype);
|
2531
2536
|
if (tupleType && tupleType.priv.tupleTypeArgs) {
|
2532
|
-
const sourceEntryTypes = tupleType.priv.tupleTypeArgs.map((t) => (0, typeUtils_1.addConditionToType)(t.type, (0, typeUtils_1.getTypeCondition)(subtype),
|
2537
|
+
const sourceEntryTypes = tupleType.priv.tupleTypeArgs.map((t) => (0, typeUtils_1.addConditionToType)(t.type, (0, typeUtils_1.getTypeCondition)(subtype), { skipSelfCondition: true }));
|
2533
2538
|
const unboundedIndex = tupleType.priv.tupleTypeArgs.findIndex((t) => t.isUnbounded);
|
2534
2539
|
if (unboundedIndex >= 0) {
|
2535
2540
|
if (sourceEntryTypes.length < targetTypes.length) {
|
@@ -3538,7 +3543,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
3538
3543
|
// Walks up the parse tree to find a function, class, or type alias
|
3539
3544
|
// declaration that provides the context for a type variable.
|
3540
3545
|
function findScopedTypeVar(node, type) {
|
3541
|
-
var _a;
|
3546
|
+
var _a, _b;
|
3542
3547
|
let curNode = node;
|
3543
3548
|
let nestedClassCount = 0;
|
3544
3549
|
(0, debug_1.assert)(types_1.TypeBase.isInstantiable(type));
|
@@ -3605,7 +3610,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
3605
3610
|
// purposes of resolving type aliases?
|
3606
3611
|
if (leftType && (0, types_1.isTypeVar)(leftType) && leftType.shared.recursiveAlias) {
|
3607
3612
|
// Type alias statements cannot be used with old-style type variables.
|
3608
|
-
if (typeAliasNode && !type.shared.isTypeParamSyntax) {
|
3613
|
+
if (typeAliasNode && !type.shared.isTypeParamSyntax && !((_a = type.props) === null || _a === void 0 ? void 0 : _a.typeAliasInfo)) {
|
3609
3614
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeParameterNotDeclared().format({
|
3610
3615
|
name: type.shared.name,
|
3611
3616
|
container: typeAliasNode.d.name.d.value,
|
@@ -3615,7 +3620,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
3615
3620
|
// If this is a TypeAliasType call, the recursive type parameters will already
|
3616
3621
|
// be populated, and we need to verify that the type parameter is in the
|
3617
3622
|
// list of allowed type parameters.
|
3618
|
-
const allowedTypeParams = (
|
3623
|
+
const allowedTypeParams = (_b = leftType.shared.recursiveAlias) === null || _b === void 0 ? void 0 : _b.typeParams;
|
3619
3624
|
if (allowedTypeParams) {
|
3620
3625
|
if (!allowedTypeParams.some((param) => param.shared.name === type.shared.name)) {
|
3621
3626
|
// Return the original type.
|
@@ -3835,8 +3840,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
3835
3840
|
}
|
3836
3841
|
if (typeResult) {
|
3837
3842
|
if (!typeResult.typeErrors) {
|
3838
|
-
type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType),
|
3839
|
-
|
3843
|
+
type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType), {
|
3844
|
+
skipSelfCondition: true,
|
3845
|
+
skipBoundTypeVars: true,
|
3846
|
+
});
|
3840
3847
|
}
|
3841
3848
|
else {
|
3842
3849
|
typeErrors = true;
|
@@ -3848,8 +3855,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
3848
3855
|
isIncomplete = true;
|
3849
3856
|
}
|
3850
3857
|
if (typeResult.narrowedTypeForSet) {
|
3851
|
-
narrowedTypeForSet = (0, typeUtils_1.addConditionToType)(typeResult.narrowedTypeForSet, (0, typeUtils_1.getTypeCondition)(baseType),
|
3852
|
-
/* skipSelfCondition */ true);
|
3858
|
+
narrowedTypeForSet = (0, typeUtils_1.addConditionToType)(typeResult.narrowedTypeForSet, (0, typeUtils_1.getTypeCondition)(baseType), { skipSelfCondition: true, skipBoundTypeVars: true });
|
3853
3859
|
}
|
3854
3860
|
if (typeResult.memberAccessDeprecationInfo) {
|
3855
3861
|
memberAccessDeprecationInfo = typeResult.memberAccessDeprecationInfo;
|
@@ -3939,7 +3945,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
3939
3945
|
(0, debug_1.assert)((0, types_1.isClassInstance)(subtype));
|
3940
3946
|
const typeResult = getTypeOfBoundMember(node.d.member, subtype, memberName, usage, diag);
|
3941
3947
|
if (typeResult && !typeResult.typeErrors) {
|
3942
|
-
type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType)
|
3948
|
+
type = (0, typeUtils_1.addConditionToType)(typeResult.type, (0, typeUtils_1.getTypeCondition)(baseType), {
|
3949
|
+
skipBoundTypeVars: true,
|
3950
|
+
});
|
3943
3951
|
if (typeResult.isIncomplete) {
|
3944
3952
|
isIncomplete = true;
|
3945
3953
|
}
|
@@ -5549,7 +5557,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
5549
5557
|
if (!(options === null || options === void 0 ? void 0 : options.isAnnotatedClass)) {
|
5550
5558
|
adjFlags |= 131072 /* EvalFlags.NoClassVar */ | 16 /* EvalFlags.NoFinal */;
|
5551
5559
|
}
|
5552
|
-
adjFlags |=
|
5560
|
+
adjFlags |= 4194304 /* EvalFlags.AllowUnpackedTuple */ | 134217728 /* EvalFlags.AllowConcatenate */;
|
5553
5561
|
}
|
5554
5562
|
// Create a local function that validates a single type argument.
|
5555
5563
|
const getTypeArgTypeResult = (expr, argIndex) => {
|
@@ -5931,6 +5939,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
5931
5939
|
if (!(0, types_1.isTypeSame)(assertedType, arg0Type, {
|
5932
5940
|
treatAnySameAsUnknown: true,
|
5933
5941
|
ignorePseudoGeneric: true,
|
5942
|
+
ignoreConditions: true,
|
5934
5943
|
})) {
|
5935
5944
|
const srcDestTypes = printSrcDestTypes(arg0TypeResult.type, assertedType, { expandTypeAlias: true });
|
5936
5945
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssertTypeFailure, localize_1.LocMessage.assertTypeTypeMismatch().format({
|
@@ -7301,13 +7310,15 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
7301
7310
|
// Build a map of parameters by name.
|
7302
7311
|
const paramMap = new Map();
|
7303
7312
|
paramDetails.params.forEach((paramInfo) => {
|
7313
|
+
var _a, _b;
|
7304
7314
|
(0, debug_1.assert)(paramInfo !== undefined, 'paramInfo is undefined for param name map');
|
7305
7315
|
const param = paramInfo.param;
|
7306
7316
|
if (param.name && param.category === 0 /* ParamCategory.Simple */ && paramInfo.kind !== parameterUtils_1.ParamKind.Positional) {
|
7307
|
-
paramMap.
|
7308
|
-
|
7309
|
-
|
7310
|
-
}
|
7317
|
+
let argsNeeded = (_b = (_a = paramMap.get(param.name)) === null || _a === void 0 ? void 0 : _a.argsNeeded) !== null && _b !== void 0 ? _b : 0;
|
7318
|
+
if (param.category === 0 /* ParamCategory.Simple */ && !paramInfo.defaultType) {
|
7319
|
+
argsNeeded += 1;
|
7320
|
+
}
|
7321
|
+
paramMap.set(param.name, { argsNeeded, argsReceived: 0 });
|
7311
7322
|
}
|
7312
7323
|
});
|
7313
7324
|
let positionalOnlyLimitIndex = paramDetails.positionOnlyParamCount;
|
@@ -8360,11 +8371,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
8360
8371
|
if (paramSpec) {
|
8361
8372
|
if (argParam.argument.argCategory === 1 /* ArgCategory.UnpackedList */) {
|
8362
8373
|
if ((0, parameterUtils_1.isParamSpecArgs)(paramSpec, argResult.argType)) {
|
8374
|
+
if (sawParamSpecArgs) {
|
8375
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.paramSpecArgsKwargsDuplicate().format({ type: printType(paramSpec) }), argParam.errorNode);
|
8376
|
+
}
|
8363
8377
|
sawParamSpecArgs = true;
|
8364
8378
|
}
|
8365
8379
|
}
|
8366
8380
|
if (argParam.argument.argCategory === 2 /* ArgCategory.UnpackedDictionary */) {
|
8367
8381
|
if ((0, parameterUtils_1.isParamSpecKwargs)(paramSpec, argResult.argType)) {
|
8382
|
+
if (sawParamSpecKwargs) {
|
8383
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.paramSpecArgsKwargsDuplicate().format({ type: printType(paramSpec) }), argParam.errorNode);
|
8384
|
+
}
|
8368
8385
|
sawParamSpecKwargs = true;
|
8369
8386
|
}
|
8370
8387
|
}
|
@@ -8411,7 +8428,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
8411
8428
|
eliminateUnsolvedInUnions,
|
8412
8429
|
},
|
8413
8430
|
});
|
8414
|
-
specializedReturnType = (0, typeUtils_1.addConditionToType)(specializedReturnType, typeCondition);
|
8431
|
+
specializedReturnType = (0, typeUtils_1.addConditionToType)(specializedReturnType, typeCondition, { skipBoundTypeVars: true });
|
8415
8432
|
// If the function includes a ParamSpec and the captured signature(s) includes
|
8416
8433
|
// generic types, we may need to apply those solved TypeVars.
|
8417
8434
|
if (paramSpecConstraints.length > 0) {
|
@@ -10967,13 +10984,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
10967
10984
|
isUsageLegal = true;
|
10968
10985
|
}
|
10969
10986
|
}
|
10970
|
-
if ((flags & 1048576 /* EvalFlags.AllowRequired */) !== 0) {
|
10971
|
-
isUsageLegal = true;
|
10972
|
-
}
|
10973
10987
|
let isReadOnly = typeArgs[0].isReadOnly;
|
10974
10988
|
let isRequired = typeArgs[0].isRequired;
|
10975
10989
|
let isNotRequired = typeArgs[0].isNotRequired;
|
10976
10990
|
if (classType.shared.name === 'ReadOnly') {
|
10991
|
+
if ((flags & 2097152 /* EvalFlags.AllowReadOnly */) !== 0) {
|
10992
|
+
isUsageLegal = true;
|
10993
|
+
}
|
10977
10994
|
// Nested ReadOnly are not allowed.
|
10978
10995
|
if (typeArgs[0].isReadOnly) {
|
10979
10996
|
isUsageLegal = false;
|
@@ -10981,6 +10998,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
10981
10998
|
isReadOnly = true;
|
10982
10999
|
}
|
10983
11000
|
else {
|
11001
|
+
if ((flags & 1048576 /* EvalFlags.AllowRequired */) !== 0) {
|
11002
|
+
isUsageLegal = true;
|
11003
|
+
}
|
10984
11004
|
// Nested Required/NotRequired are not allowed.
|
10985
11005
|
if (typeArgs[0].isRequired || typeArgs[0].isNotRequired) {
|
10986
11006
|
isUsageLegal = false;
|
@@ -11008,7 +11028,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
11008
11028
|
return classType;
|
11009
11029
|
}
|
11010
11030
|
const typeArgType = typeArgs[0].type;
|
11011
|
-
if ((flags &
|
11031
|
+
if ((flags & 4194304 /* EvalFlags.AllowUnpackedTuple */) !== 0) {
|
11012
11032
|
const unpackedType = applyUnpackToTupleLike(typeArgType);
|
11013
11033
|
if (unpackedType) {
|
11014
11034
|
return unpackedType;
|
@@ -11019,7 +11039,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
11019
11039
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.unpackExpectedTypeVarTuple(), errorNode);
|
11020
11040
|
return types_1.UnknownType.create();
|
11021
11041
|
}
|
11022
|
-
if ((flags &
|
11042
|
+
if ((flags & 8388608 /* EvalFlags.AllowUnpackedTypedDict */) !== 0) {
|
11023
11043
|
if ((0, types_1.isInstantiableClass)(typeArgType) && types_1.ClassType.isTypedDictClass(typeArgType)) {
|
11024
11044
|
return types_1.ClassType.cloneForUnpacked(typeArgType);
|
11025
11045
|
}
|
@@ -12143,6 +12163,21 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
12143
12163
|
if (AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.enableExperimentalFeatures) {
|
12144
12164
|
classType.shared.flags |=
|
12145
12165
|
8 /* ClassTypeFlags.TypedDictMarkedClosed */ | 16 /* ClassTypeFlags.TypedDictEffectivelyClosed */;
|
12166
|
+
if (classType.shared.typedDictExtraItemsExpr) {
|
12167
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictExtraItemsClosed(), classType.shared.typedDictExtraItemsExpr);
|
12168
|
+
}
|
12169
|
+
}
|
12170
|
+
}
|
12171
|
+
}
|
12172
|
+
else if (arg.d.name.d.value === 'extra_items') {
|
12173
|
+
// This is an experimental feature because PEP 728 hasn't been accepted yet.
|
12174
|
+
if (AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.enableExperimentalFeatures) {
|
12175
|
+
// Record a reference to the expression but don't evaluate it yet.
|
12176
|
+
// It may refer to the class itself.
|
12177
|
+
classType.shared.typedDictExtraItemsExpr = arg.d.valueExpr;
|
12178
|
+
classType.shared.flags |= 16 /* ClassTypeFlags.TypedDictEffectivelyClosed */;
|
12179
|
+
if (types_1.ClassType.isTypedDictMarkedClosed(classType)) {
|
12180
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictExtraItemsClosed(), classType.shared.typedDictExtraItemsExpr);
|
12146
12181
|
}
|
12147
12182
|
}
|
12148
12183
|
}
|
@@ -13355,9 +13390,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
13355
13390
|
if ((0, types_1.isParamSpec)(type) && type.priv.paramSpecAccess) {
|
13356
13391
|
return type;
|
13357
13392
|
}
|
13358
|
-
// Is this an unpacked TypedDict? If so, return
|
13393
|
+
// Is this an unpacked TypedDict? If so, return its packed version.
|
13359
13394
|
if ((0, types_1.isClassInstance)(type) && types_1.ClassType.isTypedDictClass(type) && type.priv.isUnpacked) {
|
13360
|
-
return type;
|
13395
|
+
return types_1.ClassType.cloneForPacked(type);
|
13361
13396
|
}
|
13362
13397
|
// Wrap the type in a dict with str keys.
|
13363
13398
|
const dictType = getBuiltInType(node, 'dict');
|
@@ -14971,7 +15006,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
14971
15006
|
flags |= 4 /* EvalFlags.ForwardRefs */;
|
14972
15007
|
}
|
14973
15008
|
else if (options === null || options === void 0 ? void 0 : options.parsesStringLiteral) {
|
14974
|
-
flags |=
|
15009
|
+
flags |= 16777216 /* EvalFlags.ParsesStringLiteral */;
|
14975
15010
|
}
|
14976
15011
|
if (!(options === null || options === void 0 ? void 0 : options.allowFinal)) {
|
14977
15012
|
flags |= 16 /* EvalFlags.NoFinal */;
|
@@ -14979,14 +15014,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
14979
15014
|
if (options === null || options === void 0 ? void 0 : options.allowRequired) {
|
14980
15015
|
flags |= 1048576 /* EvalFlags.AllowRequired */ | 256 /* EvalFlags.TypeExpression */;
|
14981
15016
|
}
|
15017
|
+
if (options === null || options === void 0 ? void 0 : options.allowReadOnly) {
|
15018
|
+
flags |= 2097152 /* EvalFlags.AllowReadOnly */ | 256 /* EvalFlags.TypeExpression */;
|
15019
|
+
}
|
14982
15020
|
if (options === null || options === void 0 ? void 0 : options.allowUnpackedTuple) {
|
14983
|
-
flags |=
|
15021
|
+
flags |= 4194304 /* EvalFlags.AllowUnpackedTuple */;
|
14984
15022
|
}
|
14985
15023
|
else {
|
14986
15024
|
flags |= 64 /* EvalFlags.NoTypeVarTuple */;
|
14987
15025
|
}
|
14988
15026
|
if (options === null || options === void 0 ? void 0 : options.allowUnpackedTypedDict) {
|
14989
|
-
flags |=
|
15027
|
+
flags |= 8388608 /* EvalFlags.AllowUnpackedTypedDict */;
|
14990
15028
|
}
|
14991
15029
|
if (!(options === null || options === void 0 ? void 0 : options.allowParamSpec)) {
|
14992
15030
|
flags |= 32 /* EvalFlags.NoParamSpec */;
|
@@ -15058,15 +15096,24 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15058
15096
|
// Filter the declarations based on flow reachability.
|
15059
15097
|
const reachableDecl = symbolWithScope.symbol.getDeclarations().find((decl) => {
|
15060
15098
|
if (decl.type !== 8 /* DeclarationType.Alias */ && decl.type !== 0 /* DeclarationType.Intrinsic */) {
|
15061
|
-
//
|
15062
|
-
|
15099
|
+
// Determine if the declaration is in the same execution scope as the "usageNode" node.
|
15100
|
+
let usageScopeNode = ParseTreeUtils.getExecutionScopeNode(node);
|
15063
15101
|
const declNode = decl.type === 6 /* DeclarationType.Class */ ||
|
15064
15102
|
decl.type === 5 /* DeclarationType.Function */ ||
|
15065
15103
|
decl.type === 4 /* DeclarationType.TypeAlias */
|
15066
15104
|
? decl.node.d.name
|
15067
15105
|
: decl.node;
|
15068
|
-
const
|
15069
|
-
|
15106
|
+
const declScopeNode = ParseTreeUtils.getExecutionScopeNode(declNode);
|
15107
|
+
// If this is a type parameter scope, it will be a proxy for its
|
15108
|
+
// containing scope, so we need to use that instead.
|
15109
|
+
const usageScope = AnalyzerNodeInfo.getScope(usageScopeNode);
|
15110
|
+
if (usageScope === null || usageScope === void 0 ? void 0 : usageScope.proxy) {
|
15111
|
+
const typeParamScope = AnalyzerNodeInfo.getScope(usageScopeNode);
|
15112
|
+
if (!(typeParamScope === null || typeParamScope === void 0 ? void 0 : typeParamScope.symbolTable.has(name)) && usageScopeNode.parent) {
|
15113
|
+
usageScopeNode = ParseTreeUtils.getExecutionScopeNode(usageScopeNode.parent);
|
15114
|
+
}
|
15115
|
+
}
|
15116
|
+
if (usageScopeNode === declScopeNode) {
|
15070
15117
|
if (!isFlowPathBetweenNodes(declNode, node)) {
|
15071
15118
|
// If there was no control flow path from the usage back
|
15072
15119
|
// to the source, see if the usage node is reachable by
|
@@ -15273,7 +15320,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15273
15320
|
// dictionary expression where those keys are associated with a known TypedDict.
|
15274
15321
|
function getDeclInfoForStringNode(node) {
|
15275
15322
|
var _a;
|
15276
|
-
const
|
15323
|
+
const decls = [];
|
15324
|
+
const synthesizedTypes = [];
|
15277
15325
|
const expectedType = (_a = getExpectedType(node)) === null || _a === void 0 ? void 0 : _a.type;
|
15278
15326
|
if (expectedType) {
|
15279
15327
|
(0, typeUtils_1.doForEachSubtype)(expectedType, (subtype) => {
|
@@ -15287,13 +15335,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15287
15335
|
if (entry) {
|
15288
15336
|
const symbol = (_b = (0, typeUtils_1.lookUpObjectMember)(subtype, node.d.value)) === null || _b === void 0 ? void 0 : _b.symbol;
|
15289
15337
|
if (symbol) {
|
15290
|
-
(0, collectionUtils_1.appendArray)(
|
15338
|
+
(0, collectionUtils_1.appendArray)(decls, symbol.getDeclarations());
|
15339
|
+
const synthTypeInfo = symbol.getSynthesizedType();
|
15340
|
+
if (synthTypeInfo) {
|
15341
|
+
synthesizedTypes.push(synthTypeInfo);
|
15342
|
+
}
|
15291
15343
|
}
|
15292
15344
|
}
|
15293
15345
|
}
|
15294
15346
|
});
|
15295
15347
|
}
|
15296
|
-
return
|
15348
|
+
return decls.length === 0 ? undefined : { decls, synthesizedTypes };
|
15297
15349
|
}
|
15298
15350
|
function getAliasFromImport(node) {
|
15299
15351
|
if (node.parent &&
|
@@ -15309,7 +15361,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15309
15361
|
if (skipUnreachableCode && AnalyzerNodeInfo.isCodeUnreachable(node)) {
|
15310
15362
|
return undefined;
|
15311
15363
|
}
|
15312
|
-
const
|
15364
|
+
const decls = [];
|
15313
15365
|
const synthesizedTypes = [];
|
15314
15366
|
// If the node is part of a "from X import Y as Z" statement and the node
|
15315
15367
|
// is the "Y" (non-aliased) name, we need to look up the alias symbol
|
@@ -15326,7 +15378,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15326
15378
|
const declsForThisImport = symbolInScope.symbol.getDeclarations().filter((decl) => {
|
15327
15379
|
return decl.type === 8 /* DeclarationType.Alias */ && decl.node === node.parent;
|
15328
15380
|
});
|
15329
|
-
(0, collectionUtils_1.appendArray)(
|
15381
|
+
(0, collectionUtils_1.appendArray)(decls, (0, declarationUtils_1.getDeclarationsWithUsesLocalNameRemoved)(declsForThisImport));
|
15330
15382
|
}
|
15331
15383
|
}
|
15332
15384
|
}
|
@@ -15377,16 +15429,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15377
15429
|
// which includes every assignment of that symbol.
|
15378
15430
|
const typedDecls = symbol.getTypedDeclarations();
|
15379
15431
|
if (typedDecls.length > 0) {
|
15380
|
-
(0, collectionUtils_1.appendArray)(
|
15432
|
+
(0, collectionUtils_1.appendArray)(decls, typedDecls);
|
15381
15433
|
}
|
15382
15434
|
else {
|
15383
|
-
|
15384
|
-
|
15385
|
-
|
15386
|
-
|
15387
|
-
|
15388
|
-
(0, collectionUtils_1.appendArray)(declarations, symbol.getDeclarations());
|
15389
|
-
}
|
15435
|
+
(0, collectionUtils_1.appendArray)(decls, symbol.getDeclarations());
|
15436
|
+
}
|
15437
|
+
const synthTypeInfo = symbol.getSynthesizedType();
|
15438
|
+
if (synthTypeInfo) {
|
15439
|
+
synthesizedTypes.push(synthTypeInfo);
|
15390
15440
|
}
|
15391
15441
|
}
|
15392
15442
|
});
|
@@ -15404,7 +15454,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15404
15454
|
// Synthesize an alias declaration for this name part. The only
|
15405
15455
|
// time this case is used is for IDE services such as
|
15406
15456
|
// the find all references, hover provider and etc.
|
15407
|
-
|
15457
|
+
decls.push((0, declarationUtils_1.synthesizeAliasDeclaration)(importInfo.resolvedUris[namePartIndex]));
|
15408
15458
|
}
|
15409
15459
|
}
|
15410
15460
|
}
|
@@ -15419,14 +15469,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15419
15469
|
if ((0, types_1.isFunction)(baseType) && baseType.shared.declaration) {
|
15420
15470
|
const paramDecl = getDeclarationFromKeywordParam(baseType, paramName);
|
15421
15471
|
if (paramDecl) {
|
15422
|
-
|
15472
|
+
decls.push(paramDecl);
|
15423
15473
|
}
|
15424
15474
|
}
|
15425
15475
|
else if ((0, types_1.isOverloaded)(baseType)) {
|
15426
15476
|
types_1.OverloadedType.getOverloads(baseType).forEach((f) => {
|
15427
15477
|
const paramDecl = getDeclarationFromKeywordParam(f, paramName);
|
15428
15478
|
if (paramDecl) {
|
15429
|
-
|
15479
|
+
decls.push(paramDecl);
|
15430
15480
|
}
|
15431
15481
|
});
|
15432
15482
|
}
|
@@ -15435,14 +15485,18 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15435
15485
|
if (initMethodType && (0, types_1.isFunction)(initMethodType)) {
|
15436
15486
|
const paramDecl = getDeclarationFromKeywordParam(initMethodType, paramName);
|
15437
15487
|
if (paramDecl) {
|
15438
|
-
|
15488
|
+
decls.push(paramDecl);
|
15439
15489
|
}
|
15440
15490
|
else if (types_1.ClassType.isDataClass(baseType) ||
|
15441
15491
|
types_1.ClassType.isTypedDictClass(baseType) ||
|
15442
15492
|
types_1.ClassType.hasNamedTupleEntry(baseType, paramName)) {
|
15443
15493
|
const lookupResults = (0, typeUtils_1.lookUpClassMember)(baseType, paramName);
|
15444
15494
|
if (lookupResults) {
|
15445
|
-
(0, collectionUtils_1.appendArray)(
|
15495
|
+
(0, collectionUtils_1.appendArray)(decls, lookupResults.symbol.getDeclarations());
|
15496
|
+
const synthTypeInfo = lookupResults.symbol.getSynthesizedType();
|
15497
|
+
if (synthTypeInfo) {
|
15498
|
+
synthesizedTypes.push(synthTypeInfo);
|
15499
|
+
}
|
15446
15500
|
}
|
15447
15501
|
}
|
15448
15502
|
}
|
@@ -15467,10 +15521,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15467
15521
|
const allowForwardReferences = isWithinTypeAnnotation || isWithinTypeAliasStatement || fileInfo.isStubFile;
|
15468
15522
|
const symbolWithScope = lookUpSymbolRecursive(node, node.d.value, !allowForwardReferences, isWithinTypeAnnotation);
|
15469
15523
|
if (symbolWithScope) {
|
15470
|
-
(0, collectionUtils_1.appendArray)(
|
15524
|
+
(0, collectionUtils_1.appendArray)(decls, symbolWithScope.symbol.getDeclarations());
|
15525
|
+
const synthTypeInfo = symbolWithScope.symbol.getSynthesizedType();
|
15526
|
+
if (synthTypeInfo) {
|
15527
|
+
synthesizedTypes.push(synthTypeInfo);
|
15528
|
+
}
|
15471
15529
|
}
|
15472
15530
|
}
|
15473
|
-
return { decls
|
15531
|
+
return { decls, synthesizedTypes };
|
15474
15532
|
}
|
15475
15533
|
function getTypeForDeclaration(declaration) {
|
15476
15534
|
var _a, _b, _c;
|
@@ -15569,6 +15627,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15569
15627
|
declaredType = (0, typeUtils_1.convertToInstance)(getTypeOfExpressionExpectingType(typeAnnotationNode, {
|
15570
15628
|
allowFinal: true,
|
15571
15629
|
allowRequired: true,
|
15630
|
+
allowReadOnly: true,
|
15572
15631
|
}).type);
|
15573
15632
|
}
|
15574
15633
|
else {
|
@@ -15581,6 +15640,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
15581
15640
|
allowClassVar: ParseTreeUtils.isClassVarAllowedForAssignmentTarget(declNode),
|
15582
15641
|
allowFinal: ParseTreeUtils.isFinalAllowedForAssignmentTarget(declNode),
|
15583
15642
|
allowRequired: ParseTreeUtils.isRequiredAllowedForAssignmentTarget(declNode),
|
15643
|
+
allowReadOnly: ParseTreeUtils.isRequiredAllowedForAssignmentTarget(declNode),
|
15584
15644
|
enforceClassTypeVarScope: declaration.isDefinedByMemberAccess,
|
15585
15645
|
});
|
15586
15646
|
}
|
@@ -16238,7 +16298,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
16238
16298
|
// provided, but type inference is still required. In such cases, the attributes
|
16239
16299
|
// are returned as flags.
|
16240
16300
|
function getDeclaredTypeOfSymbol(symbol, usageNode) {
|
16241
|
-
|
16301
|
+
var _a;
|
16302
|
+
const synthesizedType = (_a = symbol.getSynthesizedType()) === null || _a === void 0 ? void 0 : _a.type;
|
16242
16303
|
if (synthesizedType) {
|
16243
16304
|
return { type: synthesizedType };
|
16244
16305
|
}
|
@@ -16260,23 +16321,31 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
16260
16321
|
// cases where a property symbol is redefined to add a setter, deleter,
|
16261
16322
|
// etc.
|
16262
16323
|
if (usageNode && typedDecls.length > 1) {
|
16263
|
-
|
16264
|
-
|
16265
|
-
|
16266
|
-
|
16267
|
-
|
16268
|
-
|
16269
|
-
|
16270
|
-
|
16324
|
+
if (typedDecls.length > maxTypedDeclsPerSymbol) {
|
16325
|
+
// If there are too many typed decls, don't bother filtering them
|
16326
|
+
// because this can be very expensive. Simply use the last one
|
16327
|
+
// in this case.
|
16328
|
+
typedDecls = [typedDecls[typedDecls.length - 1]];
|
16329
|
+
}
|
16330
|
+
else {
|
16331
|
+
const filteredTypedDecls = typedDecls.filter((decl) => {
|
16332
|
+
if (decl.type !== 8 /* DeclarationType.Alias */) {
|
16333
|
+
// Is the declaration in the same execution scope as the "usageNode" node?
|
16334
|
+
const usageScope = ParseTreeUtils.getExecutionScopeNode(usageNode);
|
16335
|
+
const declScope = ParseTreeUtils.getExecutionScopeNode(decl.node);
|
16336
|
+
if (usageScope === declScope) {
|
16337
|
+
if (!isFlowPathBetweenNodes(decl.node, usageNode, /* allowSelf */ false)) {
|
16338
|
+
return false;
|
16339
|
+
}
|
16271
16340
|
}
|
16272
16341
|
}
|
16342
|
+
return true;
|
16343
|
+
});
|
16344
|
+
if (filteredTypedDecls.length === 0) {
|
16345
|
+
return { type: types_1.UnboundType.create() };
|
16273
16346
|
}
|
16274
|
-
|
16275
|
-
});
|
16276
|
-
if (filteredTypedDecls.length === 0) {
|
16277
|
-
return { type: types_1.UnboundType.create() };
|
16347
|
+
typedDecls = filteredTypedDecls;
|
16278
16348
|
}
|
16279
|
-
typedDecls = filteredTypedDecls;
|
16280
16349
|
}
|
16281
16350
|
// Start with the last decl. If that's already being resolved,
|
16282
16351
|
// use the next-to-last decl, etc. This can happen when resolving
|
@@ -16844,41 +16913,49 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
16844
16913
|
}
|
16845
16914
|
// Now handle generic base classes.
|
16846
16915
|
destType.shared.baseClasses.forEach((baseClass) => {
|
16847
|
-
if (
|
16848
|
-
!types_1.
|
16849
|
-
|
16850
|
-
|
16851
|
-
|
16852
|
-
|
16853
|
-
|
16854
|
-
|
16855
|
-
|
16856
|
-
|
16857
|
-
|
16858
|
-
|
16859
|
-
|
16860
|
-
|
16861
|
-
|
16862
|
-
|
16863
|
-
|
16864
|
-
|
16865
|
-
|
16866
|
-
|
16867
|
-
|
16868
|
-
|
16869
|
-
|
16870
|
-
|
16871
|
-
if (paramVariance === 2 /* Variance.Invariant */ || paramVariance === 3 /* Variance.Covariant */) {
|
16872
|
-
isAssignable = false;
|
16873
|
-
}
|
16874
|
-
}
|
16916
|
+
if (!isAssignable ||
|
16917
|
+
!(0, types_1.isInstantiableClass)(baseClass) ||
|
16918
|
+
types_1.ClassType.isBuiltIn(baseClass, ['object', 'Protocol', 'Generic']) ||
|
16919
|
+
baseClass.shared.typeParams.length === 0) {
|
16920
|
+
return;
|
16921
|
+
}
|
16922
|
+
const specializedDestBaseClass = (0, typeUtils_1.specializeForBaseClass)(destType, baseClass);
|
16923
|
+
const specializedSrcBaseClass = (0, typeUtils_1.specializeForBaseClass)(srcType, baseClass);
|
16924
|
+
if (!ignoreBaseClassVariance) {
|
16925
|
+
specializedDestBaseClass.shared.typeParams.forEach((param, index) => {
|
16926
|
+
if ((0, types_1.isParamSpec)(param) || (0, types_1.isTypeVarTuple)(param) || param.shared.isSynthesized) {
|
16927
|
+
return;
|
16928
|
+
}
|
16929
|
+
if (!specializedSrcBaseClass.priv.typeArgs ||
|
16930
|
+
index >= specializedSrcBaseClass.priv.typeArgs.length ||
|
16931
|
+
!specializedDestBaseClass.priv.typeArgs ||
|
16932
|
+
index >= specializedDestBaseClass.priv.typeArgs.length) {
|
16933
|
+
return;
|
16934
|
+
}
|
16935
|
+
const paramVariance = param.shared.declaredVariance;
|
16936
|
+
if ((0, types_1.isTypeVar)(specializedSrcBaseClass.priv.typeArgs[index])) {
|
16937
|
+
if (paramVariance === 2 /* Variance.Invariant */ || paramVariance === 4 /* Variance.Contravariant */) {
|
16938
|
+
isAssignable = false;
|
16939
|
+
return;
|
16875
16940
|
}
|
16876
|
-
}
|
16877
|
-
|
16878
|
-
|
16879
|
-
|
16880
|
-
|
16881
|
-
|
16941
|
+
}
|
16942
|
+
if ((0, types_1.isTypeVar)(specializedDestBaseClass.priv.typeArgs[index])) {
|
16943
|
+
if (paramVariance === 2 /* Variance.Invariant */ || paramVariance === 3 /* Variance.Covariant */) {
|
16944
|
+
isAssignable = false;
|
16945
|
+
return;
|
16946
|
+
}
|
16947
|
+
}
|
16948
|
+
});
|
16949
|
+
}
|
16950
|
+
if (!isAssignable) {
|
16951
|
+
return;
|
16952
|
+
}
|
16953
|
+
// Handle tuples specially since their type arguments are variadic.
|
16954
|
+
if (types_1.ClassType.isTupleClass(specializedDestBaseClass)) {
|
16955
|
+
return;
|
16956
|
+
}
|
16957
|
+
if (!assignClassToSelf(specializedDestBaseClass, specializedSrcBaseClass, assumedVariance, ignoreBaseClassVariance, recursionCount)) {
|
16958
|
+
isAssignable = false;
|
16882
16959
|
}
|
16883
16960
|
});
|
16884
16961
|
return isAssignable;
|
@@ -18407,6 +18484,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
18407
18484
|
}
|
18408
18485
|
}
|
18409
18486
|
else if (destParam.kind !== parameterUtils_1.ParamKind.Positional &&
|
18487
|
+
destParam.kind !== parameterUtils_1.ParamKind.ExpandedArgs &&
|
18410
18488
|
srcParam.kind === parameterUtils_1.ParamKind.Positional &&
|
18411
18489
|
srcParamDetails.kwargsIndex === undefined &&
|
18412
18490
|
!srcParamDetails.params.some((p) => p.kind === parameterUtils_1.ParamKind.Keyword &&
|
@@ -18495,7 +18573,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
18495
18573
|
if (!assignParam(destParamType, srcArgsType, paramIndex, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
|
18496
18574
|
canAssign = false;
|
18497
18575
|
}
|
18498
|
-
|
18576
|
+
const destParamKind = destParamDetails.params[paramIndex].kind;
|
18577
|
+
if (destParamKind !== parameterUtils_1.ParamKind.Positional &&
|
18578
|
+
destParamKind !== parameterUtils_1.ParamKind.ExpandedArgs &&
|
18499
18579
|
srcParamDetails.kwargsIndex === undefined) {
|
18500
18580
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.namedParamMissingInSource().format({
|
18501
18581
|
name: (_g = destParamDetails.params[paramIndex].param.name) !== null && _g !== void 0 ? _g : '',
|
@@ -18569,7 +18649,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
18569
18649
|
if (index >= destParamDetails.firstKeywordOnlyIndex) {
|
18570
18650
|
if (param.param.name &&
|
18571
18651
|
param.param.category === 0 /* ParamCategory.Simple */ &&
|
18572
|
-
param.kind !== parameterUtils_1.ParamKind.Positional
|
18652
|
+
param.kind !== parameterUtils_1.ParamKind.Positional &&
|
18653
|
+
param.kind !== parameterUtils_1.ParamKind.ExpandedArgs) {
|
18573
18654
|
destParamMap.set(param.param.name, param);
|
18574
18655
|
}
|
18575
18656
|
}
|
@@ -19176,7 +19257,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
19176
19257
|
else if (i < overrideParamDetails.positionOnlyParamCount &&
|
19177
19258
|
i >= baseParamDetails.positionOnlyParamCount) {
|
19178
19259
|
if (!types_1.FunctionParam.isNameSynthesized(baseParam) &&
|
19179
|
-
baseParamDetails.params[i].kind !== parameterUtils_1.ParamKind.Positional
|
19260
|
+
baseParamDetails.params[i].kind !== parameterUtils_1.ParamKind.Positional &&
|
19261
|
+
baseParamDetails.params[i].kind !== parameterUtils_1.ParamKind.ExpandedArgs) {
|
19180
19262
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideParamNamePositionOnly().format({
|
19181
19263
|
index: i + 1,
|
19182
19264
|
baseName: baseParam.name || '*',
|