@zzzen/pyright-internal 1.2.0-dev.20251005 → 1.2.0-dev.20251012

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 (64) hide show
  1. package/dist/analyzer/decorators.js +19 -16
  2. package/dist/analyzer/decorators.js.map +1 -1
  3. package/dist/analyzer/service.d.ts +3 -1
  4. package/dist/analyzer/service.js +15 -4
  5. package/dist/analyzer/service.js.map +1 -1
  6. package/dist/analyzer/typeEvaluator.js +14 -1
  7. package/dist/analyzer/typeEvaluator.js.map +1 -1
  8. package/dist/analyzer/typePrinter.js +5 -0
  9. package/dist/analyzer/typePrinter.js.map +1 -1
  10. package/dist/common/fullAccessHost.d.ts +2 -2
  11. package/dist/common/fullAccessHost.js +2 -2
  12. package/dist/common/fullAccessHost.js.map +1 -1
  13. package/dist/common/host.d.ts +1 -1
  14. package/dist/common/host.js.map +1 -1
  15. package/dist/common/pythonVersion.js +1 -1
  16. package/dist/languageServerBase.d.ts +8 -6
  17. package/dist/languageServerBase.js +94 -60
  18. package/dist/languageServerBase.js.map +1 -1
  19. package/dist/languageService/pullDiagnosticsDynamicFeature.d.ts +12 -0
  20. package/dist/languageService/pullDiagnosticsDynamicFeature.js +43 -0
  21. package/dist/languageService/pullDiagnosticsDynamicFeature.js.map +1 -0
  22. package/dist/localization/package.nls.cs.json +3 -1
  23. package/dist/localization/package.nls.de.json +3 -1
  24. package/dist/localization/package.nls.es.json +3 -1
  25. package/dist/localization/package.nls.fr.json +3 -1
  26. package/dist/localization/package.nls.it.json +3 -1
  27. package/dist/localization/package.nls.ja.json +3 -1
  28. package/dist/localization/package.nls.ko.json +3 -1
  29. package/dist/localization/package.nls.pl.json +3 -1
  30. package/dist/localization/package.nls.pt-br.json +3 -1
  31. package/dist/localization/package.nls.qps-ploc.json +3 -1
  32. package/dist/localization/package.nls.ru.json +3 -1
  33. package/dist/localization/package.nls.tr.json +3 -1
  34. package/dist/localization/package.nls.zh-cn.json +3 -1
  35. package/dist/localization/package.nls.zh-tw.json +3 -1
  36. package/dist/parser/parser.js +6 -2
  37. package/dist/parser/parser.js.map +1 -1
  38. package/dist/pyright.js +2 -0
  39. package/dist/pyright.js.map +1 -1
  40. package/dist/tests/chainedSourceFiles.test.js +1 -0
  41. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  42. package/dist/tests/checker.test.js +1 -1
  43. package/dist/tests/config.test.js +5 -1
  44. package/dist/tests/config.test.js.map +1 -1
  45. package/dist/tests/envVarUtils.test.js +1 -0
  46. package/dist/tests/envVarUtils.test.js.map +1 -1
  47. package/dist/tests/fourslash/signature.complicated.fourslash.js +3 -3
  48. package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
  49. package/dist/tests/harness/fourslash/testLanguageService.js +1 -0
  50. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  51. package/dist/tests/harness/fourslash/testState.js +1 -0
  52. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  53. package/dist/tests/languageServer.test.js +4 -7
  54. package/dist/tests/languageServer.test.js.map +1 -1
  55. package/dist/tests/lsp/languageServerTestUtils.d.ts +5 -1
  56. package/dist/tests/lsp/languageServerTestUtils.js +103 -23
  57. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -1
  58. package/dist/tests/typeEvaluator1.test.js +5 -1
  59. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  60. package/dist/tests/typeEvaluator2.test.js +5 -1
  61. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  62. package/dist/tests/typeEvaluator7.test.js +5 -1
  63. package/dist/tests/typeEvaluator7.test.js.map +1 -1
  64. package/package.json +1 -1
@@ -580,6 +580,7 @@
580
580
  "typedDictBaseClass": "TypedDict 类的所有基类也必须是 TypedDict 类",
581
581
  "typedDictBoolParam": "预期“{name}”参数的值为 True 或 False",
582
582
  "typedDictClosedExtras": "基类 \"{name}\" 是限制额外项类型 \"{type}\" 的 TypedDict",
583
+ "typedDictClosedFalseNonOpenBase": "Base class \"{name}\" is not an open TypedDict; closed=False is not allowed",
583
584
  "typedDictClosedNoExtras": "基类 \"{name}\" 是 closed TypedDict; 不允许使用额外的项",
584
585
  "typedDictDelete": "无法删除 TypedDict 中的项",
585
586
  "typedDictEmptyName": "TypedDict 中的名称不能为空",
@@ -605,6 +606,7 @@
605
606
  "unannotatedFunctionSkipped": "已跳过对函数“{name}”的分析,因为它未被批注",
606
607
  "unaryOperationNotAllowed": "类型表达式中不允许使用一元运算符",
607
608
  "unexpectedAsyncToken": "“def”、“with” 或 “for” 应跟随 “async”",
609
+ "unexpectedEof": "Unexpected EOF",
608
610
  "unexpectedExprToken": "表达式末尾出现意外标记",
609
611
  "unexpectedIndent": "意外缩进",
610
612
  "unexpectedUnindent": "不应取消缩进",
@@ -741,7 +743,7 @@
741
743
  "namedTupleNotAllowed": "不能对实例或类检查使用 NamedTuple",
742
744
  "newMethodLocation": "__new__方法已在类“{type}”中定义",
743
745
  "newMethodSignature": "__new__的签名为“{type}”",
744
- "newTypeClassNotAllowed": "不能将使用 NewType 创建的类用于实例和类检查",
746
+ "newTypeClassNotAllowed": "Type created with NewType cannot be used with instance and class checks",
745
747
  "noOverloadAssignable": "没有重载函数与类型“{type}”匹配",
746
748
  "noneNotAllowed": "不能对实例或类检查使用 None",
747
749
  "orPatternMissingName": "缺少名称: {name}",
@@ -580,6 +580,7 @@
580
580
  "typedDictBaseClass": "TypedDict 類別的所有基底類別也必須是 TypedDict 類別",
581
581
  "typedDictBoolParam": "預期 \"{name}\" 參數的值為 True 或 False",
582
582
  "typedDictClosedExtras": "基類 \"{name}\" 是限制額外專案類型的 TypedDict \"{type}\"",
583
+ "typedDictClosedFalseNonOpenBase": "Base class \"{name}\" is not an open TypedDict; closed=False is not allowed",
583
584
  "typedDictClosedNoExtras": "基底類別 \"{name}\" 是 closed 的 TypedDict; 不允許額外項目",
584
585
  "typedDictDelete": "無法刪除 TypedDict 中的項目",
585
586
  "typedDictEmptyName": "TypedDict 內的名稱不可為空白",
@@ -605,6 +606,7 @@
605
606
  "unannotatedFunctionSkipped": "因為未標註函式 \"{name}\",所以略過其分析",
606
607
  "unaryOperationNotAllowed": "類型運算式中不允許一元運算子",
607
608
  "unexpectedAsyncToken": "預期為 \"def\"、\"with\" 或 \"for\" 來追蹤 \"async\"",
609
+ "unexpectedEof": "Unexpected EOF",
608
610
  "unexpectedExprToken": "運算式結尾未預期的權杖",
609
611
  "unexpectedIndent": "未預期的縮排",
610
612
  "unexpectedUnindent": "取消縮排未預期",
@@ -741,7 +743,7 @@
741
743
  "namedTupleNotAllowed": "執行個體或類別檢查無法使用 NamedTuple",
742
744
  "newMethodLocation": "__new__ 方法於類別 \"{type}\" 中定義",
743
745
  "newMethodSignature": "__new__ 的簽章為 \"{type}\"",
744
- "newTypeClassNotAllowed": "使用 NewType 建立的類別不能與執行個體和類別檢查一起使用",
746
+ "newTypeClassNotAllowed": "Type created with NewType cannot be used with instance and class checks",
745
747
  "noOverloadAssignable": "沒有任何多載函式符合類型 \"{type}\"",
746
748
  "noneNotAllowed": "無法對執行個體或類別檢查使用 None",
747
749
  "orPatternMissingName": "遺失名稱: {name}",
@@ -1767,6 +1767,7 @@ class Parser {
1767
1767
  // "dry run" to determine whether the entire list of "with items"
1768
1768
  // is enclosed in parentheses.
1769
1769
  let isParenthesizedWithItemList = false;
1770
+ let isParenthesizedDisallowed = false;
1770
1771
  if (possibleParen.type === 13 /* TokenType.OpenParenthesis */) {
1771
1772
  const openParenTokenIndex = this._tokenIndex;
1772
1773
  this._suppressErrors(() => {
@@ -1782,7 +1783,10 @@ class Parser {
1782
1783
  }
1783
1784
  if (this._peekToken().type === 14 /* TokenType.CloseParenthesis */ &&
1784
1785
  this._peekToken(1).type === 10 /* TokenType.Colon */) {
1785
- isParenthesizedWithItemList = withItemList.length !== 1 || withItemList[0].d.target !== undefined;
1786
+ isParenthesizedWithItemList = true;
1787
+ // Some forms of parenthesized context with statements were not
1788
+ // allowed prior to Python 3.9. Is this such a form?
1789
+ isParenthesizedDisallowed = withItemList.length !== 1 || withItemList[0].d.target !== undefined;
1786
1790
  }
1787
1791
  this._tokenIndex = openParenTokenIndex;
1788
1792
  withItemList = [];
@@ -1790,7 +1794,7 @@ class Parser {
1790
1794
  }
1791
1795
  if (isParenthesizedWithItemList) {
1792
1796
  this._consumeTokenIfType(13 /* TokenType.OpenParenthesis */);
1793
- if (pythonVersion_1.PythonVersion.isLessThan(this._getLanguageVersion(), pythonVersion_1.pythonVersion3_9)) {
1797
+ if (isParenthesizedDisallowed && pythonVersion_1.PythonVersion.isLessThan(this._getLanguageVersion(), pythonVersion_1.pythonVersion3_9)) {
1794
1798
  this._addSyntaxError(localize_1.LocMessage.parenthesizedContextManagerIllegal(), possibleParen);
1795
1799
  }
1796
1800
  }