@zzzen/pyright-internal 1.2.0-dev.20260809 → 1.2.0-dev.20260823

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 (365) hide show
  1. package/dist/analyzer/analyzerNodeInfo.d.ts +119 -24
  2. package/dist/analyzer/analyzerNodeInfo.js +408 -89
  3. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  4. package/dist/analyzer/binder.d.ts +6 -3
  5. package/dist/analyzer/binder.js +157 -70
  6. package/dist/analyzer/binder.js.map +1 -1
  7. package/dist/analyzer/checker.d.ts +5 -2
  8. package/dist/analyzer/checker.js +92 -34
  9. package/dist/analyzer/checker.js.map +1 -1
  10. package/dist/analyzer/codeFlowEngine.d.ts +2 -1
  11. package/dist/analyzer/codeFlowEngine.js +12 -10
  12. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  13. package/dist/analyzer/codeFlowUtils.d.ts +2 -1
  14. package/dist/analyzer/codeFlowUtils.js +2 -3
  15. package/dist/analyzer/codeFlowUtils.js.map +1 -1
  16. package/dist/analyzer/constraintSolver.js +47 -7
  17. package/dist/analyzer/constraintSolver.js.map +1 -1
  18. package/dist/analyzer/constructors.js +18 -8
  19. package/dist/analyzer/constructors.js.map +1 -1
  20. package/dist/analyzer/dataClasses.d.ts +6 -4
  21. package/dist/analyzer/dataClasses.js +119 -75
  22. package/dist/analyzer/dataClasses.js.map +1 -1
  23. package/dist/analyzer/declarationUtils.d.ts +2 -1
  24. package/dist/analyzer/declarationUtils.js +2 -2
  25. package/dist/analyzer/declarationUtils.js.map +1 -1
  26. package/dist/analyzer/decorators.d.ts +5 -4
  27. package/dist/analyzer/decorators.js +38 -21
  28. package/dist/analyzer/decorators.js.map +1 -1
  29. package/dist/analyzer/enums.d.ts +5 -4
  30. package/dist/analyzer/enums.js +11 -10
  31. package/dist/analyzer/enums.js.map +1 -1
  32. package/dist/analyzer/importResolver.d.ts +1 -1
  33. package/dist/analyzer/importResolver.js +5 -3
  34. package/dist/analyzer/importResolver.js.map +1 -1
  35. package/dist/analyzer/importStatementUtils.d.ts +3 -1
  36. package/dist/analyzer/importStatementUtils.js +14 -7
  37. package/dist/analyzer/importStatementUtils.js.map +1 -1
  38. package/dist/analyzer/namedTuples.d.ts +2 -1
  39. package/dist/analyzer/namedTuples.js +3 -4
  40. package/dist/analyzer/namedTuples.js.map +1 -1
  41. package/dist/analyzer/operations.d.ts +3 -2
  42. package/dist/analyzer/operations.js +8 -8
  43. package/dist/analyzer/operations.js.map +1 -1
  44. package/dist/analyzer/packageTypeVerifier.js +2 -2
  45. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  46. package/dist/analyzer/parseTreeUtils.d.ts +13 -11
  47. package/dist/analyzer/parseTreeUtils.js +62 -36
  48. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  49. package/dist/analyzer/parseTreeWalker.d.ts +7 -2
  50. package/dist/analyzer/parseTreeWalker.js +29 -175
  51. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  52. package/dist/analyzer/patternMatching.d.ts +4 -3
  53. package/dist/analyzer/patternMatching.js +47 -43
  54. package/dist/analyzer/patternMatching.js.map +1 -1
  55. package/dist/analyzer/program.d.ts +12 -0
  56. package/dist/analyzer/program.js +235 -29
  57. package/dist/analyzer/program.js.map +1 -1
  58. package/dist/analyzer/properties.d.ts +4 -3
  59. package/dist/analyzer/properties.js +7 -8
  60. package/dist/analyzer/properties.js.map +1 -1
  61. package/dist/analyzer/protocols.js +14 -2
  62. package/dist/analyzer/protocols.js.map +1 -1
  63. package/dist/analyzer/scope.d.ts +3 -0
  64. package/dist/analyzer/scope.js +10 -0
  65. package/dist/analyzer/scope.js.map +1 -1
  66. package/dist/analyzer/scopeUtils.d.ts +4 -3
  67. package/dist/analyzer/scopeUtils.js +8 -8
  68. package/dist/analyzer/scopeUtils.js.map +1 -1
  69. package/dist/analyzer/sentinel.d.ts +2 -1
  70. package/dist/analyzer/sentinel.js +2 -3
  71. package/dist/analyzer/sentinel.js.map +1 -1
  72. package/dist/analyzer/service.js +28 -10
  73. package/dist/analyzer/service.js.map +1 -1
  74. package/dist/analyzer/sourceEnumerator.d.ts +5 -0
  75. package/dist/analyzer/sourceEnumerator.js +57 -3
  76. package/dist/analyzer/sourceEnumerator.js.map +1 -1
  77. package/dist/analyzer/sourceFile.d.ts +12 -6
  78. package/dist/analyzer/sourceFile.js +73 -50
  79. package/dist/analyzer/sourceFile.js.map +1 -1
  80. package/dist/analyzer/sourceFileInfoUtils.d.ts +1 -0
  81. package/dist/analyzer/sourceFileInfoUtils.js +8 -0
  82. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  83. package/dist/analyzer/sourceMapper.d.ts +4 -1
  84. package/dist/analyzer/sourceMapper.js +14 -8
  85. package/dist/analyzer/sourceMapper.js.map +1 -1
  86. package/dist/analyzer/symbol.d.ts +4 -1
  87. package/dist/analyzer/symbol.js +8 -0
  88. package/dist/analyzer/symbol.js.map +1 -1
  89. package/dist/analyzer/testWalker.js +2 -1
  90. package/dist/analyzer/testWalker.js.map +1 -1
  91. package/dist/analyzer/tracePrinter.d.ts +2 -1
  92. package/dist/analyzer/tracePrinter.js +2 -2
  93. package/dist/analyzer/tracePrinter.js.map +1 -1
  94. package/dist/analyzer/tuples.d.ts +3 -2
  95. package/dist/analyzer/tuples.js +5 -5
  96. package/dist/analyzer/tuples.js.map +1 -1
  97. package/dist/analyzer/typeCacheUtils.d.ts +6 -2
  98. package/dist/analyzer/typeCacheUtils.js +16 -37
  99. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  100. package/dist/analyzer/typeDocStringUtils.d.ts +5 -7
  101. package/dist/analyzer/typeDocStringUtils.js +229 -132
  102. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  103. package/dist/analyzer/typeEvaluator.d.ts +2 -0
  104. package/dist/analyzer/typeEvaluator.js +1280 -302
  105. package/dist/analyzer/typeEvaluator.js.map +1 -1
  106. package/dist/analyzer/typeEvaluatorTypes.d.ts +2 -0
  107. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  108. package/dist/analyzer/typeGuards.d.ts +3 -2
  109. package/dist/analyzer/typeGuards.js +37 -33
  110. package/dist/analyzer/typeGuards.js.map +1 -1
  111. package/dist/analyzer/typeStubWriter.js +12 -9
  112. package/dist/analyzer/typeStubWriter.js.map +1 -1
  113. package/dist/analyzer/typeUtils.js +3 -1
  114. package/dist/analyzer/typeUtils.js.map +1 -1
  115. package/dist/analyzer/typedDicts.d.ts +4 -3
  116. package/dist/analyzer/typedDicts.js +15 -14
  117. package/dist/analyzer/typedDicts.js.map +1 -1
  118. package/dist/analyzer/types.d.ts +11 -1
  119. package/dist/analyzer/types.js +48 -0
  120. package/dist/analyzer/types.js.map +1 -1
  121. package/dist/commands/dumpFileDebugInfoCommand.js +1 -1
  122. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  123. package/dist/common/collectionUtils.js +15 -6
  124. package/dist/common/collectionUtils.js.map +1 -1
  125. package/dist/common/commandLineOptions.d.ts +1 -0
  126. package/dist/common/commandLineOptions.js.map +1 -1
  127. package/dist/common/configOptions.d.ts +4 -1
  128. package/dist/common/configOptions.js +68 -12
  129. package/dist/common/configOptions.js.map +1 -1
  130. package/dist/common/envVarUtils.d.ts +1 -0
  131. package/dist/common/envVarUtils.js +41 -10
  132. package/dist/common/envVarUtils.js.map +1 -1
  133. package/dist/common/extensibility.d.ts +3 -1
  134. package/dist/common/extensibility.js.map +1 -1
  135. package/dist/common/extraPathGlob.d.ts +12 -0
  136. package/dist/common/extraPathGlob.js +315 -0
  137. package/dist/common/extraPathGlob.js.map +1 -0
  138. package/dist/common/host.d.ts +2 -0
  139. package/dist/common/host.js.map +1 -1
  140. package/dist/common/languageServerInterface.d.ts +2 -1
  141. package/dist/common/languageServerInterface.js.map +1 -1
  142. package/dist/common/pathConsts.d.ts +1 -0
  143. package/dist/common/pathConsts.js +11 -1
  144. package/dist/common/pathConsts.js.map +1 -1
  145. package/dist/common/processUtils.d.ts +4 -2
  146. package/dist/common/processUtils.js +3 -0
  147. package/dist/common/processUtils.js.map +1 -1
  148. package/dist/common/stringUtils.d.ts +6 -0
  149. package/dist/common/stringUtils.js +87 -5
  150. package/dist/common/stringUtils.js.map +1 -1
  151. package/dist/common/textEditTracker.d.ts +3 -1
  152. package/dist/common/textEditTracker.js +8 -6
  153. package/dist/common/textEditTracker.js.map +1 -1
  154. package/dist/common/textRangeCollection.d.ts +1 -0
  155. package/dist/common/textRangeCollection.js +32 -1
  156. package/dist/common/textRangeCollection.js.map +1 -1
  157. package/dist/common/uri/uriUtils.d.ts +3 -0
  158. package/dist/common/uri/uriUtils.js +65 -15
  159. package/dist/common/uri/uriUtils.js.map +1 -1
  160. package/dist/fileSystemMapping.d.ts +10 -0
  161. package/dist/fileSystemMapping.js +176 -0
  162. package/dist/fileSystemMapping.js.map +1 -0
  163. package/dist/languageService/analyzerServiceExecutor.js +2 -1
  164. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  165. package/dist/languageService/autoImporter.d.ts +1 -0
  166. package/dist/languageService/autoImporter.js +32 -5
  167. package/dist/languageService/autoImporter.js.map +1 -1
  168. package/dist/languageService/callHierarchyProvider.d.ts +7 -0
  169. package/dist/languageService/callHierarchyProvider.js +97 -11
  170. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  171. package/dist/languageService/completionProvider.d.ts +30 -8
  172. package/dist/languageService/completionProvider.js +298 -93
  173. package/dist/languageService/completionProvider.js.map +1 -1
  174. package/dist/languageService/definitionProvider.js +7 -6
  175. package/dist/languageService/definitionProvider.js.map +1 -1
  176. package/dist/languageService/documentHighlightProvider.js +2 -1
  177. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  178. package/dist/languageService/documentSymbolCollector.d.ts +3 -1
  179. package/dist/languageService/documentSymbolCollector.js +78 -14
  180. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  181. package/dist/languageService/documentSymbolProvider.js +3 -2
  182. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  183. package/dist/languageService/fileWatcherDynamicFeature.js +28 -1
  184. package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -1
  185. package/dist/languageService/hoverProvider.d.ts +2 -1
  186. package/dist/languageService/hoverProvider.js +48 -16
  187. package/dist/languageService/hoverProvider.js.map +1 -1
  188. package/dist/languageService/importSorter.d.ts +3 -1
  189. package/dist/languageService/importSorter.js +4 -2
  190. package/dist/languageService/importSorter.js.map +1 -1
  191. package/dist/languageService/importStatementCandidates.js +4 -2
  192. package/dist/languageService/importStatementCandidates.js.map +1 -1
  193. package/dist/languageService/quickActions.js +2 -1
  194. package/dist/languageService/quickActions.js.map +1 -1
  195. package/dist/languageService/referencesProvider.js +12 -5
  196. package/dist/languageService/referencesProvider.js.map +1 -1
  197. package/dist/languageService/signatureHelpProvider.d.ts +3 -0
  198. package/dist/languageService/signatureHelpProvider.js +56 -18
  199. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  200. package/dist/languageService/symbolIndexer.d.ts +2 -1
  201. package/dist/languageService/symbolIndexer.js +7 -7
  202. package/dist/languageService/symbolIndexer.js.map +1 -1
  203. package/dist/languageService/tooltipUtils.d.ts +1 -1
  204. package/dist/languageService/tooltipUtils.js +103 -35
  205. package/dist/languageService/tooltipUtils.js.map +1 -1
  206. package/dist/languageService/workspaceSymbolProvider.js +3 -2
  207. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  208. package/dist/localization/localize.d.ts +12 -0
  209. package/dist/localization/localize.js +14 -0
  210. package/dist/localization/localize.js.map +1 -1
  211. package/dist/localization/package.nls.cs.json +11 -0
  212. package/dist/localization/package.nls.de.json +11 -0
  213. package/dist/localization/package.nls.en-us.json +18 -0
  214. package/dist/localization/package.nls.es.json +11 -0
  215. package/dist/localization/package.nls.fr.json +11 -0
  216. package/dist/localization/package.nls.it.json +11 -0
  217. package/dist/localization/package.nls.ja.json +11 -0
  218. package/dist/localization/package.nls.ko.json +11 -0
  219. package/dist/localization/package.nls.pl.json +11 -0
  220. package/dist/localization/package.nls.pt-br.json +11 -0
  221. package/dist/localization/package.nls.qps-ploc.json +11 -0
  222. package/dist/localization/package.nls.ru.json +11 -0
  223. package/dist/localization/package.nls.tr.json +11 -0
  224. package/dist/localization/package.nls.zh-cn.json +12 -1
  225. package/dist/localization/package.nls.zh-tw.json +13 -2
  226. package/dist/parser/parseNodes.d.ts +85 -80
  227. package/dist/parser/parseNodes.js +182 -159
  228. package/dist/parser/parseNodes.js.map +1 -1
  229. package/dist/parser/parseTreeUtils.d.ts +3 -0
  230. package/dist/parser/parseTreeUtils.js +209 -0
  231. package/dist/parser/parseTreeUtils.js.map +1 -0
  232. package/dist/parser/parser.d.ts +16 -6
  233. package/dist/parser/parser.js +210 -144
  234. package/dist/parser/parser.js.map +1 -1
  235. package/dist/parser/stringAnnotationInfo.d.ts +16 -0
  236. package/dist/parser/stringAnnotationInfo.js +26 -0
  237. package/dist/parser/stringAnnotationInfo.js.map +1 -0
  238. package/dist/readonlyAugmentedFileSystem.d.ts +2 -9
  239. package/dist/readonlyAugmentedFileSystem.js +17 -144
  240. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  241. package/dist/server.js +2 -2
  242. package/dist/server.js.map +1 -1
  243. package/dist/tests/analyzerNodeInfo.test.d.ts +1 -0
  244. package/dist/tests/analyzerNodeInfo.test.js +113 -0
  245. package/dist/tests/analyzerNodeInfo.test.js.map +1 -0
  246. package/dist/tests/collectionUtils.test.js +46 -0
  247. package/dist/tests/collectionUtils.test.js.map +1 -1
  248. package/dist/tests/completions.test.js +34 -0
  249. package/dist/tests/completions.test.js.map +1 -1
  250. package/dist/tests/config.test.js +131 -6
  251. package/dist/tests/config.test.js.map +1 -1
  252. package/dist/tests/extraPathGlob.test.d.ts +1 -0
  253. package/dist/tests/extraPathGlob.test.js +434 -0
  254. package/dist/tests/extraPathGlob.test.js.map +1 -0
  255. package/dist/tests/fileSystemMapping.test.d.ts +1 -0
  256. package/dist/tests/fileSystemMapping.test.js +458 -0
  257. package/dist/tests/fileSystemMapping.test.js.map +1 -0
  258. package/dist/tests/fourslash/completions.call.typedDict.fourslash.js +23 -0
  259. package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
  260. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js +14 -0
  261. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
  262. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js +7 -0
  263. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
  264. package/dist/tests/fourslash/completions.callSite.isinstanceNarrowing.fourslash.d.ts +1 -0
  265. package/dist/tests/fourslash/completions.callSite.isinstanceNarrowing.fourslash.js +41 -0
  266. package/dist/tests/fourslash/completions.callSite.isinstanceNarrowing.fourslash.js.map +1 -0
  267. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js +2 -0
  268. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
  269. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js +5 -0
  270. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
  271. package/dist/tests/fourslash/completions.stringLiteral.fourslash.js +4 -0
  272. package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
  273. package/dist/tests/fourslash/findallreferences.protocolMemberVariable.fourslash.d.ts +1 -0
  274. package/dist/tests/fourslash/findallreferences.protocolMemberVariable.fourslash.js +48 -0
  275. package/dist/tests/fourslash/findallreferences.protocolMemberVariable.fourslash.js.map +1 -0
  276. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +8 -2
  277. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  278. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +5 -2
  279. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  280. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js +2 -2
  281. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
  282. package/dist/tests/harness/fourslash/testState.js +1 -1
  283. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  284. package/dist/tests/hoverProvider.test.js +38 -0
  285. package/dist/tests/hoverProvider.test.js.map +1 -1
  286. package/dist/tests/importStatementUtils.test.js +6 -3
  287. package/dist/tests/importStatementUtils.test.js.map +1 -1
  288. package/dist/tests/ipythonMode.test.js +38 -0
  289. package/dist/tests/ipythonMode.test.js.map +1 -1
  290. package/dist/tests/parseTreeUtils.test.js +88 -0
  291. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  292. package/dist/tests/parser.test.js +60 -3
  293. package/dist/tests/parser.test.js.map +1 -1
  294. package/dist/tests/positionUtils.test.js +23 -0
  295. package/dist/tests/positionUtils.test.js.map +1 -1
  296. package/dist/tests/pyrightFileSystem.test.js +41 -0
  297. package/dist/tests/pyrightFileSystem.test.js.map +1 -1
  298. package/dist/tests/service.test.js +77 -0
  299. package/dist/tests/service.test.js.map +1 -1
  300. package/dist/tests/sourceEnumeratorSymlink.test.d.ts +1 -0
  301. package/dist/tests/sourceEnumeratorSymlink.test.js +203 -0
  302. package/dist/tests/sourceEnumeratorSymlink.test.js.map +1 -0
  303. package/dist/tests/stringUtils.test.js +84 -0
  304. package/dist/tests/stringUtils.test.js.map +1 -1
  305. package/dist/tests/symlinkAliasInvalidation.test.d.ts +1 -0
  306. package/dist/tests/symlinkAliasInvalidation.test.js +471 -0
  307. package/dist/tests/symlinkAliasInvalidation.test.js.map +1 -0
  308. package/dist/tests/testUtils.d.ts +2 -0
  309. package/dist/tests/testUtils.js +7 -1
  310. package/dist/tests/testUtils.js.map +1 -1
  311. package/dist/tests/textEditUtil.test.js +2 -2
  312. package/dist/tests/textEditUtil.test.js.map +1 -1
  313. package/dist/tests/textRangeCollection.test.d.ts +1 -0
  314. package/dist/tests/textRangeCollection.test.js +137 -0
  315. package/dist/tests/textRangeCollection.test.js.map +1 -0
  316. package/dist/tests/typeCacheUtils.test.d.ts +1 -0
  317. package/dist/tests/typeCacheUtils.test.js +69 -0
  318. package/dist/tests/typeCacheUtils.test.js.map +1 -0
  319. package/dist/tests/typeEvaluator1.test.js +24 -3
  320. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  321. package/dist/tests/typeEvaluator3.test.js +8 -0
  322. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  323. package/dist/tests/typeEvaluator4.test.js +4 -0
  324. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  325. package/dist/tests/typeEvaluator5.test.js +12 -0
  326. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  327. package/dist/tests/typeEvaluator6.test.js +33 -1
  328. package/dist/tests/typeEvaluator6.test.js.map +1 -1
  329. package/dist/tests/typeEvaluator7.test.js +29 -0
  330. package/dist/tests/typeEvaluator7.test.js.map +1 -1
  331. package/dist/tests/typeEvaluator8.test.js +318 -4
  332. package/dist/tests/typeEvaluator8.test.js.map +1 -1
  333. package/dist/tests/typeServer/typeCache.test.d.ts +1 -0
  334. package/dist/tests/typeServer/typeCache.test.js +69 -0
  335. package/dist/tests/typeServer/typeCache.test.js.map +1 -0
  336. package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js +18 -0
  337. package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js.map +1 -1
  338. package/dist/tests/types.test.d.ts +1 -0
  339. package/dist/{analyzer/parseTreeCleaner.js → tests/types.test.js} +23 -25
  340. package/dist/tests/types.test.js.map +1 -0
  341. package/dist/tests/uri.test.js +51 -0
  342. package/dist/tests/uri.test.js.map +1 -1
  343. package/dist/typeServer/notebookDocumentHandler.d.ts +9 -2
  344. package/dist/typeServer/notebookDocumentHandler.js +16 -6
  345. package/dist/typeServer/notebookDocumentHandler.js.map +1 -1
  346. package/dist/typeServer/programWrapper.d.ts +1 -0
  347. package/dist/typeServer/programWrapper.js +28 -15
  348. package/dist/typeServer/programWrapper.js.map +1 -1
  349. package/dist/typeServer/protocol/tspSupplemental.d.ts +1 -1
  350. package/dist/typeServer/protocol/tspSupplemental.js +2 -2
  351. package/dist/typeServer/server.d.ts +13 -2
  352. package/dist/typeServer/server.js +36 -23
  353. package/dist/typeServer/server.js.map +1 -1
  354. package/dist/typeServer/typeCache.d.ts +8 -4
  355. package/dist/typeServer/typeCache.js +33 -5
  356. package/dist/typeServer/typeCache.js.map +1 -1
  357. package/dist/typeServer/typeEvalUtils.d.ts +2 -1
  358. package/dist/typeServer/typeEvalUtils.js +7 -3
  359. package/dist/typeServer/typeEvalUtils.js.map +1 -1
  360. package/dist/typeServer/typeServerFileSystem.d.ts +10 -9
  361. package/dist/typeServer/typeServerFileSystem.js +16 -12
  362. package/dist/typeServer/typeServerFileSystem.js.map +1 -1
  363. package/package.json +7 -5
  364. package/dist/analyzer/parseTreeCleaner.d.ts +0 -8
  365. package/dist/analyzer/parseTreeCleaner.js.map +0 -1
@@ -58,7 +58,6 @@ const positionUtils_1 = require("../common/positionUtils");
58
58
  const textRange_1 = require("../common/textRange");
59
59
  const uri_1 = require("../common/uri/uri");
60
60
  const localize_1 = require("../localization/localize");
61
- const AnalyzerNodeInfo = __importStar(require("./analyzerNodeInfo"));
62
61
  const codeFlowTypes_1 = require("./codeFlowTypes");
63
62
  const declaration_1 = require("./declaration");
64
63
  const importStatementUtils_1 = require("./importStatementUtils");
@@ -68,13 +67,70 @@ const scope_1 = require("./scope");
68
67
  const StaticExpressions = __importStar(require("./staticExpressions"));
69
68
  const symbol_1 = require("./symbol");
70
69
  const symbolNameUtils_1 = require("./symbolNameUtils");
70
+ function isStaticClassAssignmentTarget(target) {
71
+ switch (target.nodeType) {
72
+ case 38 /* ParseNodeType.Name */:
73
+ return true;
74
+ case 54 /* ParseNodeType.TypeAnnotation */:
75
+ return isStaticClassAssignmentTarget(target.d.valueExpr);
76
+ case 52 /* ParseNodeType.Tuple */:
77
+ case 34 /* ParseNodeType.List */:
78
+ return target.d.items.every((item) => isStaticClassAssignmentTarget(item));
79
+ case 56 /* ParseNodeType.Unpack */:
80
+ return isStaticClassAssignmentTarget(target.d.expr);
81
+ default:
82
+ return false;
83
+ }
84
+ }
85
+ function getCalledBuiltInName(scope, expression, visitedSymbols = new Set()) {
86
+ if (expression.nodeType === 38 /* ParseNodeType.Name */) {
87
+ const symbolWithScope = scope.lookUpSymbolRecursive(expression.d.value);
88
+ if (!symbolWithScope || visitedSymbols.has(symbolWithScope.symbol)) {
89
+ return undefined;
90
+ }
91
+ visitedSymbols.add(symbolWithScope.symbol);
92
+ if (symbolWithScope.scope.type === 5 /* ScopeType.Builtin */) {
93
+ return expression.d.value;
94
+ }
95
+ const declarations = symbolWithScope.symbol.getDeclarations();
96
+ const declaration = declarations[declarations.length - 1];
97
+ if (declaration?.type === 1 /* DeclarationType.Variable */ &&
98
+ (declaration.inferredTypeSource?.nodeType === 38 /* ParseNodeType.Name */ ||
99
+ declaration.inferredTypeSource?.nodeType === 35 /* ParseNodeType.MemberAccess */)) {
100
+ return getCalledBuiltInName(scope, declaration.inferredTypeSource, visitedSymbols);
101
+ }
102
+ if (declaration?.type === 8 /* DeclarationType.Alias */ &&
103
+ declaration.moduleName === 'builtins' &&
104
+ declaration.symbolName) {
105
+ return declaration.symbolName;
106
+ }
107
+ }
108
+ else if (expression.nodeType === 35 /* ParseNodeType.MemberAccess */ &&
109
+ expression.d.leftExpr.nodeType === 38 /* ParseNodeType.Name */) {
110
+ const symbolWithScope = scope.lookUpSymbolRecursive(expression.d.leftExpr.d.value);
111
+ const declarations = symbolWithScope?.symbol.getDeclarations() ?? [];
112
+ const declaration = declarations[declarations.length - 1];
113
+ if (declaration?.type === 8 /* DeclarationType.Alias */ &&
114
+ declaration.moduleName === 'builtins' &&
115
+ !declaration.symbolName) {
116
+ return expression.d.member.d.value;
117
+ }
118
+ }
119
+ return undefined;
120
+ }
121
+ function doesCallExposeClassNamespace(scope, node) {
122
+ const builtInName = getCalledBuiltInName(scope, node.d.leftExpr);
123
+ return (builtInName === 'exec' ||
124
+ (builtInName === 'eval' && node.d.args.length === 1) ||
125
+ ((builtInName === 'locals' || builtInName === 'vars') && node.d.args.length === 0));
126
+ }
71
127
  // For each flow node within an execution context, we'll add a small
72
128
  // amount to the complexity factor. Without this, the complexity
73
129
  // calculation fails to take into account large numbers of non-cyclical
74
130
  // flow nodes. This number is somewhat arbitrary and is tuned empirically.
75
131
  const flowNodeComplexityContribution = 0.025;
76
132
  class Binder extends parseTreeWalker_1.ParseTreeWalker {
77
- constructor(fileInfo, _moduleSymbolOnly = false, _cellChainIndex) {
133
+ constructor(fileInfo, _moduleSymbolOnly, _cellChainIndex, nodeInfo) {
78
134
  super();
79
135
  this._moduleSymbolOnly = _moduleSymbolOnly;
80
136
  this._cellChainIndex = _cellChainIndex;
@@ -119,6 +175,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
119
175
  // the current function.
120
176
  this._codeFlowComplexity = 0;
121
177
  this._fileInfo = fileInfo;
178
+ this._nodeInfo = nodeInfo;
122
179
  }
123
180
  bindModule(node) {
124
181
  // We'll assume that if there is no builtins scope provided, we must be
@@ -128,8 +185,8 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
128
185
  this._addTypingImportAliasesFromBuiltinsScope();
129
186
  this._createNewScope(isBuiltInModule ? 5 /* ScopeType.Builtin */ : 4 /* ScopeType.Module */, this._fileInfo.builtinsScope,
130
187
  /* proxyScope */ undefined, chainedModuleLevelScopeLookup, () => {
131
- AnalyzerNodeInfo.setScope(node, this._currentScope);
132
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
188
+ this._nodeInfo.setScope(node, this._currentScope);
189
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
133
190
  // Bind implicit names.
134
191
  // List taken from https://docs.python.org/3/reference/import.html#__name__
135
192
  this._addImplicitSymbolToCurrentScope('__name__', node, 'str');
@@ -147,9 +204,9 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
147
204
  this._currentFlowNode = this._createStartFlowNode();
148
205
  this._walkStatementsAndReportUnreachable(node.d.statements);
149
206
  // Associate the code flow node at the end of the module with the module.
150
- AnalyzerNodeInfo.setAfterFlowNode(node, this._currentFlowNode);
151
- AnalyzerNodeInfo.setCodeFlowExpressions(node, this._currentScopeCodeFlowExpressions);
152
- AnalyzerNodeInfo.setCodeFlowComplexity(node, this._codeFlowComplexity);
207
+ this._nodeInfo.setAfterFlowNode(node, this._currentFlowNode);
208
+ this._nodeInfo.setCodeFlowExpressions(node, this._currentScopeCodeFlowExpressions);
209
+ this._nodeInfo.setCodeFlowComplexity(node, this._codeFlowComplexity);
153
210
  });
154
211
  // Perform all analysis that was deferred during the first pass.
155
212
  this._bindDeferred();
@@ -191,17 +248,17 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
191
248
  }
192
249
  });
193
250
  if (this._dunderAllNames) {
194
- AnalyzerNodeInfo.setDunderAllInfo(node, {
251
+ this._nodeInfo.setDunderAllInfo(node, {
195
252
  names: this._dunderAllNames,
196
253
  stringNodes: this._dunderAllStringNodes,
197
254
  usesUnsupportedDunderAllForm: this._usesUnsupportedDunderAllForm,
198
255
  });
199
256
  }
200
257
  else {
201
- AnalyzerNodeInfo.setDunderAllInfo(node, /* names */ undefined);
258
+ this._nodeInfo.setDunderAllInfo(node, /* names */ undefined);
202
259
  }
203
260
  // Set __all__ flags on the module symbols.
204
- const scope = AnalyzerNodeInfo.getScope(node);
261
+ const scope = this._nodeInfo.getScope(node);
205
262
  if (scope && this._dunderAllNames) {
206
263
  for (const name of this._dunderAllNames) {
207
264
  scope.symbolTable.get(name)?.setIsInDunderAll();
@@ -219,7 +276,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
219
276
  return false;
220
277
  }
221
278
  visitModuleName(node) {
222
- const importResult = AnalyzerNodeInfo.getImportInfo(node);
279
+ const importResult = this._nodeInfo.getImportInfo(node);
223
280
  (0, debug_1.assert)(importResult !== undefined);
224
281
  if (importResult.isNativeLib) {
225
282
  return true;
@@ -278,17 +335,17 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
278
335
  symbol.addDeclaration(classDeclaration);
279
336
  }
280
337
  // Stash the declaration in the parse node for later access.
281
- AnalyzerNodeInfo.setDeclaration(node, classDeclaration);
338
+ this._nodeInfo.setDeclaration(node, classDeclaration);
282
339
  let typeParamScope;
283
340
  if (node.d.typeParams) {
284
341
  this.walk(node.d.typeParams);
285
- typeParamScope = AnalyzerNodeInfo.getScope(node.d.typeParams);
342
+ typeParamScope = this._nodeInfo.getScope(node.d.typeParams);
286
343
  }
287
344
  this.walkMultiple(node.d.arguments);
288
345
  this._createNewScope(3 /* ScopeType.Class */, typeParamScope ?? this._getNonClassParentScope(),
289
346
  /* proxyScope */ undefined,
290
347
  /* chainedModuleLevelScopeLookup */ undefined, () => {
291
- AnalyzerNodeInfo.setScope(node, this._currentScope);
348
+ this._nodeInfo.setScope(node, this._currentScope);
292
349
  this._addImplicitSymbolToCurrentScope('__doc__', node, 'str | None');
293
350
  this._addImplicitSymbolToCurrentScope('__module__', node, 'str');
294
351
  this._dunderSlotsEntries = undefined;
@@ -330,7 +387,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
330
387
  }
331
388
  visitFunction(node) {
332
389
  this._createVariableAnnotationFlowNode();
333
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
390
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
334
391
  const symbol = this._bindNameToScope(this._currentScope, node.d.name);
335
392
  const containingClassNode = ParseTreeUtils.getEnclosingClass(node, /* stopAtFunction */ true);
336
393
  const functionDeclaration = {
@@ -347,7 +404,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
347
404
  symbol.addDeclaration(functionDeclaration);
348
405
  }
349
406
  // Stash the declaration in the parse node for later access.
350
- AnalyzerNodeInfo.setDeclaration(node, functionDeclaration);
407
+ this._nodeInfo.setDeclaration(node, functionDeclaration);
351
408
  // Walk the default values prior to the type parameters.
352
409
  node.d.params.forEach((param) => {
353
410
  if (param.d.defaultValue) {
@@ -357,7 +414,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
357
414
  let typeParamScope;
358
415
  if (node.d.typeParams) {
359
416
  this.walk(node.d.typeParams);
360
- typeParamScope = AnalyzerNodeInfo.getScope(node.d.typeParams);
417
+ typeParamScope = this._nodeInfo.getScope(node.d.typeParams);
361
418
  }
362
419
  this.walkMultiple(node.d.decorators);
363
420
  node.d.params.forEach((param) => {
@@ -379,7 +436,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
379
436
  this._createNewScope(2 /* ScopeType.Function */, typeParamScope ?? this._getNonClassParentScope(),
380
437
  /* proxyScope */ undefined,
381
438
  /* chainedModuleLevelScopeLookup */ undefined, () => {
382
- AnalyzerNodeInfo.setScope(node, this._currentScope);
439
+ this._nodeInfo.setScope(node, this._currentScope);
383
440
  const enclosingClass = ParseTreeUtils.getEnclosingClass(node);
384
441
  if (enclosingClass) {
385
442
  // Add the implicit "__class__" symbol described in PEP 3135.
@@ -402,7 +459,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
402
459
  isInExceptSuite: this._isInExceptSuite,
403
460
  };
404
461
  symbol.addDeclaration(paramDeclaration);
405
- AnalyzerNodeInfo.setDeclaration(paramNode.d.name, paramDeclaration);
462
+ this._nodeInfo.setDeclaration(paramNode.d.name, paramDeclaration);
406
463
  }
407
464
  this._createFlowAssignment(paramNode.d.name);
408
465
  }
@@ -414,15 +471,15 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
414
471
  this._targetFunctionDeclaration = undefined;
415
472
  // Associate the code flow node at the end of the suite with
416
473
  // the suite.
417
- AnalyzerNodeInfo.setAfterFlowNode(node.d.suite, this._currentFlowNode);
474
+ this._nodeInfo.setAfterFlowNode(node.d.suite, this._currentFlowNode);
418
475
  // Compute the final return flow node and associate it with
419
476
  // the function's parse node. If this node is unreachable, then
420
477
  // the function never returns.
421
478
  this._addAntecedent(this._currentReturnTarget, this._currentFlowNode);
422
479
  const returnFlowNode = this._finishFlowLabel(this._currentReturnTarget);
423
- AnalyzerNodeInfo.setAfterFlowNode(node, returnFlowNode);
424
- AnalyzerNodeInfo.setCodeFlowExpressions(node, this._currentScopeCodeFlowExpressions);
425
- AnalyzerNodeInfo.setCodeFlowComplexity(node, this._codeFlowComplexity);
480
+ this._nodeInfo.setAfterFlowNode(node, returnFlowNode);
481
+ this._nodeInfo.setCodeFlowExpressions(node, this._currentScopeCodeFlowExpressions);
482
+ this._nodeInfo.setCodeFlowComplexity(node, this._codeFlowComplexity);
426
483
  });
427
484
  });
428
485
  this._createAssignmentTargetFlowNodes(node.d.name, /* walkTargets */ false, /* unbound */ false);
@@ -431,7 +488,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
431
488
  }
432
489
  visitLambda(node) {
433
490
  this._createVariableAnnotationFlowNode();
434
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
491
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
435
492
  // Analyze the parameter defaults in the context of the parent's scope
436
493
  // before we add any names from the function's scope.
437
494
  node.d.params.forEach((param) => {
@@ -442,7 +499,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
442
499
  this._createNewScope(2 /* ScopeType.Function */, this._getNonClassParentScope(),
443
500
  /* proxyScope */ undefined,
444
501
  /* chainedModuleLevelScopeLookup */ undefined, () => {
445
- AnalyzerNodeInfo.setScope(node, this._currentScope);
502
+ this._nodeInfo.setScope(node, this._currentScope);
446
503
  const enclosingClass = ParseTreeUtils.getEnclosingClass(node);
447
504
  if (enclosingClass) {
448
505
  // Lambdas create the same implicit __class__ closure as named functions.
@@ -464,28 +521,31 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
464
521
  isInExceptSuite: this._isInExceptSuite,
465
522
  };
466
523
  symbol.addDeclaration(paramDeclaration);
467
- AnalyzerNodeInfo.setDeclaration(paramNode.d.name, paramDeclaration);
524
+ this._nodeInfo.setDeclaration(paramNode.d.name, paramDeclaration);
468
525
  }
469
526
  this._createFlowAssignment(paramNode.d.name);
470
527
  this.walk(paramNode.d.name);
471
- AnalyzerNodeInfo.setFlowNode(paramNode, this._currentFlowNode);
528
+ this._nodeInfo.setFlowNode(paramNode, this._currentFlowNode);
472
529
  }
473
530
  });
474
531
  // Walk the expression that make up the lambda body.
475
532
  this.walk(node.d.expr);
476
- AnalyzerNodeInfo.setCodeFlowExpressions(node, this._currentScopeCodeFlowExpressions);
533
+ this._nodeInfo.setCodeFlowExpressions(node, this._currentScopeCodeFlowExpressions);
477
534
  });
478
535
  });
479
536
  // We'll walk the child nodes in a deferred manner.
480
537
  return false;
481
538
  }
482
539
  visitCall(node) {
540
+ if (this._currentScope.type === 3 /* ScopeType.Class */ && doesCallExposeClassNamespace(this._currentScope, node)) {
541
+ this._currentScope.hasPotentiallyDynamicSymbolTable = true;
542
+ }
483
543
  this._disableTrueFalseTargets(() => {
484
544
  this.walk(node.d.leftExpr);
485
545
  const sortedArgs = ParseTreeUtils.getArgsByRuntimeOrder(node);
486
546
  sortedArgs.forEach((argNode) => {
487
547
  if (this._currentFlowNode) {
488
- AnalyzerNodeInfo.setFlowNode(argNode, this._currentFlowNode);
548
+ this._nodeInfo.setFlowNode(argNode, this._currentFlowNode);
489
549
  }
490
550
  this.walk(argNode);
491
551
  });
@@ -590,7 +650,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
590
650
  isInExceptSuite: this._isInExceptSuite,
591
651
  };
592
652
  symbol.addDeclaration(paramDeclaration);
593
- AnalyzerNodeInfo.setDeclaration(name, paramDeclaration);
653
+ this._nodeInfo.setDeclaration(name, paramDeclaration);
594
654
  if (typeParamsSeen.has(name.d.value)) {
595
655
  this._addSyntaxError(localize_1.LocMessage.typeParameterExistingTypeParameter().format({ name: name.d.value }), name);
596
656
  }
@@ -603,7 +663,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
603
663
  this.walk(param.d.defaultExpr);
604
664
  }
605
665
  });
606
- AnalyzerNodeInfo.setScope(node, typeParamScope);
666
+ this._nodeInfo.setScope(node, typeParamScope);
607
667
  return false;
608
668
  }
609
669
  visitTypeAlias(node) {
@@ -612,7 +672,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
612
672
  let typeParamScope;
613
673
  if (node.d.typeParams) {
614
674
  this.walk(node.d.typeParams);
615
- typeParamScope = AnalyzerNodeInfo.getScope(node.d.typeParams);
675
+ typeParamScope = this._nodeInfo.getScope(node.d.typeParams);
616
676
  }
617
677
  const typeAliasDeclaration = {
618
678
  type: 4 /* DeclarationType.TypeAlias */,
@@ -628,7 +688,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
628
688
  symbol.addDeclaration(typeAliasDeclaration);
629
689
  }
630
690
  // Stash the declaration in the parse node for later access.
631
- AnalyzerNodeInfo.setDeclaration(node, typeAliasDeclaration);
691
+ this._nodeInfo.setDeclaration(node, typeAliasDeclaration);
632
692
  this._createAssignmentTargetFlowNodes(node.d.name, /* walkTargets */ true, /* unbound */ false);
633
693
  const prevScope = this._currentScope;
634
694
  this._currentScope = typeParamScope ?? this._currentScope;
@@ -766,9 +826,23 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
766
826
  }
767
827
  });
768
828
  }
829
+ else if (expr.nodeType === 18 /* ParseNodeType.Dictionary */) {
830
+ expr.d.items.forEach((dictionaryEntryNode) => {
831
+ if (dictionaryEntryNode.nodeType === 20 /* ParseNodeType.DictionaryKeyEntry */ &&
832
+ dictionaryEntryNode.d.keyExpr.nodeType === 48 /* ParseNodeType.StringList */ &&
833
+ dictionaryEntryNode.d.keyExpr.d.strings.length === 1 &&
834
+ dictionaryEntryNode.d.keyExpr.d.strings[0].nodeType === 49 /* ParseNodeType.String */) {
835
+ this._dunderSlotsEntries.push(dictionaryEntryNode.d.keyExpr);
836
+ }
837
+ else {
838
+ isExpressionUnderstood = false;
839
+ }
840
+ });
841
+ }
769
842
  else {
770
843
  isExpressionUnderstood = false;
771
844
  }
845
+ this._currentScope.setHasNonEmptySlots(this._dunderSlotsEntries.some((entry) => entry.d.strings[0].d.value !== '__dict__'));
772
846
  if (!isExpressionUnderstood) {
773
847
  this._dunderSlotsEntries = undefined;
774
848
  }
@@ -783,7 +857,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
783
857
  // Evaluate the operand expression.
784
858
  this.walk(node.d.rightExpr);
785
859
  });
786
- const evaluationNode = ParseTreeUtils.getEvaluationNodeForAssignmentExpression(node);
860
+ const evaluationNode = ParseTreeUtils.getEvaluationNodeForAssignmentExpression(node, this._nodeInfo);
787
861
  if (!evaluationNode) {
788
862
  this._addSyntaxError(localize_1.LocMessage.assignmentExprContext(), node);
789
863
  this.walk(node.d.name);
@@ -793,7 +867,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
793
867
  // because of the behavior defined in PEP 572. Targets of assignment
794
868
  // expressions don't bind to a list comprehension's scope but instead
795
869
  // bind to its containing scope.
796
- const containerScope = AnalyzerNodeInfo.getScope(evaluationNode);
870
+ const containerScope = this._nodeInfo.getScope(evaluationNode);
797
871
  // If we're in a list comprehension (possibly nested), make sure that
798
872
  // local for targets don't collide with the target of the assignment
799
873
  // expression.
@@ -997,10 +1071,10 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
997
1071
  this._targetFunctionDeclaration.returnStatements.push(node);
998
1072
  }
999
1073
  if (node.d.expr) {
1000
- AnalyzerNodeInfo.setFlowNode(node.d.expr, this._currentFlowNode);
1074
+ this._nodeInfo.setFlowNode(node.d.expr, this._currentFlowNode);
1001
1075
  this.walk(node.d.expr);
1002
1076
  }
1003
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
1077
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
1004
1078
  if (this._currentReturnTarget) {
1005
1079
  this._addAntecedent(this._currentReturnTarget, this._currentFlowNode);
1006
1080
  }
@@ -1026,15 +1100,15 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1026
1100
  }
1027
1101
  visitMemberAccess(node) {
1028
1102
  this.walk(node.d.leftExpr);
1029
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
1103
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
1030
1104
  return false;
1031
1105
  }
1032
1106
  visitName(node) {
1033
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
1107
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
1034
1108
  return false;
1035
1109
  }
1036
1110
  visitIndex(node) {
1037
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
1111
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
1038
1112
  this.walk(node.d.leftExpr);
1039
1113
  // If we're within an 'Annotated' type annotation, set the flag.
1040
1114
  const wasInAnnotatedAnnotation = this._isInAnnotatedAnnotation;
@@ -1056,7 +1130,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1056
1130
  // Determine if the test condition is always true or always false. If so,
1057
1131
  // we can treat either the then or the else clause as unconditional.
1058
1132
  const constExprValue = StaticExpressions.evaluateStaticBoolLikeExpression(node.d.testExpr, this._fileInfo.executionEnvironment, this._fileInfo.definedConstants, this._typingImportAliases, this._sysImportAliases);
1059
- AnalyzerNodeInfo.setStaticConditionValue(node, constExprValue);
1133
+ this._nodeInfo.setStaticConditionValue(node, constExprValue);
1060
1134
  this._bindConditional(node.d.testExpr, thenLabel, elseLabel);
1061
1135
  // Handle the if clause.
1062
1136
  this._currentFlowNode =
@@ -1295,7 +1369,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1295
1369
  }
1296
1370
  visitAwait(node) {
1297
1371
  // Make sure this is within an async lambda or function.
1298
- const execScopeNode = ParseTreeUtils.getExecutionScopeNode(node);
1372
+ const execScopeNode = ParseTreeUtils.getExecutionScopeNode(node, this._nodeInfo);
1299
1373
  if (execScopeNode?.nodeType !== 31 /* ParseNodeType.Function */ || !execScopeNode.d.isAsync) {
1300
1374
  if (this._fileInfo.ipythonMode && execScopeNode?.nodeType === 36 /* ParseNodeType.Module */) {
1301
1375
  // Top level await is allowed in ipython mode.
@@ -1392,7 +1466,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1392
1466
  this._potentialHiddenSymbols.set(symbolName, symbol);
1393
1467
  }
1394
1468
  }
1395
- const importInfo = AnalyzerNodeInfo.getImportInfo(node.d.module);
1469
+ const importInfo = this._nodeInfo.getImportInfo(node.d.module);
1396
1470
  (0, debug_1.assert)(importInfo !== undefined);
1397
1471
  if (symbol) {
1398
1472
  this._createAliasDeclarationForMultipartImportName(node, node.d.alias, importInfo, symbol);
@@ -1414,9 +1488,9 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1414
1488
  }
1415
1489
  visitImportFrom(node) {
1416
1490
  const typingSymbolsOfInterest = ['Final', 'ClassVar', 'Annotated'];
1417
- const dataclassesSymbolsOfInterest = ['InitVar'];
1418
- const importInfo = AnalyzerNodeInfo.getImportInfo(node.d.module);
1419
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
1491
+ const dataclassesSymbolsOfInterest = ['InitVar', 'KW_ONLY'];
1492
+ const importInfo = this._nodeInfo.getImportInfo(node.d.module);
1493
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
1420
1494
  let resolvedPath = uri_1.Uri.empty();
1421
1495
  if (importInfo && importInfo.isImportFound && !importInfo.isNativeLib) {
1422
1496
  resolvedPath = importInfo.resolvedUris[importInfo.resolvedUris.length - 1];
@@ -1556,7 +1630,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1556
1630
  node.d.imports.forEach((importSymbolNode) => {
1557
1631
  const importedName = importSymbolNode.d.name.d.value;
1558
1632
  const nameNode = importSymbolNode.d.alias || importSymbolNode.d.name;
1559
- AnalyzerNodeInfo.setFlowNode(importSymbolNode, this._currentFlowNode);
1633
+ this._nodeInfo.setFlowNode(importSymbolNode, this._currentFlowNode);
1560
1634
  const symbol = this._bindNameToScope(this._currentScope, nameNode);
1561
1635
  if (symbol) {
1562
1636
  // All import statements of the form `from . import x` treat x
@@ -1785,7 +1859,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
1785
1859
  this._createNewScope(1 /* ScopeType.Comprehension */, this._getNonClassParentScope(),
1786
1860
  /* proxyScope */ undefined,
1787
1861
  /* chainedModuleLevelScopeLookup */ undefined, () => {
1788
- AnalyzerNodeInfo.setScope(node, this._currentScope);
1862
+ this._nodeInfo.setScope(node, this._currentScope);
1789
1863
  const falseLabel = this._createBranchLabel();
1790
1864
  // We'll walk the forIfNodes list twice. The first time we'll
1791
1865
  // bind targets of for statements. The second time we'll walk
@@ -2123,7 +2197,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2123
2197
  }
2124
2198
  _createAliasDeclarationForMultipartImportName(node, importAlias, importInfo, symbol) {
2125
2199
  const firstNamePartValue = node.d.module.d.nameParts[0].d.value;
2126
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
2200
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
2127
2201
  let uriOfFirstSubmodule;
2128
2202
  if (importInfo && importInfo.isImportFound && !importInfo.isNativeLib && importInfo.resolvedUris.length > 0) {
2129
2203
  uriOfFirstSubmodule = importInfo.resolvedUris[0];
@@ -2199,7 +2273,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2199
2273
  }
2200
2274
  // See if there is import info for this part of the path. This allows us
2201
2275
  // to implicitly import all of the modules in a multi-part module name.
2202
- const implicitImportInfo = AnalyzerNodeInfo.getImportInfo(node.d.module.d.nameParts[0]);
2276
+ const implicitImportInfo = this._nodeInfo.getImportInfo(node.d.module.d.nameParts[0]);
2203
2277
  if (implicitImportInfo && implicitImportInfo.resolvedUris.length) {
2204
2278
  newDecl.uri = implicitImportInfo.resolvedUris[0];
2205
2279
  newDecl.loadSymbolsFromPath = true;
@@ -2254,7 +2328,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2254
2328
  // is import info for this part of the path. This allows us to implicitly
2255
2329
  // import all of the modules in a multi-part module name (e.g. "import a.b.c"
2256
2330
  // imports "a" and "a.b" and "a.b.c").
2257
- const implicitImportInfo = AnalyzerNodeInfo.getImportInfo(node.d.module.d.nameParts[i]);
2331
+ const implicitImportInfo = this._nodeInfo.getImportInfo(node.d.module.d.nameParts[i]);
2258
2332
  if (implicitImportInfo && implicitImportInfo.resolvedUris.length) {
2259
2333
  loaderActions.uri = implicitImportInfo.resolvedUris[i];
2260
2334
  loaderActions.loadSymbolsFromPath = true;
@@ -2271,7 +2345,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2271
2345
  _walkStatementsAndReportUnreachable(statements) {
2272
2346
  let foundUnreachableStatement = false;
2273
2347
  for (const statement of statements) {
2274
- AnalyzerNodeInfo.setFlowNode(statement, this._currentFlowNode);
2348
+ this._nodeInfo.setFlowNode(statement, this._currentFlowNode);
2275
2349
  if (!foundUnreachableStatement) {
2276
2350
  foundUnreachableStatement = this._isCodeUnreachable();
2277
2351
  }
@@ -2292,7 +2366,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2292
2366
  // subtree, we need to create dummy scopes for them. The type analyzer
2293
2367
  // depends on scopes being present.
2294
2368
  if (!this._moduleSymbolOnly) {
2295
- const dummyScopeGenerator = new DummyScopeGenerator(this._currentScope);
2369
+ const dummyScopeGenerator = new DummyScopeGenerator(this._currentScope, this._nodeInfo);
2296
2370
  dummyScopeGenerator.walk(statement);
2297
2371
  }
2298
2372
  }
@@ -2768,8 +2842,8 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2768
2842
  // introduced in except clauses. If there is no use the previous flow node
2769
2843
  // associated, use the previous flow node (applies in the del case).
2770
2844
  // Otherwise, the node will be evaluated as unbound at this point in the flow.
2771
- if (!unbound || AnalyzerNodeInfo.getFlowNode(node) === undefined) {
2772
- AnalyzerNodeInfo.setFlowNode(node, unbound ? prevFlowNode : this._currentFlowNode);
2845
+ if (!unbound || this._nodeInfo.getFlowNode(node) === undefined) {
2846
+ this._nodeInfo.setFlowNode(node, unbound ? prevFlowNode : this._currentFlowNode);
2773
2847
  }
2774
2848
  }
2775
2849
  _createFlowWildcardImport(node, names) {
@@ -2784,7 +2858,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2784
2858
  this._addExceptTargets(flowNode);
2785
2859
  this._currentFlowNode = flowNode;
2786
2860
  }
2787
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
2861
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
2788
2862
  }
2789
2863
  _createFlowExhaustedMatch(node) {
2790
2864
  if (!this._isCodeUnreachable()) {
@@ -2797,7 +2871,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2797
2871
  };
2798
2872
  this._currentFlowNode = flowNode;
2799
2873
  }
2800
- AnalyzerNodeInfo.setAfterFlowNode(node, this._currentFlowNode);
2874
+ this._nodeInfo.setAfterFlowNode(node, this._currentFlowNode);
2801
2875
  }
2802
2876
  _isCodeUnreachable() {
2803
2877
  return !!(this._currentFlowNode.flags &
@@ -2893,6 +2967,9 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2893
2967
  return undefined;
2894
2968
  }
2895
2969
  _bindPossibleTupleNamedTarget(target, addedSymbols) {
2970
+ if (this._currentScope.type === 3 /* ScopeType.Class */ && !isStaticClassAssignmentTarget(target)) {
2971
+ this._currentScope.hasPotentiallyDynamicSymbolTable = true;
2972
+ }
2896
2973
  switch (target.nodeType) {
2897
2974
  case 38 /* ParseNodeType.Name */: {
2898
2975
  this._bindNameToScope(this._currentScope, target, addedSymbols);
@@ -2986,7 +3063,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
2986
3063
  // state so that hits from later cells are correctly marked.
2987
3064
  return (name, context) => {
2988
3065
  for (const moduleNode of cellChainIndex.getLaterModuleNodes(fileUri) ?? []) {
2989
- const moduleScope = AnalyzerNodeInfo.getScope(moduleNode);
3066
+ const moduleScope = this._nodeInfo.getScope(moduleNode);
2990
3067
  if (!moduleScope) {
2991
3068
  continue;
2992
3069
  }
@@ -3183,6 +3260,15 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3183
3260
  }
3184
3261
  }
3185
3262
  }
3263
+ if (this._isDataclassesAnnotation(typeAnnotation, 'KW_ONLY')) {
3264
+ symbolWithScope.symbol.setIsDataClassKeywordOnly();
3265
+ }
3266
+ else if (typeAnnotation.nodeType === 27 /* ParseNodeType.Index */ &&
3267
+ this._isTypingAnnotation(typeAnnotation.d.leftExpr, 'Annotated') &&
3268
+ typeAnnotation.d.items.length > 0 &&
3269
+ this._isDataclassesAnnotation(typeAnnotation.d.items[0].d.valueExpr, 'KW_ONLY')) {
3270
+ symbolWithScope.symbol.setIsDataClassKeywordOnly();
3271
+ }
3186
3272
  }
3187
3273
  declarationHandled = true;
3188
3274
  break;
@@ -3249,8 +3335,8 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3249
3335
  _isKnownAnnotation(typeAnnotation, name, importAliases, symbolAliases) {
3250
3336
  let annotationNode = typeAnnotation;
3251
3337
  // Is this a quoted annotation?
3252
- if (annotationNode.nodeType === 48 /* ParseNodeType.StringList */ && annotationNode.d.annotation) {
3253
- annotationNode = annotationNode.d.annotation;
3338
+ if (annotationNode.nodeType === 48 /* ParseNodeType.StringList */) {
3339
+ annotationNode = this._nodeInfo.getStringAnnotation(annotationNode) ?? annotationNode;
3254
3340
  }
3255
3341
  if (annotationNode.nodeType === 38 /* ParseNodeType.Name */) {
3256
3342
  const alias = symbolAliases.get(annotationNode.d.value);
@@ -3322,8 +3408,8 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3322
3408
  let classVarTypeNode;
3323
3409
  while (typeAnnotation) {
3324
3410
  // Is this a quoted annotation?
3325
- if (typeAnnotation.nodeType === 48 /* ParseNodeType.StringList */ && typeAnnotation.d.annotation) {
3326
- typeAnnotation = typeAnnotation.d.annotation;
3411
+ if (typeAnnotation.nodeType === 48 /* ParseNodeType.StringList */) {
3412
+ typeAnnotation = this._nodeInfo.getStringAnnotation(typeAnnotation) ?? typeAnnotation;
3327
3413
  }
3328
3414
  if (typeAnnotation.nodeType === 27 /* ParseNodeType.Index */ &&
3329
3415
  typeAnnotation.d.items.length > 0 &&
@@ -3422,7 +3508,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3422
3508
  }
3423
3509
  }
3424
3510
  }
3425
- const classScope = AnalyzerNodeInfo.getScope(classNode);
3511
+ const classScope = this._nodeInfo.getScope(classNode);
3426
3512
  (0, debug_1.assert)(classScope !== undefined);
3427
3513
  return {
3428
3514
  classNode,
@@ -3629,7 +3715,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3629
3715
  if (symbol) {
3630
3716
  symbol.addDeclaration(specialBuiltInClassDeclaration);
3631
3717
  }
3632
- AnalyzerNodeInfo.setDeclaration(node, specialBuiltInClassDeclaration);
3718
+ this._nodeInfo.setDeclaration(node, specialBuiltInClassDeclaration);
3633
3719
  return true;
3634
3720
  }
3635
3721
  _deferBinding(callback) {
@@ -3673,7 +3759,7 @@ class Binder extends parseTreeWalker_1.ParseTreeWalker {
3673
3759
  if (node.d.expr) {
3674
3760
  this.walk(node.d.expr);
3675
3761
  }
3676
- AnalyzerNodeInfo.setFlowNode(node, this._currentFlowNode);
3762
+ this._nodeInfo.setFlowNode(node, this._currentFlowNode);
3677
3763
  }
3678
3764
  _getUniqueFlowNodeId() {
3679
3765
  this._codeFlowComplexity += flowNodeComplexityContribution;
@@ -3752,16 +3838,17 @@ exports.ReturnFinder = ReturnFinder;
3752
3838
  // will still evaluate these types, and it depends on the presence
3753
3839
  // of a scope.
3754
3840
  class DummyScopeGenerator extends parseTreeWalker_1.ParseTreeWalker {
3755
- constructor(currentScope) {
3841
+ constructor(currentScope, _nodeInfo) {
3756
3842
  super();
3843
+ this._nodeInfo = _nodeInfo;
3757
3844
  this._currentScope = currentScope;
3758
3845
  }
3759
3846
  visitClass(node) {
3760
3847
  const newScope = this._createNewScope(3 /* ScopeType.Class */, () => {
3761
3848
  this.walk(node.d.suite);
3762
3849
  });
3763
- if (!AnalyzerNodeInfo.getScope(node)) {
3764
- AnalyzerNodeInfo.setScope(node, newScope);
3850
+ if (!this._nodeInfo.getScope(node)) {
3851
+ this._nodeInfo.setScope(node, newScope);
3765
3852
  }
3766
3853
  return false;
3767
3854
  }
@@ -3769,8 +3856,8 @@ class DummyScopeGenerator extends parseTreeWalker_1.ParseTreeWalker {
3769
3856
  const newScope = this._createNewScope(2 /* ScopeType.Function */, () => {
3770
3857
  this.walk(node.d.suite);
3771
3858
  });
3772
- if (!AnalyzerNodeInfo.getScope(node)) {
3773
- AnalyzerNodeInfo.setScope(node, newScope);
3859
+ if (!this._nodeInfo.getScope(node)) {
3860
+ this._nodeInfo.setScope(node, newScope);
3774
3861
  }
3775
3862
  return false;
3776
3863
  }