coc-pyright 1.1.271 → 1.1.272

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +140 -97
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -8833,12 +8833,6 @@ var require_parseTreeUtils = __commonJS({
8833
8833
  }
8834
8834
  return void 0;
8835
8835
  }
8836
- if (curNode.nodeType === 48) {
8837
- if (prevNode === curNode.typeAnnotation) {
8838
- return prevNode;
8839
- }
8840
- return void 0;
8841
- }
8842
8836
  prevNode = curNode;
8843
8837
  curNode = curNode.parent;
8844
8838
  }
@@ -13690,7 +13684,7 @@ __export(main_exports2, {
13690
13684
  ColorPresentation: () => ColorPresentation,
13691
13685
  Command: () => Command,
13692
13686
  CompletionItem: () => CompletionItem,
13693
- CompletionItemKind: () => CompletionItemKind2,
13687
+ CompletionItemKind: () => CompletionItemKind,
13694
13688
  CompletionItemLabelDetails: () => CompletionItemLabelDetails,
13695
13689
  CompletionItemTag: () => CompletionItemTag,
13696
13690
  CompletionList: () => CompletionList,
@@ -13752,7 +13746,7 @@ __export(main_exports2, {
13752
13746
  integer: () => integer,
13753
13747
  uinteger: () => uinteger
13754
13748
  });
13755
- var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind2, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, WorkspaceFolder, EOL, TextDocument2, FullTextDocument2, Is;
13749
+ var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, WorkspaceFolder, EOL, TextDocument2, FullTextDocument2, Is;
13756
13750
  var init_main2 = __esm({
13757
13751
  "node_modules/vscode-languageserver-types/lib/esm/main.js"() {
13758
13752
  "use strict";
@@ -14504,7 +14498,7 @@ var init_main2 = __esm({
14504
14498
  CompletionItemKind4.Event = 23;
14505
14499
  CompletionItemKind4.Operator = 24;
14506
14500
  CompletionItemKind4.TypeParameter = 25;
14507
- })(CompletionItemKind2 || (CompletionItemKind2 = {}));
14501
+ })(CompletionItemKind || (CompletionItemKind = {}));
14508
14502
  (function(InsertTextFormat3) {
14509
14503
  InsertTextFormat3.PlainText = 1;
14510
14504
  InsertTextFormat3.Snippet = 2;
@@ -23668,6 +23662,13 @@ var require_types = __commonJS({
23668
23662
  return type.specializedTypes && type.specializedTypes.returnType ? type.specializedTypes.returnType : type.details.declaredReturnType;
23669
23663
  }
23670
23664
  FunctionType2.getSpecializedReturnType = getSpecializedReturnType;
23665
+ function getFunctionParameters(type, excludeNameless = true) {
23666
+ if (excludeNameless) {
23667
+ return type.details.parameters.filter((param) => !!param.name);
23668
+ }
23669
+ return type.details.parameters;
23670
+ }
23671
+ FunctionType2.getFunctionParameters = getFunctionParameters;
23671
23672
  })(FunctionType = exports.FunctionType || (exports.FunctionType = {}));
23672
23673
  var OverloadedFunctionType;
23673
23674
  (function(OverloadedFunctionType2) {
@@ -26536,7 +26537,7 @@ var require_typeUtils = __commonJS({
26536
26537
  return true;
26537
26538
  });
26538
26539
  const classListsToMerge = [];
26539
- filteredBaseClasses.forEach((baseClass, index) => {
26540
+ filteredBaseClasses.forEach((baseClass) => {
26540
26541
  if ((0, types_1.isInstantiableClass)(baseClass)) {
26541
26542
  const typeVarContext2 = buildTypeVarContextFromSpecializedClass(baseClass, false);
26542
26543
  classListsToMerge.push(baseClass.details.mro.map((mroClass) => {
@@ -35609,6 +35610,7 @@ var require_signatureHelpProvider = __commonJS({
35609
35610
  var docStringUtils_1 = require_docStringUtils();
35610
35611
  var ParseTreeUtils = __importStar(require_parseTreeUtils());
35611
35612
  var parseTreeUtils_1 = require_parseTreeUtils();
35613
+ var types_1 = require_types();
35612
35614
  var cancellationUtils_1 = require_cancellationUtils();
35613
35615
  var positionUtils_1 = require_positionUtils();
35614
35616
  var tooltipUtils_1 = require_tooltipUtils();
@@ -35663,7 +35665,7 @@ var require_signatureHelpProvider = __commonJS({
35663
35665
  const parameters = [];
35664
35666
  const functionDocString = (_a = (0, tooltipUtils_1.getFunctionDocStringFromType)(functionType, sourceMapper, evaluator)) !== null && _a !== void 0 ? _a : this._getDocStringFromCallNode(callNode, sourceMapper, evaluator);
35665
35667
  let label = "(";
35666
- const params = functionType.details.parameters;
35668
+ const params = types_1.FunctionType.getFunctionParameters(functionType);
35667
35669
  stringParts[0].forEach((paramString, paramIndex) => {
35668
35670
  let paramName = "";
35669
35671
  if (paramIndex < params.length) {
@@ -38430,14 +38432,18 @@ var require_binder = __commonJS({
38430
38432
  return this._isKnownAnnotation(typeAnnotation, name, this._dataclassesImportAliases, this._dataclassesSymbolAliases);
38431
38433
  }
38432
38434
  _isKnownAnnotation(typeAnnotation, name, importAliases, symbolAliases) {
38433
- if (typeAnnotation.nodeType === 38) {
38434
- const alias = symbolAliases.get(typeAnnotation.value);
38435
+ let annotationNode = typeAnnotation;
38436
+ if (annotationNode.nodeType === 48 && annotationNode.typeAnnotation) {
38437
+ annotationNode = annotationNode.typeAnnotation;
38438
+ }
38439
+ if (annotationNode.nodeType === 38) {
38440
+ const alias = symbolAliases.get(annotationNode.value);
38435
38441
  if (alias === name) {
38436
38442
  return true;
38437
38443
  }
38438
- } else if (typeAnnotation.nodeType === 35) {
38439
- if (typeAnnotation.leftExpression.nodeType === 38 && typeAnnotation.memberName.value === name) {
38440
- const baseName = typeAnnotation.leftExpression.value;
38444
+ } else if (annotationNode.nodeType === 35) {
38445
+ if (annotationNode.leftExpression.nodeType === 38 && annotationNode.memberName.value === name) {
38446
+ const baseName = annotationNode.leftExpression.value;
38441
38447
  return importAliases.some((alias) => alias === baseName);
38442
38448
  }
38443
38449
  }
@@ -45573,7 +45579,10 @@ var require_typeGuards = __commonJS({
45573
45579
  }
45574
45580
  ]);
45575
45581
  }
45576
- const newClassInstanceType = types_1.ClassType.cloneAsInstance(newClassType);
45582
+ let newClassInstanceType = types_1.ClassType.cloneAsInstance(newClassType);
45583
+ if (varType.condition) {
45584
+ newClassInstanceType = (0, typeUtils_1.addConditionToType)(newClassInstanceType, varType.condition);
45585
+ }
45577
45586
  filteredTypes.push(isInstanceCheck ? newClassInstanceType : types_1.ClassType.cloneAsInstantiable(newClassInstanceType));
45578
45587
  }
45579
45588
  }
@@ -46215,7 +46224,7 @@ var require_patternMatching = __commonJS({
46215
46224
  }
46216
46225
  }
46217
46226
  } else {
46218
- if (!(0, types_1.isNever)(narrowedEntryType) || (0, types_1.isAnyOrUnknown)(entryType)) {
46227
+ if (!(0, types_1.isNever)(narrowedEntryType)) {
46219
46228
  isDefiniteMatch = false;
46220
46229
  }
46221
46230
  }
@@ -46450,7 +46459,13 @@ var require_patternMatching = __commonJS({
46450
46459
  false
46451
46460
  );
46452
46461
  const matchTypeInstance = types_1.ClassType.cloneAsInstance(unspecializedMatchType);
46453
- if ((0, constraintSolver_1.populateTypeVarContextBasedOnExpectedType)(evaluator, matchTypeInstance, subjectSubtypeExpanded, typeVarContext, [])) {
46462
+ if ((0, constraintSolver_1.populateTypeVarContextBasedOnExpectedType)(
46463
+ evaluator,
46464
+ matchTypeInstance,
46465
+ subjectSubtypeExpanded,
46466
+ typeVarContext,
46467
+ void 0
46468
+ )) {
46454
46469
  resultType = (0, typeUtils_1.applySolvedTypeVars)(
46455
46470
  matchTypeInstance,
46456
46471
  typeVarContext,
@@ -51487,6 +51502,8 @@ var require_typeEvaluator = __commonJS({
51487
51502
  }
51488
51503
  function getTypeOfClassMember(errorNode, classType, memberName, usage = { method: "get" }, diag = void 0, memberAccessFlags = 0, bindToType) {
51489
51504
  let memberInfo;
51505
+ const classDiag = diag ? new diagnostic_1.DiagnosticAddendum() : void 0;
51506
+ const metaclassDiag = diag ? new diagnostic_1.DiagnosticAddendum() : void 0;
51490
51507
  if (types_1.ClassType.isPartiallyEvaluated(classType)) {
51491
51508
  addDiagnostic(AnalyzerNodeInfo.getFileInfo(errorNode).diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.classDefinitionCycle().format({ name: classType.details.name }), errorNode);
51492
51509
  return { type: types_1.UnknownType.create() };
@@ -51498,7 +51515,7 @@ var require_typeEvaluator = __commonJS({
51498
51515
  false,
51499
51516
  memberName,
51500
51517
  usage,
51501
- diag,
51518
+ classDiag,
51502
51519
  memberAccessFlags | 1,
51503
51520
  bindToType
51504
51521
  );
@@ -51512,6 +51529,7 @@ var require_typeEvaluator = __commonJS({
51512
51529
  }), errorNode);
51513
51530
  }
51514
51531
  }
51532
+ const isMemberPresentOnClass = (memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.classType) !== void 0;
51515
51533
  if (!memberInfo) {
51516
51534
  const metaclass = classType.details.effectiveMetaclass;
51517
51535
  if (metaclass && (0, types_1.isInstantiableClass)(metaclass) && !types_1.ClassType.isSameGenericClass(metaclass, classType)) {
@@ -51521,7 +51539,7 @@ var require_typeEvaluator = __commonJS({
51521
51539
  true,
51522
51540
  memberName,
51523
51541
  usage,
51524
- void 0,
51542
+ metaclassDiag,
51525
51543
  memberAccessFlags,
51526
51544
  classType
51527
51545
  );
@@ -51534,6 +51552,10 @@ var require_typeEvaluator = __commonJS({
51534
51552
  isAsymmetricDescriptor: memberInfo.isAsymmetricDescriptor
51535
51553
  };
51536
51554
  }
51555
+ const subDiag = isMemberPresentOnClass ? classDiag : metaclassDiag;
51556
+ if (diag && subDiag) {
51557
+ diag.addAddendum(subDiag);
51558
+ }
51537
51559
  return void 0;
51538
51560
  }
51539
51561
  function getBoundMethod(classType, memberName, recursionCount = 0, treatConstructorAsClassMember = false) {
@@ -58025,8 +58047,9 @@ var require_typeEvaluator = __commonJS({
58025
58047
  const minLambdaParamCount = node.parameters.filter((param) => param.category === 0 && param.defaultValue === void 0).length;
58026
58048
  const maxLambdaParamCount = node.parameters.filter((param) => param.category === 0).length;
58027
58049
  expectedFunctionTypes = expectedFunctionTypes.filter((functionType2) => {
58028
- const functionParamCount = functionType2.details.parameters.filter((param) => !!param.name && !param.hasDefault).length;
58029
- const hasVarArgs = functionType2.details.parameters.some((param) => !!param.name && param.category !== 0);
58050
+ const params = types_1.FunctionType.getFunctionParameters(functionType2);
58051
+ const functionParamCount = params.filter((param) => !param.hasDefault).length;
58052
+ const hasVarArgs = params.some((param) => param.category !== 0);
58030
58053
  return hasVarArgs || functionParamCount >= minLambdaParamCount && functionParamCount <= maxLambdaParamCount;
58031
58054
  });
58032
58055
  }
@@ -58108,14 +58131,6 @@ var require_typeEvaluator = __commonJS({
58108
58131
  function getTypeOfListComprehension(node, expectedType) {
58109
58132
  let isIncomplete = false;
58110
58133
  let typeErrors = false;
58111
- const elementTypeResult = getElementTypeFromListComprehension(node);
58112
- if (elementTypeResult.isIncomplete) {
58113
- isIncomplete = true;
58114
- }
58115
- if (elementTypeResult.typeErrors) {
58116
- typeErrors = true;
58117
- }
58118
- const elementType = elementTypeResult.type;
58119
58134
  let isAsync = node.forIfNodes.some((comp) => {
58120
58135
  return comp.nodeType === 33 && comp.isAsync || comp.nodeType === 34 && comp.testExpression.nodeType === 6;
58121
58136
  });
@@ -58123,6 +58138,18 @@ var require_typeEvaluator = __commonJS({
58123
58138
  if (node.expression.nodeType === 6) {
58124
58139
  isAsync = true;
58125
58140
  }
58141
+ let expectedElementType;
58142
+ if (expectedType) {
58143
+ expectedElementType = getTypeOfIterator(expectedType, isAsync, void 0);
58144
+ }
58145
+ const elementTypeResult = getElementTypeFromListComprehension(node, expectedElementType);
58146
+ if (elementTypeResult.isIncomplete) {
58147
+ isIncomplete = true;
58148
+ }
58149
+ if (elementTypeResult.typeErrors) {
58150
+ typeErrors = true;
58151
+ }
58152
+ const elementType = elementTypeResult.type;
58126
58153
  if (!isAsync && expectedType && (0, types_1.isClassInstance)(expectedType) && types_1.ClassType.isBuiltIn(expectedType, "AsyncGenerator")) {
58127
58154
  isAsync = true;
58128
58155
  }
@@ -59716,11 +59743,11 @@ var require_typeEvaluator = __commonJS({
59716
59743
  }
59717
59744
  function runClassTypeHooks(type) {
59718
59745
  classTypeHooks.forEach((hook) => {
59719
- if (hook.dependency === type) {
59746
+ if (types_1.ClassType.isSameGenericClass(hook.dependency, type)) {
59720
59747
  hook.callback();
59721
59748
  }
59722
59749
  });
59723
- classTypeHooks = classTypeHooks.filter((hook) => hook.dependency !== type);
59750
+ classTypeHooks = classTypeHooks.filter((hook) => !types_1.ClassType.isSameGenericClass(hook.dependency, type));
59724
59751
  }
59725
59752
  function completeClassTypeDeferred(type, errorNode) {
59726
59753
  if (!(0, typeUtils_1.computeMroLinearization)(type)) {
@@ -60894,7 +60921,7 @@ var require_typeEvaluator = __commonJS({
60894
60921
  return getInferredTypeOfDeclaration(symbolWithScope.symbol, aliasDecl);
60895
60922
  }
60896
60923
  function evaluateTypesForExpressionInContext(node) {
60897
- var _a, _b, _c, _d, _e;
60924
+ var _a, _b, _c, _d, _e, _f;
60898
60925
  if (node.nodeType === 38 && node.parent) {
60899
60926
  if (node.parent.nodeType === 28 && node.parent.name === node) {
60900
60927
  getTypeOfFunction(node.parent);
@@ -60943,7 +60970,9 @@ var require_typeEvaluator = __commonJS({
60943
60970
  });
60944
60971
  return;
60945
60972
  }
60946
- getTypeOfAnnotation(annotationNode);
60973
+ getTypeOfAnnotation(annotationNode, {
60974
+ isVariableAnnotation: ((_a = annotationNode.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 54
60975
+ });
60947
60976
  return;
60948
60977
  }
60949
60978
  const possibleCaseNode = ParseTreeUtils.getParentNodeOfType(node, 64);
@@ -61017,7 +61046,7 @@ var require_typeEvaluator = __commonJS({
61017
61046
  return;
61018
61047
  }
61019
61048
  case 75: {
61020
- if (nodeToEvaluate === parent.name && ((_a = parent.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 76 && ((_b = parent.parent.parent) === null || _b === void 0 ? void 0 : _b.nodeType) === 77) {
61049
+ if (nodeToEvaluate === parent.name && ((_b = parent.parent) === null || _b === void 0 ? void 0 : _b.nodeType) === 76 && ((_c = parent.parent.parent) === null || _c === void 0 ? void 0 : _c.nodeType) === 77) {
61021
61050
  getTypeOfTypeAlias(parent.parent.parent);
61022
61051
  return;
61023
61052
  }
@@ -61028,9 +61057,9 @@ var require_typeEvaluator = __commonJS({
61028
61057
  return;
61029
61058
  }
61030
61059
  case 13: {
61031
- if (((_c = parent.parent) === null || _c === void 0 ? void 0 : _c.nodeType) === 10) {
61060
+ if (((_d = parent.parent) === null || _d === void 0 ? void 0 : _d.nodeType) === 10) {
61032
61061
  getTypeOfClass(parent.parent);
61033
- } else if (((_d = parent.parent) === null || _d === void 0 ? void 0 : _d.nodeType) === 28) {
61062
+ } else if (((_e = parent.parent) === null || _e === void 0 ? void 0 : _e.nodeType) === 28) {
61034
61063
  getTypeOfFunction(parent.parent);
61035
61064
  }
61036
61065
  return;
@@ -61046,7 +61075,7 @@ var require_typeEvaluator = __commonJS({
61046
61075
  if (nodeToEvaluate === parent.name) {
61047
61076
  return;
61048
61077
  }
61049
- if (((_e = parent.parent) === null || _e === void 0 ? void 0 : _e.nodeType) === 10) {
61078
+ if (((_f = parent.parent) === null || _f === void 0 ? void 0 : _f.nodeType) === 10) {
61050
61079
  getTypeOfClass(parent.parent);
61051
61080
  return;
61052
61081
  }
@@ -61394,8 +61423,8 @@ var require_typeEvaluator = __commonJS({
61394
61423
  received: typeArgCount
61395
61424
  }), typeArgs[typeParameters.length].node);
61396
61425
  }
61426
+ typeArgCount = typeParameters.length;
61397
61427
  }
61398
- typeArgCount = typeParameters.length;
61399
61428
  } else if (typeArgCount < typeParameters.length) {
61400
61429
  const fileInfo2 = AnalyzerNodeInfo.getFileInfo(errorNode);
61401
61430
  addDiagnostic(fileInfo2.diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.typeArgsTooFew().format({
@@ -61517,6 +61546,9 @@ var require_typeEvaluator = __commonJS({
61517
61546
  }
61518
61547
  return typeArgType;
61519
61548
  });
61549
+ if (typeArgs && classType.details.typeParameters.length === 0 && types_1.ClassType.isPartiallyEvaluated(classType)) {
61550
+ typeArgTypes = typeArgs.map((t) => (0, typeUtils_1.convertToInstance)(t.type));
61551
+ }
61520
61552
  const specializedClass = types_1.ClassType.cloneForSpecialization(classType, typeArgTypes, typeArgs !== void 0);
61521
61553
  return specializedClass;
61522
61554
  }
@@ -62283,6 +62315,17 @@ var require_typeEvaluator = __commonJS({
62283
62315
  throw e;
62284
62316
  }
62285
62317
  } else {
62318
+ const resolvedDecl = resolveAliasDeclaration(
62319
+ decl,
62320
+ true,
62321
+ AnalyzerNodeInfo.getFileInfo(decl.node).isStubFile
62322
+ );
62323
+ if ((resolvedDecl === null || resolvedDecl === void 0 ? void 0 : resolvedDecl.type) === 6) {
62324
+ const classTypeInfo = getTypeOfClass(resolvedDecl.node);
62325
+ if (classTypeInfo === null || classTypeInfo === void 0 ? void 0 : classTypeInfo.decoratedType) {
62326
+ typesToCombine.push(classTypeInfo.decoratedType);
62327
+ }
62328
+ }
62286
62329
  isIncomplete = true;
62287
62330
  }
62288
62331
  }
@@ -64208,10 +64251,7 @@ var require_typeEvaluator = __commonJS({
64208
64251
  const effectiveDestType = (flags & 2) === 0 ? destType : srcType;
64209
64252
  const effectiveSrcType = (flags & 2) === 0 ? srcType : destType;
64210
64253
  if (effectiveDestType.details.paramSpec) {
64211
- const requiredMatchParamCount = effectiveDestType.details.parameters.filter((p) => {
64212
- if (!p.name) {
64213
- return false;
64214
- }
64254
+ const requiredMatchParamCount = types_1.FunctionType.getFunctionParameters(effectiveDestType).filter((p) => {
64215
64255
  if (p.category === 0 && (0, types_1.isParamSpec)(p.type)) {
64216
64256
  return false;
64217
64257
  }
@@ -64613,6 +64653,9 @@ var require_typeEvaluator = __commonJS({
64613
64653
  }
64614
64654
  effectiveSrcType = makeTopLevelTypeVarsConcrete(srcType);
64615
64655
  }
64656
+ if ((0, types_1.isClass)(effectiveSrcType) && types_1.ClassType.isPartiallyEvaluated(effectiveSrcType)) {
64657
+ return srcType;
64658
+ }
64616
64659
  if (destType.details.boundType) {
64617
64660
  if (!assignType(
64618
64661
  destType.details.boundType,
@@ -65255,7 +65298,7 @@ var require_checker = __commonJS({
65255
65298
  }
65256
65299
  }
65257
65300
  });
65258
- const paramSpecParams = functionTypeResult.functionType.details.parameters.filter((param) => {
65301
+ const paramSpecParams = types_1.FunctionType.getFunctionParameters(functionTypeResult.functionType).filter((param) => {
65259
65302
  if (param.typeAnnotation && (0, types_1.isTypeVar)(param.type) && (0, types_1.isParamSpec)(param.type)) {
65260
65303
  if (param.category !== 0 && param.name && param.type.paramSpecAccess) {
65261
65304
  return true;
@@ -65328,7 +65371,7 @@ var require_checker = __commonJS({
65328
65371
  }
65329
65372
  this._validateDunderSignatures(node, functionTypeResult.functionType, containingClassNode !== void 0);
65330
65373
  this._validateStrictTypeGuardFunction(node, functionTypeResult.functionType, containingClassNode !== void 0);
65331
- this._validateFunctionTypeVarUsage(node, functionTypeResult.functionType);
65374
+ this._validateFunctionTypeVarUsage(node, functionTypeResult);
65332
65375
  }
65333
65376
  if (this._fileInfo.isStubFile && node.name.value === "__getattr__") {
65334
65377
  const scope = (0, scopeUtils_1.getScopeForNode)(node);
@@ -66054,10 +66097,11 @@ var require_checker = __commonJS({
66054
66097
  _isTypeValidForUnusedValueTest(type) {
66055
66098
  return !(0, types_1.isNoneInstance)(type) && !(0, types_1.isNever)(type) && !(0, types_1.isAnyOrUnknown)(type);
66056
66099
  }
66057
- _validateFunctionTypeVarUsage(node, type) {
66100
+ _validateFunctionTypeVarUsage(node, functionTypeResult) {
66058
66101
  if (this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse === "none") {
66059
66102
  return;
66060
66103
  }
66104
+ const type = functionTypeResult.functionType;
66061
66105
  const localTypeVarUsage = /* @__PURE__ */ new Map();
66062
66106
  const classTypeVarUsage = /* @__PURE__ */ new Map();
66063
66107
  let exemptBoundTypeVar = true;
@@ -66164,7 +66208,8 @@ var require_checker = __commonJS({
66164
66208
  isUsedInReturnType = false;
66165
66209
  }
66166
66210
  }
66167
- if (isUsedInReturnType && usage.paramTypeWithEllipsisUsageCount > 0 && usage.paramTypeUsageCount === usage.paramTypeWithEllipsisUsageCount) {
66211
+ const skipUnsolvableTypeVarCheck = (0, types_1.isOverloadedFunction)(functionTypeResult.decoratedType) && !types_1.FunctionType.isOverloaded(functionTypeResult.functionType);
66212
+ if (isUsedInReturnType && usage.paramTypeWithEllipsisUsageCount > 0 && usage.paramTypeUsageCount === usage.paramTypeWithEllipsisUsageCount && !skipUnsolvableTypeVarCheck) {
66168
66213
  const diag = new diagnostic_1.DiagnosticAddendum();
66169
66214
  diag.addMessage(localize_1.Localizer.DiagnosticAddendum.typeVarUnsolvableRemedy());
66170
66215
  this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse, diagnosticRules_1.DiagnosticRule.reportInvalidTypeVarUse, localize_1.Localizer.Diagnostic.typeVarPossiblyUnsolvable().format({
@@ -69956,7 +70001,7 @@ var require_tokenizer = __commonJS({
69956
70001
  if (this._tokens.length === 0 || this._tokens[this._tokens.length - 1].type !== 2) {
69957
70002
  this._tokens.push(tokenizerTypes_1.NewLineToken.create(this._cs.position, 0, 3, this._getComments()));
69958
70003
  }
69959
- this._setIndent(0, 0, false, false);
70004
+ this._setIndent(this._cs.position, 0, 0, false, false);
69960
70005
  this._tokens.push(tokenizerTypes_1.Token.create(1, this._cs.position, 0, this._getComments()));
69961
70006
  this._addLineRange();
69962
70007
  let predominantEndOfLineSequence = "\n";
@@ -70181,6 +70226,7 @@ var require_tokenizer = __commonJS({
70181
70226
  let tab8Spaces = 0;
70182
70227
  let isTabPresent = false;
70183
70228
  let isSpacePresent = false;
70229
+ const startOffset = this._cs.position;
70184
70230
  while (!this._cs.isEndOfStream()) {
70185
70231
  switch (this._cs.currentChar) {
70186
70232
  case 32:
@@ -70203,7 +70249,7 @@ var require_tokenizer = __commonJS({
70203
70249
  this._cs.moveNext();
70204
70250
  break;
70205
70251
  default:
70206
- this._setIndent(tab1Spaces, tab8Spaces, isSpacePresent, isTabPresent);
70252
+ this._setIndent(startOffset, tab1Spaces, tab8Spaces, isSpacePresent, isTabPresent);
70207
70253
  return;
70208
70254
  case 35:
70209
70255
  case 10:
@@ -70212,7 +70258,7 @@ var require_tokenizer = __commonJS({
70212
70258
  }
70213
70259
  }
70214
70260
  }
70215
- _setIndent(tab1Spaces, tab8Spaces, isSpacePresent, isTabPresent) {
70261
+ _setIndent(startOffset, tab1Spaces, tab8Spaces, isSpacePresent, isTabPresent) {
70216
70262
  if (this._parenDepth > 0) {
70217
70263
  return;
70218
70264
  }
@@ -70229,7 +70275,7 @@ var require_tokenizer = __commonJS({
70229
70275
  isSpacePresent,
70230
70276
  isTabPresent
70231
70277
  });
70232
- this._tokens.push(tokenizerTypes_1.IndentToken.create(this._cs.position, 0, tab8Spaces, false, this._getComments()));
70278
+ this._tokens.push(tokenizerTypes_1.IndentToken.create(startOffset, tab1Spaces, tab8Spaces, false, this._getComments()));
70233
70279
  }
70234
70280
  } else {
70235
70281
  const prevTabInfo = this._indentAmounts[this._indentAmounts.length - 1];
@@ -70246,10 +70292,10 @@ var require_tokenizer = __commonJS({
70246
70292
  isSpacePresent,
70247
70293
  isTabPresent
70248
70294
  });
70249
- this._tokens.push(tokenizerTypes_1.IndentToken.create(this._cs.position, 0, tab8Spaces, isIndentAmbiguous, this._getComments()));
70295
+ this._tokens.push(tokenizerTypes_1.IndentToken.create(startOffset, tab1Spaces, tab8Spaces, isIndentAmbiguous, this._getComments()));
70250
70296
  } else if (prevTabInfo.tab8Spaces === tab8Spaces) {
70251
70297
  if (prevTabInfo.isSpacePresent && isTabPresent || prevTabInfo.isTabPresent && isSpacePresent) {
70252
- this._tokens.push(tokenizerTypes_1.IndentToken.create(this._cs.position, 0, tab8Spaces, true, this._getComments()));
70298
+ this._tokens.push(tokenizerTypes_1.IndentToken.create(startOffset, tab1Spaces, tab8Spaces, true, this._getComments()));
70253
70299
  }
70254
70300
  } else {
70255
70301
  let isDedentAmbiguous = prevTabInfo.isSpacePresent && isTabPresent || prevTabInfo.isTabPresent && isSpacePresent;
@@ -71110,50 +71156,53 @@ var require_parser = __commonJS({
71110
71156
  if (this._consumeTokensUntilType([2, 10])) {
71111
71157
  this._getNextToken();
71112
71158
  }
71113
- } else if (!this._consumeTokenIfType(2)) {
71114
- this._addError(localize_1.Localizer.Diagnostic.expectedNewline(), nextToken);
71115
71159
  } else {
71116
- const possibleIndent = this._peekToken();
71117
- if (!this._consumeTokenIfType(3)) {
71118
- this._addError(localize_1.Localizer.Diagnostic.expectedIndentedBlock(), this._peekToken());
71160
+ (0, parseNodes_1.extendRange)(matchNode, nextToken);
71161
+ if (!this._consumeTokenIfType(2)) {
71162
+ this._addError(localize_1.Localizer.Diagnostic.expectedNewline(), nextToken);
71119
71163
  } else {
71120
- const indentToken = possibleIndent;
71121
- if (indentToken.isIndentAmbiguous) {
71122
- this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), indentToken);
71123
- }
71124
- }
71125
- while (true) {
71126
- const nextToken2 = this._peekToken();
71127
- if (nextToken2.type === 3) {
71128
- this._getNextToken();
71129
- const indentToken = nextToken2;
71164
+ const possibleIndent = this._peekToken();
71165
+ if (!this._consumeTokenIfType(3)) {
71166
+ this._addError(localize_1.Localizer.Diagnostic.expectedIndentedBlock(), this._peekToken());
71167
+ } else {
71168
+ const indentToken = possibleIndent;
71130
71169
  if (indentToken.isIndentAmbiguous) {
71131
71170
  this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), indentToken);
71132
- } else {
71133
- this._addError(localize_1.Localizer.Diagnostic.unexpectedIndent(), nextToken2);
71134
71171
  }
71135
71172
  }
71136
- const caseStatement = this._parseCaseStatement();
71137
- if (!caseStatement) {
71138
- if (this._consumeTokensUntilType([2, 10])) {
71173
+ while (true) {
71174
+ const possibleUnexpectedIndent = this._peekToken();
71175
+ if (possibleUnexpectedIndent.type === 3) {
71139
71176
  this._getNextToken();
71177
+ const indentToken = possibleUnexpectedIndent;
71178
+ if (indentToken.isIndentAmbiguous) {
71179
+ this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), indentToken);
71180
+ } else {
71181
+ this._addError(localize_1.Localizer.Diagnostic.unexpectedIndent(), possibleUnexpectedIndent);
71182
+ }
71140
71183
  }
71141
- } else {
71142
- caseStatement.parent = matchNode;
71143
- matchNode.cases.push(caseStatement);
71144
- }
71145
- const dedentToken = this._peekToken();
71146
- if (this._consumeTokenIfType(4)) {
71147
- if (!dedentToken.matchesIndent) {
71148
- this._addError(localize_1.Localizer.Diagnostic.inconsistentIndent(), dedentToken);
71184
+ const caseStatement = this._parseCaseStatement();
71185
+ if (!caseStatement) {
71186
+ if (this._consumeTokensUntilType([2, 10])) {
71187
+ this._getNextToken();
71188
+ }
71189
+ } else {
71190
+ caseStatement.parent = matchNode;
71191
+ matchNode.cases.push(caseStatement);
71149
71192
  }
71150
- if (dedentToken.isDedentAmbiguous) {
71151
- this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), dedentToken);
71193
+ const dedentToken = this._peekToken();
71194
+ if (this._consumeTokenIfType(4)) {
71195
+ if (!dedentToken.matchesIndent) {
71196
+ this._addError(localize_1.Localizer.Diagnostic.inconsistentIndent(), dedentToken);
71197
+ }
71198
+ if (dedentToken.isDedentAmbiguous) {
71199
+ this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), dedentToken);
71200
+ }
71201
+ break;
71202
+ }
71203
+ if (this._peekTokenType() === 1) {
71204
+ break;
71152
71205
  }
71153
- break;
71154
- }
71155
- if (this._peekTokenType() === 1) {
71156
- break;
71157
71206
  }
71158
71207
  }
71159
71208
  if (matchNode.cases.length > 0) {
@@ -73459,17 +73508,11 @@ var require_parser = __commonJS({
73459
73508
  }
73460
73509
  const exprListResult = this._parseTestListWithComprehension();
73461
73510
  const tupleOrExpression = this._makeExpressionOrTuple(exprListResult, true);
73462
- const isExpression = exprListResult.list.length === 1 && !exprListResult.trailingComma;
73463
- if (!isExpression) {
73464
- (0, parseNodes_1.extendRange)(tupleOrExpression, startParen);
73465
- }
73511
+ (0, parseNodes_1.extendRange)(tupleOrExpression, startParen);
73466
73512
  if (this._peekTokenType() !== 14) {
73467
73513
  return this._handleExpressionParseError(8, localize_1.Localizer.Diagnostic.expectedCloseParen(), startParen, (_a = exprListResult.parseError) !== null && _a !== void 0 ? _a : tupleOrExpression);
73468
73514
  } else {
73469
- const nextToken = this._getNextToken();
73470
- if (!isExpression) {
73471
- (0, parseNodes_1.extendRange)(tupleOrExpression, nextToken);
73472
- }
73515
+ (0, parseNodes_1.extendRange)(tupleOrExpression, this._getNextToken());
73473
73516
  }
73474
73517
  return tupleOrExpression;
73475
73518
  }
@@ -91696,7 +91739,7 @@ var ImportCompletionProvider = class {
91696
91739
  return [];
91697
91740
  const items = [];
91698
91741
  for (const o of result.items) {
91699
- items.push({ label: o.word, sortText: o.sortText, kind: CompletionItemKind.Module, filterText: o.filterText });
91742
+ items.push({ label: o.word, sortText: o.sortText, kind: import_coc10.CompletionItemKind.Module, filterText: o.filterText });
91700
91743
  }
91701
91744
  return items;
91702
91745
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-pyright",
3
- "version": "1.1.271",
3
+ "version": "1.1.272",
4
4
  "description": "Pyright extension for coc.nvim, static type checker for Python",
5
5
  "author": "Heyward Fann <fannheyward@gmail.com>",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "@types/which": "^2.0.0",
45
45
  "@typescript-eslint/eslint-plugin": "^5.6.0",
46
46
  "@typescript-eslint/parser": "^5.6.0",
47
- "@zzzen/pyright-internal": "^1.2.0-dev.20220911",
47
+ "@zzzen/pyright-internal": "^1.2.0-dev.20220918",
48
48
  "coc.nvim": "^0.0.82",
49
49
  "diff-match-patch": "^1.0.5",
50
50
  "esbuild": "^0.15.6",
@@ -1486,6 +1486,6 @@
1486
1486
  ]
1487
1487
  },
1488
1488
  "dependencies": {
1489
- "pyright": "^1.1.271"
1489
+ "pyright": "^1.1.272"
1490
1490
  }
1491
1491
  }