@zzzen/pyright-internal 1.2.0-dev.20240414 → 1.2.0-dev.20240421

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 (53) hide show
  1. package/dist/analyzer/constructors.js +22 -10
  2. package/dist/analyzer/constructors.js.map +1 -1
  3. package/dist/analyzer/dataClasses.js +3 -0
  4. package/dist/analyzer/dataClasses.js.map +1 -1
  5. package/dist/analyzer/service.d.ts +0 -2
  6. package/dist/analyzer/service.js +1 -4
  7. package/dist/analyzer/service.js.map +1 -1
  8. package/dist/analyzer/typeEvaluator.d.ts +3 -1
  9. package/dist/analyzer/typeEvaluator.js +19 -6
  10. package/dist/analyzer/typeEvaluator.js.map +1 -1
  11. package/dist/analyzer/typeEvaluatorWithTracker.js +4 -2
  12. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  13. package/dist/backgroundThreadBase.js +4 -2
  14. package/dist/backgroundThreadBase.js.map +1 -1
  15. package/dist/commands/dumpFileDebugInfoCommand.d.ts +5 -0
  16. package/dist/commands/dumpFileDebugInfoCommand.js +83 -74
  17. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  18. package/dist/common/core.d.ts +5 -0
  19. package/dist/common/core.js +8 -1
  20. package/dist/common/core.js.map +1 -1
  21. package/dist/common/fileSystem.d.ts +0 -1
  22. package/dist/common/fileSystem.js +1 -1
  23. package/dist/common/fileSystem.js.map +1 -1
  24. package/dist/common/realFileSystem.d.ts +35 -1
  25. package/dist/common/realFileSystem.js +4 -1
  26. package/dist/common/realFileSystem.js.map +1 -1
  27. package/dist/common/uri/uri.d.ts +2 -0
  28. package/dist/common/uri/uri.js +9 -4
  29. package/dist/common/uri/uri.js.map +1 -1
  30. package/dist/localization/localize.d.ts +3 -0
  31. package/dist/localization/localize.js +1 -0
  32. package/dist/localization/localize.js.map +1 -1
  33. package/dist/localization/package.nls.cs.json +3 -0
  34. package/dist/localization/package.nls.de.json +3 -0
  35. package/dist/localization/package.nls.en-us.json +1 -0
  36. package/dist/localization/package.nls.es.json +3 -0
  37. package/dist/localization/package.nls.fr.json +3 -0
  38. package/dist/localization/package.nls.it.json +3 -0
  39. package/dist/localization/package.nls.ja.json +3 -0
  40. package/dist/localization/package.nls.ko.json +3 -0
  41. package/dist/localization/package.nls.pl.json +3 -0
  42. package/dist/localization/package.nls.pt-br.json +3 -0
  43. package/dist/localization/package.nls.qps-ploc.json +3 -0
  44. package/dist/localization/package.nls.ru.json +3 -0
  45. package/dist/localization/package.nls.tr.json +3 -0
  46. package/dist/localization/package.nls.zh-cn.json +3 -0
  47. package/dist/localization/package.nls.zh-tw.json +3 -0
  48. package/dist/tests/config.test.js +11 -0
  49. package/dist/tests/config.test.js.map +1 -1
  50. package/dist/tests/importStatementUtils.test.js +1 -1
  51. package/dist/tests/importStatementUtils.test.js.map +1 -1
  52. package/dist/tests/typeEvaluator4.test.js +1 -1
  53. package/package.json +1 -1
@@ -170,7 +170,7 @@ const printExpressionTypes = false;
170
170
  // complex. Otherwise we risk overflowing the stack or incurring extremely
171
171
  // long analysis times. This number has been tuned empirically.
172
172
  exports.maxCodeComplexity = 768;
173
- function createTypeEvaluator(importLookup, evaluatorOptions) {
173
+ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
174
174
  const symbolResolutionStack = [];
175
175
  const asymmetricAccessorAssignmentCache = new Set();
176
176
  const speculativeTypeTracker = new typeCacheUtils_1.SpeculativeTypeTracker();
@@ -15859,7 +15859,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15859
15859
  }
15860
15860
  return types_1.UnknownType.create();
15861
15861
  }
15862
- function getFunctionInferredReturnType(type, args) {
15862
+ function _getFunctionInferredReturnType(type, args) {
15863
15863
  var _a;
15864
15864
  let returnType;
15865
15865
  let isIncomplete = false;
@@ -17432,12 +17432,23 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17432
17432
  else if (remainingDestSubtypes.length === remainingSrcSubtypes.length) {
17433
17433
  // If the number of remaining source subtypes is the same as the number
17434
17434
  // of dest TypeVars, try to assign each source subtype to its own dest TypeVar.
17435
- remainingDestSubtypes.forEach((destSubtype, index) => {
17436
- const srcSubtype = remainingSrcSubtypes[index];
17437
- if (!assignType(destSubtype, srcSubtype, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
17435
+ const reorderedDestSubtypes = [...remainingDestSubtypes];
17436
+ for (let srcIndex = 0; srcIndex < remainingSrcSubtypes.length; srcIndex++) {
17437
+ let foundMatchForSrc = false;
17438
+ for (let destIndex = 0; destIndex < reorderedDestSubtypes.length; destIndex++) {
17439
+ if (assignType(reorderedDestSubtypes[destIndex], remainingSrcSubtypes[srcIndex], diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
17440
+ foundMatchForSrc = true;
17441
+ // Move the matched dest TypeVar to the end of the list so the other
17442
+ // dest TypeVars have a better chance of being assigned to.
17443
+ reorderedDestSubtypes.push(...reorderedDestSubtypes.splice(destIndex, 1));
17444
+ break;
17445
+ }
17446
+ }
17447
+ if (!foundMatchForSrc) {
17438
17448
  canUseFastPath = false;
17449
+ break;
17439
17450
  }
17440
- });
17451
+ }
17441
17452
  // We can avoid checking the source subtypes that have already been checked.
17442
17453
  sortedSrcTypes = remainingSrcSubtypes;
17443
17454
  }
@@ -19253,6 +19264,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
19253
19264
  });
19254
19265
  });
19255
19266
  }
19267
+ // Track these apis internal usages when logging is on. otherwise, it should be noop.
19268
+ const getFunctionInferredReturnType = wrapWithLogger(_getFunctionInferredReturnType);
19256
19269
  const evaluatorInterface = {
19257
19270
  runWithCancellationToken,
19258
19271
  getType,