@zzzen/pyright-internal 1.2.0-dev.20260823 → 1.2.0-dev.20260906
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/analyzerNodeInfo.d.ts +4 -0
- package/dist/analyzer/analyzerNodeInfo.js +29 -8
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +2 -1
- package/dist/analyzer/backgroundAnalysisProgram.js +4 -8
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/checker.js +31 -25
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constructorTransform.js +8 -0
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/dataClasses.js +9 -3
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.js +12 -13
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/program.js +4 -1
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/sentinel.d.ts +2 -2
- package/dist/analyzer/sentinel.js +3 -3
- package/dist/analyzer/sentinel.js.map +1 -1
- package/dist/analyzer/service.d.ts +8 -11
- package/dist/analyzer/service.js +27 -96
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js +1 -0
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceFileInfo.d.ts +1 -0
- package/dist/analyzer/sourceFileInfo.js +3 -0
- package/dist/analyzer/sourceFileInfo.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +93 -32
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeGuards.js +133 -10
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeStubGeneration.d.ts +64 -0
- package/dist/analyzer/typeStubGeneration.js +226 -0
- package/dist/analyzer/typeStubGeneration.js.map +1 -0
- package/dist/analyzer/typeStubMessages.d.ts +4 -0
- package/dist/analyzer/typeStubMessages.js +25 -0
- package/dist/analyzer/typeStubMessages.js.map +1 -0
- package/dist/analyzer/typeStubOutput.d.ts +9 -0
- package/dist/analyzer/typeStubOutput.js +52 -0
- package/dist/analyzer/typeStubOutput.js.map +1 -0
- package/dist/analyzer/typeStubRenderer.d.ts +5 -0
- package/dist/analyzer/{typeStubWriter.js → typeStubRenderer.js} +11 -93
- package/dist/analyzer/typeStubRenderer.js.map +1 -0
- package/dist/analyzer/typeUtils.d.ts +1 -0
- package/dist/analyzer/typeUtils.js +112 -0
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/types.d.ts +2 -0
- package/dist/analyzer/types.js +84 -58
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +5 -4
- package/dist/backgroundAnalysisBase.js +11 -19
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/commands/createTypeStub.d.ts +2 -6
- package/dist/commands/createTypeStub.js +14 -27
- package/dist/commands/createTypeStub.js.map +1 -1
- package/dist/common/commandLineOptions.d.ts +0 -1
- package/dist/common/commandLineOptions.js.map +1 -1
- package/dist/common/extensibility.d.ts +1 -0
- package/dist/common/extensibility.js.map +1 -1
- package/dist/languageServerBase.d.ts +1 -1
- package/dist/languageServerBase.js +2 -2
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.d.ts +1 -3
- package/dist/languageService/analyzerServiceExecutor.js +8 -28
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/fileWatcherDynamicFeature.d.ts +6 -4
- package/dist/languageService/fileWatcherDynamicFeature.js +19 -15
- package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +1 -1
- package/dist/languageService/hoverProvider.js +13 -8
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/tooltipUtils.d.ts +2 -1
- package/dist/languageService/tooltipUtils.js +15 -17
- package/dist/languageService/tooltipUtils.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 +4 -0
- package/dist/localization/package.nls.de.json +4 -0
- package/dist/localization/package.nls.en-us.json +1 -0
- package/dist/localization/package.nls.es.json +4 -0
- package/dist/localization/package.nls.fr.json +4 -0
- package/dist/localization/package.nls.it.json +4 -0
- package/dist/localization/package.nls.ja.json +4 -0
- package/dist/localization/package.nls.ko.json +4 -0
- package/dist/localization/package.nls.pl.json +4 -0
- package/dist/localization/package.nls.pt-br.json +4 -0
- package/dist/localization/package.nls.qps-ploc.json +4 -0
- package/dist/localization/package.nls.ru.json +4 -0
- package/dist/localization/package.nls.tr.json +4 -0
- package/dist/localization/package.nls.zh-cn.json +4 -0
- package/dist/localization/package.nls.zh-tw.json +4 -0
- package/dist/parser/parser.js +7 -1
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +3 -5
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/pyright.js +30 -17
- package/dist/pyright.js.map +1 -1
- package/dist/tests/analyzerNodeInfo.test.js +32 -0
- package/dist/tests/analyzerNodeInfo.test.js.map +1 -1
- package/dist/tests/config.test.js +0 -1
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +5 -5
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +0 -1
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.import.django.view.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.plainText.fourslash.js +1 -1
- package/dist/tests/hoverProvider.test.js +2 -2
- package/dist/tests/parseTreeUtils.test.js +41 -0
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/pyrightCli.test.d.ts +1 -0
- package/dist/tests/pyrightCli.test.js +205 -0
- package/dist/tests/pyrightCli.test.js.map +1 -0
- package/dist/tests/service.test.js +152 -0
- package/dist/tests/service.test.js.map +1 -1
- package/dist/tests/typeEquality.test.d.ts +1 -0
- package/dist/tests/typeEquality.test.js +95 -0
- package/dist/tests/typeEquality.test.js.map +1 -0
- package/dist/tests/typeEvaluator1.test.js +11 -0
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +4 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +8 -0
- 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 +1 -1
- package/dist/tests/typeEvaluator6.test.js +5 -1
- package/dist/tests/typeEvaluator6.test.js.map +1 -1
- package/dist/tests/typeEvaluator8.test.js +4 -0
- package/dist/tests/typeEvaluator8.test.js.map +1 -1
- package/dist/tests/typeServer/stubGenerator.test.d.ts +1 -0
- package/dist/tests/typeServer/stubGenerator.test.js +73 -0
- package/dist/tests/typeServer/stubGenerator.test.js.map +1 -0
- package/dist/tests/typeStubGeneration.test.d.ts +1 -0
- package/dist/tests/typeStubGeneration.test.js +397 -0
- package/dist/tests/typeStubGeneration.test.js.map +1 -0
- package/dist/tests/typeStubOutput.test.d.ts +1 -0
- package/dist/tests/typeStubOutput.test.js +136 -0
- package/dist/tests/typeStubOutput.test.js.map +1 -0
- package/dist/tests/typeUtils.test.d.ts +1 -0
- package/dist/tests/typeUtils.test.js +133 -0
- package/dist/tests/typeUtils.test.js.map +1 -0
- package/dist/typeServer/stubGenerator.js +32 -7
- package/dist/typeServer/stubGenerator.js.map +1 -1
- package/package.json +1 -1
- package/dist/analyzer/typeStubWriter.d.ts +0 -17
- package/dist/analyzer/typeStubWriter.js.map +0 -1
|
@@ -2260,9 +2260,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
2260
2260
|
}
|
|
2261
2261
|
const iterReturnType = getTypeOfMagicMethodCall(subtype, iterMethodName, [], errorNode)?.type;
|
|
2262
2262
|
if (!iterReturnType) {
|
|
2263
|
-
// There was no __iter__.
|
|
2264
|
-
//
|
|
2263
|
+
// There was no callable __iter__. The legacy sequence protocol
|
|
2264
|
+
// falls back to __getitem__, but CPython does that only when
|
|
2265
|
+
// __iter__ is missing. An explicit `__iter__ = None` (or any
|
|
2266
|
+
// non-callable __iter__) makes the object not iterable.
|
|
2267
|
+
let hasExplicitIterMember = false;
|
|
2265
2268
|
if (!isAsync && (0, types_1.isClassInstance)(subtype)) {
|
|
2269
|
+
hasExplicitIterMember = !!(0, typeUtils_1.lookUpObjectMember)(subtype, iterMethodName, 16 /* MemberAccessFlags.SkipInstanceMembers */ |
|
|
2270
|
+
512 /* MemberAccessFlags.SkipAttributeAccessOverride */ |
|
|
2271
|
+
4 /* MemberAccessFlags.SkipObjectBaseClass */);
|
|
2272
|
+
}
|
|
2273
|
+
if (!isAsync && (0, types_1.isClassInstance)(subtype) && !hasExplicitIterMember) {
|
|
2266
2274
|
const getItemReturnType = getTypeOfMagicMethodCall(subtype, '__getitem__', [
|
|
2267
2275
|
{
|
|
2268
2276
|
type: prefetched?.intClass && (0, types_1.isInstantiableClass)(prefetched.intClass)
|
|
@@ -8167,7 +8175,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
8167
8175
|
if (expandedCallType.shared.fullName === 'builtins.sentinel' ||
|
|
8168
8176
|
expandedCallType.shared.fullName === 'typing_extensions.sentinel' ||
|
|
8169
8177
|
expandedCallType.shared.fullName === 'typing_extensions.Sentinel') {
|
|
8170
|
-
return {
|
|
8178
|
+
return {
|
|
8179
|
+
returnType: (0, sentinel_1.createSentinelType)(evaluatorInterface, errorNode, argList, expandedCallType, nodeInfo),
|
|
8180
|
+
};
|
|
8171
8181
|
}
|
|
8172
8182
|
if (types_1.ClassType.isSpecialFormClass(expandedCallType)) {
|
|
8173
8183
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeNotIntantiable().format({ type: className }), errorNode);
|
|
@@ -8233,6 +8243,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
8233
8243
|
const overloadsUsedForCall = constructorResult.overloadsUsedForCall;
|
|
8234
8244
|
const argumentErrors = constructorResult.argumentErrors;
|
|
8235
8245
|
const isTypeIncomplete = constructorResult.isTypeIncomplete;
|
|
8246
|
+
const usesBuiltInTypeNew = overloadsUsedForCall?.some((overload) => types_1.FunctionType.isBuiltIn(overload, 'builtins.type.__new__'));
|
|
8236
8247
|
let returnType = constructorResult.returnType;
|
|
8237
8248
|
// If the expandedCallType originated from a TypeVar, convert
|
|
8238
8249
|
// the constructed type back to the TypeVar. For example, if
|
|
@@ -8264,10 +8275,23 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
8264
8275
|
}
|
|
8265
8276
|
}
|
|
8266
8277
|
const newClassType = types_1.ClassType.createInstantiable(newClassName, '', '', nodeInfo.getFileInfo(errorNode).fileUri, 0 /* ClassTypeFlags.None */, ParseTreeUtils.getTypeSourceId(errorNode), types_1.ClassType.cloneAsInstantiable(returnType), types_1.ClassType.cloneAsInstantiable(returnType));
|
|
8267
|
-
|
|
8278
|
+
if (usesBuiltInTypeNew && argList.length >= 2) {
|
|
8279
|
+
const baseTupleType = getTypeOfArg(argList[1], /* inferenceContext */ undefined).type;
|
|
8280
|
+
if ((0, types_1.isClassInstance)(baseTupleType)) {
|
|
8281
|
+
const baseClasses = getBaseClassesFromTypeCall(baseTupleType);
|
|
8282
|
+
if (baseClasses) {
|
|
8283
|
+
newClassType.shared.baseClasses.push(...baseClasses);
|
|
8284
|
+
}
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
if (newClassType.shared.baseClasses.length === 0) {
|
|
8288
|
+
newClassType.shared.baseClasses.push(getBuiltInType(errorNode, 'object'));
|
|
8289
|
+
}
|
|
8268
8290
|
newClassType.shared.effectiveMetaclass = expandedCallType;
|
|
8269
8291
|
newClassType.shared.declaration = returnType.shared.declaration;
|
|
8270
|
-
(0, typeUtils_1.computeMroLinearization)(newClassType)
|
|
8292
|
+
if (!(0, typeUtils_1.computeMroLinearization)(newClassType)) {
|
|
8293
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.methodOrdering(), errorNode);
|
|
8294
|
+
}
|
|
8271
8295
|
returnType = newClassType;
|
|
8272
8296
|
}
|
|
8273
8297
|
return { returnType, overloadsUsedForCall, argumentErrors, isTypeIncomplete };
|
|
@@ -10435,6 +10459,15 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
10435
10459
|
}
|
|
10436
10460
|
return classType;
|
|
10437
10461
|
}
|
|
10462
|
+
function getBaseClassesFromTypeCall(baseTupleType) {
|
|
10463
|
+
if (!(0, typeUtils_1.isTupleClass)(baseTupleType) || baseTupleType.priv.tupleTypeArgs === undefined) {
|
|
10464
|
+
return undefined;
|
|
10465
|
+
}
|
|
10466
|
+
return baseTupleType.priv.tupleTypeArgs.map((typeArg) => {
|
|
10467
|
+
const specializedType = makeTopLevelTypeVarsConcrete(typeArg.type);
|
|
10468
|
+
return (0, typeUtils_1.isEffectivelyInstantiable)(specializedType) ? specializedType : types_1.UnknownType.create();
|
|
10469
|
+
});
|
|
10470
|
+
}
|
|
10438
10471
|
// Implements the semantics of the multi-parameter variant of the "type" call.
|
|
10439
10472
|
function createClassFromMetaclass(errorNode, argList, metaclass) {
|
|
10440
10473
|
const fileInfo = nodeInfo.getFileInfo(errorNode);
|
|
@@ -10443,21 +10476,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
10443
10476
|
return undefined;
|
|
10444
10477
|
}
|
|
10445
10478
|
const className = arg0Type.priv.literalValue || '_';
|
|
10446
|
-
const
|
|
10447
|
-
|
|
10448
|
-
if (!(0, types_1.isClassInstance)(arg1Type) || !(0, typeUtils_1.isTupleClass)(arg1Type) || arg1Type.priv.tupleTypeArgs === undefined) {
|
|
10479
|
+
const baseTupleType = getTypeOfArg(argList[1], /* inferenceContext */ undefined).type;
|
|
10480
|
+
if (!(0, types_1.isClassInstance)(baseTupleType)) {
|
|
10449
10481
|
return undefined;
|
|
10450
10482
|
}
|
|
10451
|
-
const
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
else {
|
|
10458
|
-
classType.shared.baseClasses.push(types_1.UnknownType.create());
|
|
10459
|
-
}
|
|
10460
|
-
});
|
|
10483
|
+
const baseClasses = getBaseClassesFromTypeCall(baseTupleType);
|
|
10484
|
+
if (!baseClasses) {
|
|
10485
|
+
return undefined;
|
|
10486
|
+
}
|
|
10487
|
+
const classType = types_1.ClassType.createInstantiable(className, ParseTreeUtils.getClassFullName(errorNode, fileInfo.moduleName, className), fileInfo.moduleName, fileInfo.fileUri, 4194304 /* ClassTypeFlags.ValidTypeAliasClass */, ParseTreeUtils.getTypeSourceId(errorNode), metaclass, baseTupleType.shared.effectiveMetaclass);
|
|
10488
|
+
classType.shared.baseClasses.push(...baseClasses);
|
|
10461
10489
|
if (!(0, typeUtils_1.computeMroLinearization)(classType)) {
|
|
10462
10490
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.methodOrdering(), errorNode);
|
|
10463
10491
|
}
|
|
@@ -20055,6 +20083,24 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
20055
20083
|
srcDetails.positionOnlyParamCount = Math.max(0, srcDetails.params.findIndex((p) => p.kind !== parameterUtils_1.ParamKind.Positional || p.param.category !== 0 /* ParamCategory.Simple */ || !!p.defaultType));
|
|
20056
20084
|
}
|
|
20057
20085
|
}
|
|
20086
|
+
// Determines whether the source's variadic **kwargs keyword parameter
|
|
20087
|
+
// is assignable to the keyword form of a destination positional-or-keyword
|
|
20088
|
+
// parameter.
|
|
20089
|
+
function assignNamedParam(destDetails, srcDetails, paramIndex, diag, constraints, flags, recursionCount) {
|
|
20090
|
+
const destParam = destDetails.params[paramIndex];
|
|
20091
|
+
if (srcDetails.kwargsIndex === undefined) {
|
|
20092
|
+
diag?.addMessage(localize_1.LocAddendum.namedParamMissingInSource().format({
|
|
20093
|
+
name: destParam.param.name ?? '',
|
|
20094
|
+
}));
|
|
20095
|
+
return false;
|
|
20096
|
+
}
|
|
20097
|
+
else if (!assignParam(destParam.type, srcDetails.params[srcDetails.kwargsIndex].type, paramIndex, diag?.createAddendum(), constraints, flags, recursionCount)) {
|
|
20098
|
+
return (flags & 32 /* AssignTypeFlags.PartialOverloadOverlap */) !== 0;
|
|
20099
|
+
}
|
|
20100
|
+
else {
|
|
20101
|
+
return true;
|
|
20102
|
+
}
|
|
20103
|
+
}
|
|
20058
20104
|
function assignFunction(destType, srcType, diag, constraints, flags, recursionCount) {
|
|
20059
20105
|
let canAssign = true;
|
|
20060
20106
|
const checkReturnType = (flags & 64 /* AssignTypeFlags.SkipReturnTypeCheck */) === 0;
|
|
@@ -20166,14 +20212,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
20166
20212
|
else if (destParam.kind !== parameterUtils_1.ParamKind.Positional &&
|
|
20167
20213
|
destParam.kind !== parameterUtils_1.ParamKind.ExpandedArgs &&
|
|
20168
20214
|
srcParam.kind === parameterUtils_1.ParamKind.Positional &&
|
|
20169
|
-
srcParamDetails.kwargsIndex === undefined &&
|
|
20170
20215
|
!srcParamDetails.params.some((p) => p.kind === parameterUtils_1.ParamKind.Keyword &&
|
|
20171
20216
|
p.param.category === 0 /* ParamCategory.Simple */ &&
|
|
20172
20217
|
p.param.name === destParam.param.name)) {
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
}
|
|
20176
|
-
canAssign = false;
|
|
20218
|
+
if (!assignNamedParam(destParamDetails, srcParamDetails, paramIndex, diag, constraints, flags, recursionCount)) {
|
|
20219
|
+
canAssign = false;
|
|
20220
|
+
}
|
|
20177
20221
|
}
|
|
20178
20222
|
}
|
|
20179
20223
|
if (!types_1.FunctionType.isGradualCallableForm(destType) &&
|
|
@@ -20259,13 +20303,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
20259
20303
|
canAssign = false;
|
|
20260
20304
|
}
|
|
20261
20305
|
const destParamKind = destParamDetails.params[paramIndex].kind;
|
|
20262
|
-
if (destParamKind !== parameterUtils_1.ParamKind.Positional &&
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
name: destParamDetails.params[paramIndex].param.name ?? '',
|
|
20267
|
-
}));
|
|
20268
|
-
canAssign = false;
|
|
20306
|
+
if (destParamKind !== parameterUtils_1.ParamKind.Positional && destParamKind !== parameterUtils_1.ParamKind.ExpandedArgs) {
|
|
20307
|
+
if (!assignNamedParam(destParamDetails, srcParamDetails, paramIndex, diag, constraints, flags, recursionCount)) {
|
|
20308
|
+
canAssign = false;
|
|
20309
|
+
}
|
|
20269
20310
|
}
|
|
20270
20311
|
}
|
|
20271
20312
|
}
|
|
@@ -20359,7 +20400,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
20359
20400
|
srcParamInfo.kind === parameterUtils_1.ParamKind.Positional) {
|
|
20360
20401
|
return;
|
|
20361
20402
|
}
|
|
20362
|
-
const destParamInfo = destParamMap.get(srcParamInfo.param.name)
|
|
20403
|
+
const destParamInfo = destParamMap.get(srcParamInfo.param.name) ??
|
|
20404
|
+
destParamDetails.params.find((paramInfo) => paramInfo.param.name === srcParamInfo.param.name &&
|
|
20405
|
+
paramInfo.kind === parameterUtils_1.ParamKind.Standard &&
|
|
20406
|
+
paramInfo.param.category === 0 /* ParamCategory.Simple */);
|
|
20363
20407
|
const paramDiag = diag?.createAddendum();
|
|
20364
20408
|
const srcParamType = srcParamInfo.type;
|
|
20365
20409
|
if (!destParamInfo) {
|
|
@@ -20390,6 +20434,20 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
20390
20434
|
}
|
|
20391
20435
|
return;
|
|
20392
20436
|
}
|
|
20437
|
+
// A keyword-only source parameter was matched to a positional-or-keyword
|
|
20438
|
+
// dest parameter. The dest parameter can be called positionally, but a
|
|
20439
|
+
// keyword-only source parameter with no default would be left unsatisfied.
|
|
20440
|
+
if (destParamInfo.kind === parameterUtils_1.ParamKind.Standard &&
|
|
20441
|
+
srcParamInfo.kind === parameterUtils_1.ParamKind.Keyword &&
|
|
20442
|
+
!srcParamInfo.defaultType) {
|
|
20443
|
+
if ((flags & 32 /* AssignTypeFlags.PartialOverloadOverlap */) === 0) {
|
|
20444
|
+
paramDiag?.addMessage(localize_1.LocAddendum.functionParamDefaultMissing().format({
|
|
20445
|
+
name: srcParamInfo.param.name,
|
|
20446
|
+
}));
|
|
20447
|
+
canAssign = false;
|
|
20448
|
+
return;
|
|
20449
|
+
}
|
|
20450
|
+
}
|
|
20393
20451
|
// If we're performing a partial overload match and both the source
|
|
20394
20452
|
// and dest parameters provide defaults, assume that there could
|
|
20395
20453
|
// be a match.
|
|
@@ -20412,7 +20470,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
|
|
|
20412
20470
|
destType: printType(srcParamType),
|
|
20413
20471
|
}));
|
|
20414
20472
|
}
|
|
20415
|
-
|
|
20473
|
+
if (destParamInfo.kind !== parameterUtils_1.ParamKind.Standard ||
|
|
20474
|
+
(flags & 32 /* AssignTypeFlags.PartialOverloadOverlap */) === 0) {
|
|
20475
|
+
canAssign = false;
|
|
20476
|
+
}
|
|
20416
20477
|
}
|
|
20417
20478
|
if (destParamInfo.defaultType && !srcParamInfo.defaultType) {
|
|
20418
20479
|
diag?.createAddendum().addMessage(localize_1.LocAddendum.functionParamDefaultMissing().format({
|