@zzzen/pyright-internal 1.2.0-dev.20221016 → 1.2.0-dev.20221127

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 (332) hide show
  1. package/dist/analyzer/backgroundAnalysisProgram.d.ts +7 -9
  2. package/dist/analyzer/backgroundAnalysisProgram.js +14 -52
  3. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  4. package/dist/analyzer/binder.js +43 -32
  5. package/dist/analyzer/binder.js.map +1 -1
  6. package/dist/analyzer/checker.d.ts +15 -3
  7. package/dist/analyzer/checker.js +260 -143
  8. package/dist/analyzer/checker.js.map +1 -1
  9. package/dist/analyzer/codeFlowEngine.d.ts +2 -2
  10. package/dist/analyzer/codeFlowEngine.js +85 -88
  11. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  12. package/dist/analyzer/codeFlowTypes.d.ts +1 -0
  13. package/dist/analyzer/codeFlowTypes.js +3 -1
  14. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  15. package/dist/analyzer/constraintSolver.js +1 -1
  16. package/dist/analyzer/constraintSolver.js.map +1 -1
  17. package/dist/analyzer/dataClasses.d.ts +3 -3
  18. package/dist/analyzer/dataClasses.js +77 -57
  19. package/dist/analyzer/dataClasses.js.map +1 -1
  20. package/dist/analyzer/declaration.js.map +1 -1
  21. package/dist/analyzer/declarationUtils.d.ts +1 -1
  22. package/dist/analyzer/declarationUtils.js +6 -4
  23. package/dist/analyzer/declarationUtils.js.map +1 -1
  24. package/dist/analyzer/docStringConversion.js +4 -3
  25. package/dist/analyzer/docStringConversion.js.map +1 -1
  26. package/dist/analyzer/importResolver.d.ts +3 -0
  27. package/dist/analyzer/importResolver.js +50 -8
  28. package/dist/analyzer/importResolver.js.map +1 -1
  29. package/dist/analyzer/importResult.d.ts +1 -0
  30. package/dist/analyzer/namedTuples.js +1 -1
  31. package/dist/analyzer/namedTuples.js.map +1 -1
  32. package/dist/analyzer/packageTypeVerifier.d.ts +2 -1
  33. package/dist/analyzer/packageTypeVerifier.js +16 -10
  34. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  35. package/dist/analyzer/parseTreeUtils.d.ts +2 -1
  36. package/dist/analyzer/parseTreeUtils.js +38 -3
  37. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  38. package/dist/analyzer/parseTreeWalker.d.ts +86 -79
  39. package/dist/analyzer/parseTreeWalker.js +384 -201
  40. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  41. package/dist/analyzer/program.d.ts +4 -7
  42. package/dist/analyzer/program.js +76 -77
  43. package/dist/analyzer/program.js.map +1 -1
  44. package/dist/analyzer/properties.js +10 -3
  45. package/dist/analyzer/properties.js.map +1 -1
  46. package/dist/analyzer/protocols.js +1 -1
  47. package/dist/analyzer/protocols.js.map +1 -1
  48. package/dist/analyzer/regions.d.ts +11 -0
  49. package/dist/analyzer/regions.js +57 -0
  50. package/dist/analyzer/regions.js.map +1 -0
  51. package/dist/analyzer/service.d.ts +9 -6
  52. package/dist/analyzer/service.js +58 -27
  53. package/dist/analyzer/service.js.map +1 -1
  54. package/dist/analyzer/sourceFile.d.ts +5 -2
  55. package/dist/analyzer/sourceFile.js +21 -8
  56. package/dist/analyzer/sourceFile.js.map +1 -1
  57. package/dist/analyzer/sourceFileInfoUtils.d.ts +1 -1
  58. package/dist/analyzer/sourceFileInfoUtils.js +1 -1
  59. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  60. package/dist/analyzer/sourceMapper.d.ts +6 -1
  61. package/dist/analyzer/sourceMapper.js +28 -5
  62. package/dist/analyzer/sourceMapper.js.map +1 -1
  63. package/dist/analyzer/sourceMapperUtils.d.ts +2 -1
  64. package/dist/analyzer/sourceMapperUtils.js +17 -5
  65. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  66. package/dist/analyzer/staticExpressions.js +19 -9
  67. package/dist/analyzer/staticExpressions.js.map +1 -1
  68. package/dist/analyzer/symbolUtils.d.ts +1 -0
  69. package/dist/analyzer/symbolUtils.js +5 -1
  70. package/dist/analyzer/symbolUtils.js.map +1 -1
  71. package/dist/analyzer/typeEvaluator.js +643 -254
  72. package/dist/analyzer/typeEvaluator.js.map +1 -1
  73. package/dist/analyzer/typeEvaluatorTypes.d.ts +15 -4
  74. package/dist/analyzer/typeGuards.js +9 -0
  75. package/dist/analyzer/typeGuards.js.map +1 -1
  76. package/dist/analyzer/typePrinter.d.ts +3 -1
  77. package/dist/analyzer/typePrinter.js +135 -26
  78. package/dist/analyzer/typePrinter.js.map +1 -1
  79. package/dist/analyzer/typeStubWriter.js +5 -1
  80. package/dist/analyzer/typeStubWriter.js.map +1 -1
  81. package/dist/analyzer/typeUtils.d.ts +4 -2
  82. package/dist/analyzer/typeUtils.js +112 -20
  83. package/dist/analyzer/typeUtils.js.map +1 -1
  84. package/dist/analyzer/typedDicts.js +8 -6
  85. package/dist/analyzer/typedDicts.js.map +1 -1
  86. package/dist/analyzer/types.d.ts +5 -4
  87. package/dist/analyzer/types.js +43 -20
  88. package/dist/analyzer/types.js.map +1 -1
  89. package/dist/backgroundAnalysisBase.d.ts +6 -4
  90. package/dist/backgroundAnalysisBase.js +30 -9
  91. package/dist/backgroundAnalysisBase.js.map +1 -1
  92. package/dist/backgroundThreadBase.d.ts +2 -1
  93. package/dist/backgroundThreadBase.js +4 -0
  94. package/dist/backgroundThreadBase.js.map +1 -1
  95. package/dist/commands/createTypeStub.js +3 -1
  96. package/dist/commands/createTypeStub.js.map +1 -1
  97. package/dist/common/configOptions.d.ts +1 -0
  98. package/dist/common/configOptions.js +4 -0
  99. package/dist/common/configOptions.js.map +1 -1
  100. package/dist/common/core.d.ts +2 -0
  101. package/dist/common/core.js +24 -3
  102. package/dist/common/core.js.map +1 -1
  103. package/dist/common/diagnostic.d.ts +8 -0
  104. package/dist/common/diagnostic.js +5 -1
  105. package/dist/common/diagnostic.js.map +1 -1
  106. package/dist/common/diagnosticRules.d.ts +2 -1
  107. package/dist/common/diagnosticRules.js +1 -0
  108. package/dist/common/diagnosticRules.js.map +1 -1
  109. package/dist/common/fileSystem.d.ts +1 -0
  110. package/dist/common/fileSystem.js.map +1 -1
  111. package/dist/common/pathUtils.d.ts +1 -0
  112. package/dist/common/pathUtils.js +13 -3
  113. package/dist/common/pathUtils.js.map +1 -1
  114. package/dist/common/pythonVersion.d.ts +1 -1
  115. package/dist/common/pythonVersion.js +1 -1
  116. package/dist/common/realFileSystem.js +12 -3
  117. package/dist/common/realFileSystem.js.map +1 -1
  118. package/dist/common/workspaceEditUtils.d.ts +6 -1
  119. package/dist/common/workspaceEditUtils.js +72 -1
  120. package/dist/common/workspaceEditUtils.js.map +1 -1
  121. package/dist/languageServerBase.d.ts +7 -5
  122. package/dist/languageServerBase.js +30 -20
  123. package/dist/languageServerBase.js.map +1 -1
  124. package/dist/languageService/analyzerServiceExecutor.d.ts +6 -2
  125. package/dist/languageService/analyzerServiceExecutor.js +7 -4
  126. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  127. package/dist/languageService/autoImporter.js +2 -1
  128. package/dist/languageService/autoImporter.js.map +1 -1
  129. package/dist/languageService/codeActionProvider.js +30 -0
  130. package/dist/languageService/codeActionProvider.js.map +1 -1
  131. package/dist/languageService/completionProvider.d.ts +1 -0
  132. package/dist/languageService/completionProvider.js +66 -28
  133. package/dist/languageService/completionProvider.js.map +1 -1
  134. package/dist/languageService/definitionProvider.d.ts +2 -0
  135. package/dist/languageService/definitionProvider.js +3 -0
  136. package/dist/languageService/definitionProvider.js.map +1 -1
  137. package/dist/languageService/documentSymbolCollector.js +7 -3
  138. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  139. package/dist/languageService/documentSymbolProvider.js +1 -1
  140. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  141. package/dist/languageService/hoverProvider.d.ts +1 -1
  142. package/dist/languageService/hoverProvider.js +73 -38
  143. package/dist/languageService/hoverProvider.js.map +1 -1
  144. package/dist/languageService/referencesProvider.js +2 -1
  145. package/dist/languageService/referencesProvider.js.map +1 -1
  146. package/dist/languageService/signatureHelpProvider.js +1 -2
  147. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  148. package/dist/languageService/tooltipUtils.js +30 -19
  149. package/dist/languageService/tooltipUtils.js.map +1 -1
  150. package/dist/localization/localize.d.ts +29 -4
  151. package/dist/localization/localize.js +20 -5
  152. package/dist/localization/localize.js.map +1 -1
  153. package/dist/localization/package.nls.en-us.json +18 -3
  154. package/dist/parser/parseNodes.d.ts +2 -1
  155. package/dist/parser/parseNodes.js +6 -1
  156. package/dist/parser/parseNodes.js.map +1 -1
  157. package/dist/parser/parser.js +19 -13
  158. package/dist/parser/parser.js.map +1 -1
  159. package/dist/parser/tokenizer.js +2 -1
  160. package/dist/parser/tokenizer.js.map +1 -1
  161. package/dist/pyright.js +4 -4
  162. package/dist/pyright.js.map +1 -1
  163. package/dist/pyrightFileSystem.d.ts +1 -0
  164. package/dist/pyrightFileSystem.js +3 -0
  165. package/dist/pyrightFileSystem.js.map +1 -1
  166. package/dist/readonlyAugmentedFileSystem.d.ts +1 -0
  167. package/dist/readonlyAugmentedFileSystem.js +3 -0
  168. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  169. package/dist/server.d.ts +1 -1
  170. package/dist/server.js +1 -1
  171. package/dist/server.js.map +1 -1
  172. package/dist/tests/checker.test.js +25 -2
  173. package/dist/tests/checker.test.js.map +1 -1
  174. package/dist/tests/config.test.js +11 -0
  175. package/dist/tests/config.test.js.map +1 -1
  176. package/dist/tests/diagnostics.test.d.ts +1 -0
  177. package/dist/tests/diagnostics.test.js +37 -0
  178. package/dist/tests/diagnostics.test.js.map +1 -0
  179. package/dist/tests/docStringConversion.test.js +25 -0
  180. package/dist/tests/docStringConversion.test.js.map +1 -1
  181. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js +1 -1
  182. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  183. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js +5 -5
  184. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  185. package/dist/tests/fourslash/completions.classVariable.fourslash.js +28 -6
  186. package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
  187. package/dist/tests/fourslash/{signature.paramspec.fourslash.d.ts → completions.dunderNew.Inheritance.fourslash.d.ts} +0 -0
  188. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js +29 -0
  189. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -0
  190. package/dist/tests/fourslash/completions.dunderNew.fourslash.d.ts +1 -0
  191. package/dist/tests/fourslash/completions.dunderNew.fourslash.js +20 -0
  192. package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -0
  193. package/dist/tests/fourslash/completions.fourslash.js +2 -2
  194. package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
  195. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js +1 -1
  196. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
  197. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js +1 -1
  198. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
  199. package/dist/tests/fourslash/completions.libStub.fourslash.js +1 -1
  200. package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
  201. package/dist/tests/fourslash/completions.localCode.fourslash.js +2 -2
  202. package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
  203. package/dist/tests/fourslash/completions.plainText.fourslash.js +2 -2
  204. package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
  205. package/dist/tests/fourslash/completions.self.fourslash.js +2 -2
  206. package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
  207. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js +1 -1
  208. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
  209. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js +2 -2
  210. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  211. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.d.ts +1 -0
  212. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js +32 -0
  213. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -0
  214. package/dist/tests/fourslash/fourslash.d.ts +2 -1
  215. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +2 -2
  216. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  217. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js +4 -4
  218. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
  219. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js +1 -1
  220. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
  221. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js +1 -1
  222. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
  223. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js +1 -1
  224. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
  225. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js +1 -1
  226. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
  227. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js +1 -1
  228. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
  229. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +2 -2
  230. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
  231. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js +1 -1
  232. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
  233. package/dist/tests/fourslash/hover.docstring.alias.fourslash.d.ts +1 -0
  234. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js +24 -0
  235. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -0
  236. package/dist/tests/fourslash/hover.docstring.links.fourslash.js +1 -1
  237. package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
  238. package/dist/tests/fourslash/hover.docstring.split.fourslash.js +3 -3
  239. package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
  240. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.d.ts +1 -0
  241. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js +13 -0
  242. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -0
  243. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.d.ts +1 -0
  244. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js +15 -0
  245. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -0
  246. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.d.ts +1 -0
  247. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js +21 -0
  248. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -0
  249. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.d.ts +1 -0
  250. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js +17 -0
  251. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -0
  252. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.d.ts +1 -0
  253. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js +15 -0
  254. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -0
  255. package/dist/tests/fourslash/hover.fourslash.js +1 -1
  256. package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
  257. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +3 -3
  258. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  259. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js +2 -2
  260. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
  261. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +2 -2
  262. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  263. package/dist/tests/fourslash/hover.init.fourslash.js +1 -1
  264. package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
  265. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js +1 -1
  266. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
  267. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js +1 -1
  268. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
  269. package/dist/tests/fourslash/hover.libStub.fourslash.js +1 -1
  270. package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
  271. package/dist/tests/fourslash/hover.plainText.fourslash.js +1 -1
  272. package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
  273. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js +1 -1
  274. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
  275. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js +1 -1
  276. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
  277. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js +1 -1
  278. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
  279. package/dist/tests/fourslash/shadowedImports.fourslash.d.ts +1 -0
  280. package/dist/tests/fourslash/shadowedImports.fourslash.js +75 -0
  281. package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -0
  282. package/dist/tests/fourslash/signature.dunderNew.fourslash.d.ts +1 -0
  283. package/dist/tests/fourslash/signature.dunderNew.fourslash.js +24 -0
  284. package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -0
  285. package/dist/tests/harness/fourslash/runner.js +1 -1
  286. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  287. package/dist/tests/harness/fourslash/testLanguageService.d.ts +3 -1
  288. package/dist/tests/harness/fourslash/testLanguageService.js +4 -2
  289. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  290. package/dist/tests/harness/fourslash/testState.d.ts +7 -7
  291. package/dist/tests/harness/fourslash/testState.js +77 -161
  292. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  293. package/dist/tests/harness/fourslash/workspaceEditTestUtils.d.ts +16 -0
  294. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +159 -0
  295. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -0
  296. package/dist/tests/harness/vfs/filesystem.d.ts +1 -0
  297. package/dist/tests/harness/vfs/filesystem.js +3 -0
  298. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  299. package/dist/tests/ipythonMode.test.js +39 -0
  300. package/dist/tests/ipythonMode.test.js.map +1 -1
  301. package/dist/tests/logger.test.js +3 -1
  302. package/dist/tests/logger.test.js.map +1 -1
  303. package/dist/tests/pathUtils.test.js +7 -0
  304. package/dist/tests/pathUtils.test.js.map +1 -1
  305. package/dist/tests/sourceFile.test.js +34 -1
  306. package/dist/tests/sourceFile.test.js.map +1 -1
  307. package/dist/tests/sourceMapperUtils.test.js +39 -4
  308. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  309. package/dist/tests/tokenizer.test.js +6 -2
  310. package/dist/tests/tokenizer.test.js.map +1 -1
  311. package/dist/tests/typeEvaluator1.test.js +16 -6
  312. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  313. package/dist/tests/typeEvaluator2.test.js +15 -3
  314. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  315. package/dist/tests/typeEvaluator3.test.js +40 -10
  316. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  317. package/dist/tests/typeEvaluator4.test.js +11 -7
  318. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  319. package/dist/tests/typeEvaluator5.test.js +48 -0
  320. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  321. package/dist/tests/typePrinter.test.d.ts +1 -0
  322. package/dist/tests/typePrinter.test.js +148 -0
  323. package/dist/tests/typePrinter.test.js.map +1 -0
  324. package/dist/tests/workspaceEditUtils.test.d.ts +1 -0
  325. package/dist/tests/workspaceEditUtils.test.js +167 -0
  326. package/dist/tests/workspaceEditUtils.test.js.map +1 -0
  327. package/dist/workspaceMap.d.ts +2 -0
  328. package/dist/workspaceMap.js +45 -12
  329. package/dist/workspaceMap.js.map +1 -1
  330. package/package.json +3 -3
  331. package/dist/tests/fourslash/signature.paramspec.fourslash.js +0 -30
  332. package/dist/tests/fourslash/signature.paramspec.fourslash.js.map +0 -1
@@ -1,12 +1,4 @@
1
1
  "use strict";
2
- /*
3
- * testState.ts
4
- * Copyright (c) Microsoft Corporation.
5
- * Licensed under the MIT license.
6
- *
7
- * TestState wraps currently test states and provides a way to query and manipulate
8
- * the test states.
9
- */
10
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
3
  if (k2 === undefined) k2 = k;
12
4
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -30,9 +22,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
31
23
  };
32
24
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.createVfsInfoFromFourSlashData = exports.getNodeAtMarker = exports.getNodeForRange = exports.parseAndGetTestState = exports.TestState = void 0;
25
+ exports.getMarkerNames = exports.getMarkerByName = exports.getMarkerName = exports.createVfsInfoFromFourSlashData = exports.getNodeAtMarker = exports.getNodeForRange = exports.parseAndGetTestState = exports.TestState = void 0;
26
+ /*
27
+ * testState.ts
28
+ * Copyright (c) Microsoft Corporation.
29
+ * Licensed under the MIT license.
30
+ *
31
+ * TestState wraps currently test states and provides a way to query and manipulate
32
+ * the test states.
33
+ */
34
34
  const assert_1 = __importDefault(require("assert"));
35
35
  const JSONC = __importStar(require("jsonc-parser"));
36
+ const path = __importStar(require("path"));
36
37
  const vscode_languageserver_1 = require("vscode-languageserver");
37
38
  const parseTreeUtils_1 = require("../../../analyzer/parseTreeUtils");
38
39
  const service_1 = require("../../../analyzer/service");
@@ -60,6 +61,7 @@ const vfs = __importStar(require("../vfs/filesystem"));
60
61
  const fourSlashParser_1 = require("./fourSlashParser");
61
62
  const fourSlashTypes_1 = require("./fourSlashTypes");
62
63
  const testLanguageService_1 = require("./testLanguageService");
64
+ const workspaceEditTestUtils_1 = require("./workspaceEditTestUtils");
63
65
  const testAccessHost = new testAccessHost_1.TestAccessHost(vfs.MODULE_PATH, [factory_1.libFolder, factory_1.distlibFolder]);
64
66
  class TestState {
65
67
  constructor(projectRoot, testData, mountPaths, hostSpecificFeatures) {
@@ -84,7 +86,7 @@ class TestState {
84
86
  configOptions.initializeFromJson(this.rawConfigJson, 'basic', this.console, this.fs, testAccessHost);
85
87
  this._applyTestConfigOptions(configOptions);
86
88
  }
87
- const service = this._createAnalysisService(this.console, this._hostSpecificFeatures.importResolverFactory, configOptions);
89
+ const service = this._createAnalysisService(this.console, this._hostSpecificFeatures.importResolverFactory, this._hostSpecificFeatures.backgroundAnalysisProgramFactory, configOptions);
88
90
  this.workspace = {
89
91
  workspaceName: 'test workspace',
90
92
  rootPath: vfsInfo.projectRoot,
@@ -97,7 +99,6 @@ class TestState {
97
99
  disableWorkspaceSymbol: false,
98
100
  isInitialized: (0, deferred_1.createDeferred)(),
99
101
  searchPathsToWatch: [],
100
- owns: (f) => true,
101
102
  };
102
103
  const indexer = (0, core_1.toBoolean)(testData.globalOptions["indexer" /* indexer */]);
103
104
  const indexerWithoutStdLib = (0, core_1.toBoolean)(testData.globalOptions["indexerwithoutstdlib" /* indexerWithoutStdLib */]);
@@ -158,32 +159,17 @@ class TestState {
158
159
  return this.fs.getMappedFilePath(path);
159
160
  }
160
161
  getMarkerName(m) {
161
- let found;
162
- this.testData.markerPositions.forEach((marker, name) => {
163
- if (marker === m) {
164
- found = name;
165
- }
166
- });
167
- assert_1.default.ok(found);
168
- return found;
162
+ return getMarkerName(this.testData, m);
169
163
  }
170
164
  getMarkerByName(markerName) {
171
- const markerPos = this.testData.markerPositions.get(markerName);
172
- if (markerPos === undefined) {
173
- throw new Error(`Unknown marker "${markerName}" Available markers: ${this.getMarkerNames()
174
- .map((m) => '"' + m + '"')
175
- .join(', ')}`);
176
- }
177
- else {
178
- return markerPos;
179
- }
165
+ return getMarkerByName(this.testData, markerName);
180
166
  }
181
167
  getMarkers() {
182
168
  // Return a copy of the list
183
169
  return this.testData.markers.slice(0);
184
170
  }
185
171
  getMarkerNames() {
186
- return [...this.testData.markerPositions.keys()];
172
+ return getMarkerNames(this.testData);
187
173
  }
188
174
  getPositionRange(markerString) {
189
175
  const marker = this.getMarkerByName(markerString);
@@ -217,6 +203,9 @@ class TestState {
217
203
  getDirectoryPath(path) {
218
204
  return (0, pathUtils_1.getDirectoryPath)(path);
219
205
  }
206
+ getPathSep() {
207
+ return path.sep;
208
+ }
220
209
  goToPosition(positionOrLineAndColumn) {
221
210
  const pos = (0, core_1.isNumber)(positionOrLineAndColumn)
222
211
  ? positionOrLineAndColumn
@@ -380,7 +369,7 @@ class TestState {
380
369
  this._checkPostEditInvariants();
381
370
  }
382
371
  verifyDiagnostics(map) {
383
- this._analyze();
372
+ this.analyze();
384
373
  // organize things per file
385
374
  const resultPerFile = this._getDiagnosticsPerFile();
386
375
  const rangePerFile = this.createMultiMap(this.getRanges(), (r) => r.fileName);
@@ -415,8 +404,12 @@ class TestState {
415
404
  ? result.warnings
416
405
  : category === 'information'
417
406
  ? result.information
418
- : this.raiseError(`unexpected category ${category}`);
419
- if (expected.length !== actual.length) {
407
+ : category === 'unused'
408
+ ? result.unused
409
+ : category === 'none'
410
+ ? []
411
+ : this.raiseError(`unexpected category ${category}`);
412
+ if (expected.length !== actual.length && category !== 'none') {
420
413
  this.raiseError(`contains unexpected result - expected: ${(0, utils_1.stringify)(expected)}, actual: ${(0, utils_1.stringify)(actual)}`);
421
414
  }
422
415
  for (const range of expected) {
@@ -425,13 +418,19 @@ class TestState {
425
418
  const diagnosticSpan = textRange_1.TextRange.fromBounds((0, positionUtils_1.convertPositionToOffset)(d.range.start, lines), (0, positionUtils_1.convertPositionToOffset)(d.range.end, lines));
426
419
  return this._deepEqual(diagnosticSpan, rangeSpan);
427
420
  });
428
- if (matches.length === 0) {
421
+ // If the map is provided, it might say
422
+ // a marker should have none.
423
+ const name = map ? this.getMarkerName(range.marker) : '';
424
+ const message = map ? map[name].message : undefined;
425
+ const expectMatches = !!message;
426
+ if (expectMatches && matches.length === 0) {
429
427
  this.raiseError(`doesn't contain expected range: ${(0, utils_1.stringify)(range)}`);
430
428
  }
429
+ else if (!expectMatches && matches.length !== 0) {
430
+ this.raiseError(`${name} should not contain any matches`);
431
+ }
431
432
  // if map is provided, check message as well
432
- if (map) {
433
- const name = this.getMarkerName(range.marker);
434
- const message = map[name].message;
433
+ if (message) {
435
434
  if (matches.filter((d) => message === d.message).length !== 1) {
436
435
  this.raiseError(`message doesn't match: ${message} of ${name} - ${(0, utils_1.stringify)(range)}, actual: ${(0, utils_1.stringify)(matches)}`);
437
436
  }
@@ -454,7 +453,7 @@ class TestState {
454
453
  async verifyCodeActions(map, verifyCodeActionCount) {
455
454
  // make sure we don't use cache built from other tests
456
455
  this.workspace.serviceInstance.invalidateAndForceReanalysis();
457
- this._analyze();
456
+ this.analyze();
458
457
  for (const range of this.getRanges()) {
459
458
  const name = this.getMarkerName(range.marker);
460
459
  if (!map[name]) {
@@ -504,7 +503,7 @@ class TestState {
504
503
  }
505
504
  }
506
505
  async verifyCommand(command, files) {
507
- this._analyze();
506
+ this.analyze();
508
507
  const commandResult = await this._hostSpecificFeatures.execute(new testLanguageService_1.TestLanguageService(this.workspace, this.console, this.fs), { command: command.command, arguments: command.arguments || [] }, vscode_languageserver_1.CancellationToken.None);
509
508
  if (command.command === 'pyright.createtypestub') {
510
509
  await this._verifyFiles(files);
@@ -524,123 +523,11 @@ class TestState {
524
523
  return commandResult;
525
524
  }
526
525
  verifyWorkspaceEdit(expected, actual) {
527
- if (actual.changes) {
528
- this._verifyTextEditMap(expected.changes, actual.changes);
529
- }
530
- else {
531
- (0, assert_1.default)(!expected.changes);
532
- }
533
- if (actual.documentChanges) {
534
- this._verifyDocumentEdits(expected.documentChanges, actual.documentChanges);
535
- }
536
- else {
537
- (0, assert_1.default)(!expected.documentChanges);
538
- }
539
- if (actual.changeAnnotations) {
540
- this._verifyChangeAnnotations(expected.changeAnnotations, actual.changeAnnotations);
541
- }
542
- else {
543
- (0, assert_1.default)(!expected.changeAnnotations);
544
- }
545
- }
546
- _verifyChangeAnnotations(expected, actual) {
547
- assert_1.default.strictEqual(Object.entries(expected).length, Object.entries(actual).length);
548
- for (const key of Object.keys(expected)) {
549
- const expectedAnnotation = expected[key];
550
- const actualAnnotation = actual[key];
551
- // We need to improve it to test localized strings.
552
- assert_1.default.strictEqual(expectedAnnotation.label, actualAnnotation.label);
553
- assert_1.default.strictEqual(expectedAnnotation.description, actualAnnotation.description);
554
- assert_1.default.strictEqual(expectedAnnotation.needsConfirmation, actualAnnotation.needsConfirmation);
555
- }
556
- }
557
- _textDocumentAreSame(expected, actual) {
558
- return expected.version === actual.version && expected.uri === actual.uri;
559
- }
560
- _verifyDocumentEdits(expected, actual) {
561
- assert_1.default.strictEqual(expected.length, actual.length);
562
- for (const op of expected) {
563
- (0, assert_1.default)(actual.some((a) => {
564
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
565
- const expectedKind = vscode_languageserver_1.TextDocumentEdit.is(op) ? 'edit' : op.kind;
566
- const actualKind = vscode_languageserver_1.TextDocumentEdit.is(a) ? 'edit' : a.kind;
567
- if (expectedKind !== actualKind) {
568
- return false;
569
- }
570
- switch (expectedKind) {
571
- case 'edit': {
572
- const expectedEdit = op;
573
- const actualEdit = a;
574
- if (!this._textDocumentAreSame(expectedEdit.textDocument, actualEdit.textDocument)) {
575
- return false;
576
- }
577
- return this._textEditsAreSame(expectedEdit.edits, actualEdit.edits);
578
- }
579
- case 'create': {
580
- const expectedOp = op;
581
- const actualOp = a;
582
- return (expectedOp.kind === actualOp.kind &&
583
- expectedOp.annotationId === actualOp.annotationId &&
584
- expectedOp.uri === actualOp.uri &&
585
- ((_a = expectedOp.options) === null || _a === void 0 ? void 0 : _a.ignoreIfExists) === ((_b = actualOp.options) === null || _b === void 0 ? void 0 : _b.ignoreIfExists) &&
586
- ((_c = expectedOp.options) === null || _c === void 0 ? void 0 : _c.overwrite) === ((_d = actualOp.options) === null || _d === void 0 ? void 0 : _d.overwrite));
587
- }
588
- case 'rename': {
589
- const expectedOp = op;
590
- const actualOp = a;
591
- return (expectedOp.kind === actualOp.kind &&
592
- expectedOp.annotationId === actualOp.annotationId &&
593
- expectedOp.oldUri === actualOp.oldUri &&
594
- expectedOp.newUri === actualOp.newUri &&
595
- ((_e = expectedOp.options) === null || _e === void 0 ? void 0 : _e.ignoreIfExists) === ((_f = actualOp.options) === null || _f === void 0 ? void 0 : _f.ignoreIfExists) &&
596
- ((_g = expectedOp.options) === null || _g === void 0 ? void 0 : _g.overwrite) === ((_h = actualOp.options) === null || _h === void 0 ? void 0 : _h.overwrite));
597
- }
598
- case 'delete': {
599
- const expectedOp = op;
600
- const actualOp = a;
601
- return (expectedOp.annotationId === actualOp.annotationId &&
602
- expectedOp.kind === actualOp.kind &&
603
- expectedOp.uri === actualOp.uri &&
604
- ((_j = expectedOp.options) === null || _j === void 0 ? void 0 : _j.ignoreIfNotExists) === ((_k = actualOp.options) === null || _k === void 0 ? void 0 : _k.ignoreIfNotExists) &&
605
- ((_l = expectedOp.options) === null || _l === void 0 ? void 0 : _l.recursive) === ((_m = actualOp.options) === null || _m === void 0 ? void 0 : _m.recursive));
606
- }
607
- default:
608
- debug.assertNever(expectedKind);
609
- }
610
- }));
611
- }
612
- }
613
- _verifyTextEditMap(expected, actual) {
614
- assert_1.default.strictEqual(Object.entries(expected).length, Object.entries(actual).length);
615
- for (const key of Object.keys(expected)) {
616
- (0, assert_1.default)(this._textEditsAreSame(expected[key], actual[key]));
617
- }
618
- }
619
- _textEditsAreSame(expectedEdits, actualEdits) {
620
- if (expectedEdits.length !== actualEdits.length) {
621
- return false;
622
- }
623
- for (const edit of expectedEdits) {
624
- if (!actualEdits.some((a) => this._textEditAreSame(edit, a))) {
625
- return false;
626
- }
627
- }
628
- return true;
629
- }
630
- _textEditAreSame(expected, actual) {
631
- if (!(0, textRange_1.rangesAreEqual)(expected.range, actual.range)) {
632
- return false;
633
- }
634
- if (expected.newText !== actual.newText) {
635
- return false;
636
- }
637
- const expectedAnnotation = vscode_languageserver_1.AnnotatedTextEdit.is(expected) ? expected.annotationId : '';
638
- const actualAnnotation = vscode_languageserver_1.AnnotatedTextEdit.is(actual) ? actual.annotationId : '';
639
- return expectedAnnotation === actualAnnotation;
526
+ return (0, workspaceEditTestUtils_1.verifyWorkspaceEdit)(expected, actual);
640
527
  }
641
528
  async verifyInvokeCodeAction(map, verifyCodeActionCount) {
642
529
  var _a;
643
- this._analyze();
530
+ this.analyze();
644
531
  for (const range of this.getRanges()) {
645
532
  const name = this.getMarkerName(range.marker);
646
533
  if (!map[name]) {
@@ -733,7 +620,7 @@ class TestState {
733
620
  }
734
621
  async verifyCompletion(verifyMode, docFormat, map, abbrMap) {
735
622
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
736
- this._analyze();
623
+ this.analyze();
737
624
  for (const marker of this.getMarkers()) {
738
625
  const markerName = this.getMarkerName(marker);
739
626
  if (!map[markerName]) {
@@ -825,7 +712,7 @@ class TestState {
825
712
  }
826
713
  }
827
714
  verifySignature(docFormat, map) {
828
- this._analyze();
715
+ this.analyze();
829
716
  for (const marker of this.getMarkers()) {
830
717
  const fileName = marker.fileName;
831
718
  const name = this.getMarkerName(marker);
@@ -870,7 +757,7 @@ class TestState {
870
757
  }
871
758
  verifyFindAllReferences(map) {
872
759
  var _a;
873
- this._analyze();
760
+ this.analyze();
874
761
  for (const marker of this.getMarkers()) {
875
762
  const fileName = marker.fileName;
876
763
  const name = this.getMarkerName(marker);
@@ -902,7 +789,7 @@ class TestState {
902
789
  }
903
790
  verifyHighlightReferences(map) {
904
791
  var _a;
905
- this._analyze();
792
+ this.analyze();
906
793
  for (const name of Object.keys(map)) {
907
794
  const marker = this.getMarkerByName(name);
908
795
  const fileName = marker.fileName;
@@ -921,7 +808,7 @@ class TestState {
921
808
  }
922
809
  verifyFindDefinitions(map, filter = definitionProvider_1.DefinitionFilter.All) {
923
810
  var _a;
924
- this._analyze();
811
+ this.analyze();
925
812
  for (const marker of this.getMarkers()) {
926
813
  const fileName = marker.fileName;
927
814
  const name = this.getMarkerName(marker);
@@ -939,7 +826,7 @@ class TestState {
939
826
  }
940
827
  verifyFindTypeDefinitions(map) {
941
828
  var _a;
942
- this._analyze();
829
+ this.analyze();
943
830
  for (const marker of this.getMarkers()) {
944
831
  const fileName = marker.fileName;
945
832
  const name = this.getMarkerName(marker);
@@ -957,7 +844,7 @@ class TestState {
957
844
  }
958
845
  verifyRename(map) {
959
846
  var _a;
960
- this._analyze();
847
+ this.analyze();
961
848
  for (const marker of this.getMarkers()) {
962
849
  const fileName = marker.fileName;
963
850
  const name = this.getMarkerName(marker);
@@ -1222,7 +1109,7 @@ class TestState {
1222
1109
  // If inside the edit, return -1 to mark as invalid
1223
1110
  return position <= editStart ? position : position < editEnd ? -1 : position + length - +(editEnd - editStart);
1224
1111
  }
1225
- _analyze() {
1112
+ analyze() {
1226
1113
  while (this.program.analyze()) {
1227
1114
  // Continue to call analyze until it completes. Since we're not
1228
1115
  // specifying a timeout, it should complete the first time.
@@ -1240,6 +1127,7 @@ class TestState {
1240
1127
  errors: diagnostics.filter((diag) => diag.category === 0 /* Error */),
1241
1128
  warnings: diagnostics.filter((diag) => diag.category === 1 /* Warning */),
1242
1129
  information: diagnostics.filter((diag) => diag.category === 2 /* Information */),
1130
+ unused: diagnostics.filter((diag) => diag.category === 3 /* UnusedCode */),
1243
1131
  };
1244
1132
  return [filePath, value];
1245
1133
  }
@@ -1249,12 +1137,13 @@ class TestState {
1249
1137
  });
1250
1138
  return new Map(results);
1251
1139
  }
1252
- _createAnalysisService(nullConsole, importResolverFactory, configOptions) {
1140
+ _createAnalysisService(nullConsole, importResolverFactory, backgroundAnalysisProgramFactory, configOptions) {
1253
1141
  // we do not initiate automatic analysis or file watcher in test.
1254
1142
  const service = new service_1.AnalyzerService('test service', this.fs, {
1255
1143
  console: nullConsole,
1256
1144
  hostFactory: () => testAccessHost,
1257
1145
  importResolverFactory,
1146
+ backgroundAnalysisProgramFactory,
1258
1147
  configOptions,
1259
1148
  });
1260
1149
  // directly set files to track rather than using fileSpec from config
@@ -1411,6 +1300,33 @@ function createVfsInfoFromFourSlashData(projectRoot, testData) {
1411
1300
  return { files, sourceFileNames, projectRoot, ignoreCase, rawConfigJson };
1412
1301
  }
1413
1302
  exports.createVfsInfoFromFourSlashData = createVfsInfoFromFourSlashData;
1303
+ function getMarkerName(testData, markerToFind) {
1304
+ let found;
1305
+ testData.markerPositions.forEach((marker, name) => {
1306
+ if (marker === markerToFind) {
1307
+ found = name;
1308
+ }
1309
+ });
1310
+ assert_1.default.ok(found);
1311
+ return found;
1312
+ }
1313
+ exports.getMarkerName = getMarkerName;
1314
+ function getMarkerByName(testData, markerName) {
1315
+ const markerPos = testData.markerPositions.get(markerName);
1316
+ if (markerPos === undefined) {
1317
+ throw new Error(`Unknown marker "${markerName}" Available markers: ${getMarkerNames(testData)
1318
+ .map((m) => '"' + m + '"')
1319
+ .join(', ')}`);
1320
+ }
1321
+ else {
1322
+ return markerPos;
1323
+ }
1324
+ }
1325
+ exports.getMarkerByName = getMarkerByName;
1326
+ function getMarkerNames(testData) {
1327
+ return [...testData.markerPositions.keys()];
1328
+ }
1329
+ exports.getMarkerNames = getMarkerNames;
1414
1330
  function isConfig(file, ignoreCase) {
1415
1331
  const comparer = (0, stringUtils_1.getStringComparer)(ignoreCase);
1416
1332
  return service_1.configFileNames.some((f) => comparer((0, pathUtils_1.getBaseFileName)(file.fileName), f) === 0 /* EqualTo */);