@zzzen/pyright-internal 1.2.0-dev.20231119 → 1.2.0-dev.20231126

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 (386) hide show
  1. package/dist/analyzer/analysis.d.ts +1 -1
  2. package/dist/analyzer/analysis.js +5 -1
  3. package/dist/analyzer/analysis.js.map +1 -1
  4. package/dist/analyzer/analyzerFileInfo.d.ts +1 -1
  5. package/dist/analyzer/analyzerNodeInfo.d.ts +1 -1
  6. package/dist/analyzer/analyzerNodeInfo.js +1 -1
  7. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  8. package/dist/analyzer/backgroundAnalysisProgram.d.ts +1 -1
  9. package/dist/analyzer/backgroundAnalysisProgram.js +1 -1
  10. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  11. package/dist/analyzer/binder.js +198 -194
  12. package/dist/analyzer/binder.js.map +1 -1
  13. package/dist/analyzer/cacheManager.js +1 -1
  14. package/dist/analyzer/cacheManager.js.map +1 -1
  15. package/dist/analyzer/checker.js +257 -239
  16. package/dist/analyzer/checker.js.map +1 -1
  17. package/dist/analyzer/codeFlowEngine.d.ts +1 -1
  18. package/dist/analyzer/codeFlowEngine.js +26 -26
  19. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  20. package/dist/analyzer/codeFlowTypes.d.ts +1 -1
  21. package/dist/analyzer/codeFlowTypes.js +23 -23
  22. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  23. package/dist/analyzer/codeFlowUtils.js +39 -37
  24. package/dist/analyzer/codeFlowUtils.js.map +1 -1
  25. package/dist/analyzer/constraintSolver.js +40 -47
  26. package/dist/analyzer/constraintSolver.js.map +1 -1
  27. package/dist/analyzer/constructorTransform.js +8 -8
  28. package/dist/analyzer/constructorTransform.js.map +1 -1
  29. package/dist/analyzer/constructors.js +23 -25
  30. package/dist/analyzer/constructors.js.map +1 -1
  31. package/dist/analyzer/dataClasses.js +67 -63
  32. package/dist/analyzer/dataClasses.js.map +1 -1
  33. package/dist/analyzer/declaration.d.ts +2 -2
  34. package/dist/analyzer/declaration.js +10 -10
  35. package/dist/analyzer/declaration.js.map +1 -1
  36. package/dist/analyzer/declarationUtils.js +41 -41
  37. package/dist/analyzer/declarationUtils.js.map +1 -1
  38. package/dist/analyzer/decorators.js +51 -51
  39. package/dist/analyzer/decorators.js.map +1 -1
  40. package/dist/analyzer/enums.js +27 -27
  41. package/dist/analyzer/enums.js.map +1 -1
  42. package/dist/analyzer/functionTransform.js +4 -4
  43. package/dist/analyzer/functionTransform.js.map +1 -1
  44. package/dist/analyzer/importResolver.d.ts +1 -1
  45. package/dist/analyzer/importResolver.js +21 -17
  46. package/dist/analyzer/importResolver.js.map +1 -1
  47. package/dist/analyzer/importResult.js +1 -1
  48. package/dist/analyzer/importResult.js.map +1 -1
  49. package/dist/analyzer/importStatementUtils.js +31 -27
  50. package/dist/analyzer/importStatementUtils.js.map +1 -1
  51. package/dist/analyzer/namedTuples.js +36 -32
  52. package/dist/analyzer/namedTuples.js.map +1 -1
  53. package/dist/analyzer/operations.js +78 -78
  54. package/dist/analyzer/operations.js.map +1 -1
  55. package/dist/analyzer/packageTypeReport.d.ts +1 -1
  56. package/dist/analyzer/packageTypeReport.js +2 -2
  57. package/dist/analyzer/packageTypeReport.js.map +1 -1
  58. package/dist/analyzer/packageTypeVerifier.js +90 -90
  59. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  60. package/dist/analyzer/parameterUtils.js +14 -14
  61. package/dist/analyzer/parameterUtils.js.map +1 -1
  62. package/dist/analyzer/parentDirectoryCache.d.ts +2 -2
  63. package/dist/analyzer/parseTreeCleaner.js +5 -1
  64. package/dist/analyzer/parseTreeCleaner.js.map +1 -1
  65. package/dist/analyzer/parseTreeUtils.d.ts +1 -1
  66. package/dist/analyzer/parseTreeUtils.js +383 -379
  67. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  68. package/dist/analyzer/parseTreeWalker.js +161 -157
  69. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  70. package/dist/analyzer/patternMatching.d.ts +1 -1
  71. package/dist/analyzer/patternMatching.js +52 -50
  72. package/dist/analyzer/patternMatching.js.map +1 -1
  73. package/dist/analyzer/program.d.ts +1 -1
  74. package/dist/analyzer/program.js +18 -14
  75. package/dist/analyzer/program.js.map +1 -1
  76. package/dist/analyzer/properties.js +53 -44
  77. package/dist/analyzer/properties.js.map +1 -1
  78. package/dist/analyzer/protocols.js +14 -14
  79. package/dist/analyzer/protocols.js.map +1 -1
  80. package/dist/analyzer/pythonPathUtils.js +5 -1
  81. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  82. package/dist/analyzer/regions.js +3 -3
  83. package/dist/analyzer/regions.js.map +1 -1
  84. package/dist/analyzer/scope.js +8 -8
  85. package/dist/analyzer/scope.js.map +1 -1
  86. package/dist/analyzer/scopeUtils.js +1 -1
  87. package/dist/analyzer/scopeUtils.js.map +1 -1
  88. package/dist/analyzer/service.js +5 -1
  89. package/dist/analyzer/service.js.map +1 -1
  90. package/dist/analyzer/sourceFile.js +25 -21
  91. package/dist/analyzer/sourceFile.js.map +1 -1
  92. package/dist/analyzer/sourceMapper.d.ts +2 -2
  93. package/dist/analyzer/sourceMapper.js +12 -8
  94. package/dist/analyzer/sourceMapper.js.map +1 -1
  95. package/dist/analyzer/staticExpressions.js +40 -40
  96. package/dist/analyzer/staticExpressions.js.map +1 -1
  97. package/dist/analyzer/symbol.d.ts +1 -1
  98. package/dist/analyzer/symbol.js +26 -26
  99. package/dist/analyzer/symbol.js.map +1 -1
  100. package/dist/analyzer/symbolUtils.js +1 -1
  101. package/dist/analyzer/symbolUtils.js.map +1 -1
  102. package/dist/analyzer/testWalker.js +5 -5
  103. package/dist/analyzer/testWalker.js.map +1 -1
  104. package/dist/analyzer/tracePrinter.d.ts +1 -1
  105. package/dist/analyzer/tracePrinter.js +35 -31
  106. package/dist/analyzer/tracePrinter.js.map +1 -1
  107. package/dist/analyzer/typeCacheUtils.js +5 -1
  108. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  109. package/dist/analyzer/typeDocStringUtils.js +13 -9
  110. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  111. package/dist/analyzer/typeEvaluator.js +1233 -1153
  112. package/dist/analyzer/typeEvaluator.js.map +1 -1
  113. package/dist/analyzer/typeEvaluatorTypes.d.ts +3 -1
  114. package/dist/analyzer/typeEvaluatorTypes.js +3 -1
  115. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  116. package/dist/analyzer/typeGuards.d.ts +1 -1
  117. package/dist/analyzer/typeGuards.js +79 -65
  118. package/dist/analyzer/typeGuards.js.map +1 -1
  119. package/dist/analyzer/typePrinter.d.ts +1 -1
  120. package/dist/analyzer/typePrinter.js +80 -76
  121. package/dist/analyzer/typePrinter.js.map +1 -1
  122. package/dist/analyzer/typeStubWriter.js +26 -22
  123. package/dist/analyzer/typeStubWriter.js.map +1 -1
  124. package/dist/analyzer/typeUtils.js +123 -123
  125. package/dist/analyzer/typeUtils.js.map +1 -1
  126. package/dist/analyzer/typeVarContext.js +9 -9
  127. package/dist/analyzer/typeVarContext.js.map +1 -1
  128. package/dist/analyzer/typeWalker.js +10 -10
  129. package/dist/analyzer/typedDicts.js +74 -70
  130. package/dist/analyzer/typedDicts.js.map +1 -1
  131. package/dist/analyzer/types.d.ts +16 -11
  132. package/dist/analyzer/types.js +179 -177
  133. package/dist/analyzer/types.js.map +1 -1
  134. package/dist/backgroundAnalysisBase.d.ts +2 -2
  135. package/dist/backgroundAnalysisBase.js +5 -1
  136. package/dist/backgroundAnalysisBase.js.map +1 -1
  137. package/dist/backgroundThreadBase.js +5 -1
  138. package/dist/backgroundThreadBase.js.map +1 -1
  139. package/dist/commands/commandController.js +7 -7
  140. package/dist/commands/commandController.js.map +1 -1
  141. package/dist/commands/commandResult.js +1 -1
  142. package/dist/commands/commandResult.js.map +1 -1
  143. package/dist/commands/commands.js +1 -1
  144. package/dist/commands/commands.js.map +1 -1
  145. package/dist/commands/dumpFileDebugInfoCommand.js +196 -196
  146. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  147. package/dist/commands/quickActionCommand.js +1 -1
  148. package/dist/commands/quickActionCommand.js.map +1 -1
  149. package/dist/common/charCodes.js +1 -1
  150. package/dist/common/charCodes.js.map +1 -1
  151. package/dist/common/chokidarFileWatcherProvider.js +5 -1
  152. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  153. package/dist/common/collectionUtils.d.ts +3 -3
  154. package/dist/common/collectionUtils.js +3 -3
  155. package/dist/common/collectionUtils.js.map +1 -1
  156. package/dist/common/commandLineOptions.d.ts +1 -1
  157. package/dist/common/commandLineOptions.js +5 -5
  158. package/dist/common/commandLineOptions.js.map +1 -1
  159. package/dist/common/configOptions.d.ts +1 -1
  160. package/dist/common/configOptions.js +11 -7
  161. package/dist/common/configOptions.js.map +1 -1
  162. package/dist/common/console.js +7 -3
  163. package/dist/common/console.js.map +1 -1
  164. package/dist/common/core.d.ts +2 -2
  165. package/dist/common/core.js +6 -6
  166. package/dist/common/core.js.map +1 -1
  167. package/dist/common/diagnostic.js +6 -6
  168. package/dist/common/diagnostic.js.map +1 -1
  169. package/dist/common/diagnosticRules.js +1 -1
  170. package/dist/common/diagnosticRules.js.map +1 -1
  171. package/dist/common/diagnosticSink.js +12 -12
  172. package/dist/common/diagnosticSink.js.map +1 -1
  173. package/dist/common/editAction.d.ts +1 -1
  174. package/dist/common/editAction.js +2 -2
  175. package/dist/common/editAction.js.map +1 -1
  176. package/dist/common/envVarUtils.js +5 -1
  177. package/dist/common/envVarUtils.js.map +1 -1
  178. package/dist/common/extensibility.js +1 -1
  179. package/dist/common/extensibility.js.map +1 -1
  180. package/dist/common/fileBasedCancellationUtils.js +5 -1
  181. package/dist/common/fileBasedCancellationUtils.js.map +1 -1
  182. package/dist/common/fileSystem.d.ts +1 -0
  183. package/dist/common/fileSystem.js +2 -2
  184. package/dist/common/fileSystem.js.map +1 -1
  185. package/dist/common/fileWatcher.d.ts +2 -2
  186. package/dist/common/fullAccessHost.js +10 -6
  187. package/dist/common/fullAccessHost.js.map +1 -1
  188. package/dist/common/host.d.ts +1 -1
  189. package/dist/common/host.js +2 -2
  190. package/dist/common/host.js.map +1 -1
  191. package/dist/common/lspUtils.js +7 -7
  192. package/dist/common/lspUtils.js.map +1 -1
  193. package/dist/common/memUtils.d.ts +1 -1
  194. package/dist/common/pathUtils.js +12 -8
  195. package/dist/common/pathUtils.js.map +1 -1
  196. package/dist/common/pythonVersion.js +1 -1
  197. package/dist/common/pythonVersion.js.map +1 -1
  198. package/dist/common/realFileSystem.js +5 -1
  199. package/dist/common/realFileSystem.js.map +1 -1
  200. package/dist/common/serviceProvider.d.ts +1 -1
  201. package/dist/common/serviceProvider.js +5 -1
  202. package/dist/common/serviceProvider.js.map +1 -1
  203. package/dist/common/serviceProviderExtensions.js +1 -1
  204. package/dist/common/serviceProviderExtensions.js.map +1 -1
  205. package/dist/common/stringUtils.js +5 -5
  206. package/dist/common/stringUtils.js.map +1 -1
  207. package/dist/common/textEditTracker.js +11 -7
  208. package/dist/common/textEditTracker.js.map +1 -1
  209. package/dist/common/textRange.js +3 -3
  210. package/dist/common/textRange.js.map +1 -1
  211. package/dist/languageServerBase.js +13 -13
  212. package/dist/languageServerBase.js.map +1 -1
  213. package/dist/languageService/autoImporter.d.ts +3 -3
  214. package/dist/languageService/autoImporter.js +12 -8
  215. package/dist/languageService/autoImporter.js.map +1 -1
  216. package/dist/languageService/callHierarchyProvider.js +27 -23
  217. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  218. package/dist/languageService/codeActionProvider.js +8 -8
  219. package/dist/languageService/codeActionProvider.js.map +1 -1
  220. package/dist/languageService/completionProvider.js +166 -162
  221. package/dist/languageService/completionProvider.js.map +1 -1
  222. package/dist/languageService/completionProviderUtils.js +9 -9
  223. package/dist/languageService/completionProviderUtils.js.map +1 -1
  224. package/dist/languageService/definitionProvider.js +14 -10
  225. package/dist/languageService/definitionProvider.js.map +1 -1
  226. package/dist/languageService/documentHighlightProvider.js +7 -3
  227. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  228. package/dist/languageService/documentSymbolCollector.d.ts +1 -1
  229. package/dist/languageService/documentSymbolCollector.js +21 -17
  230. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  231. package/dist/languageService/hoverProvider.js +30 -26
  232. package/dist/languageService/hoverProvider.js.map +1 -1
  233. package/dist/languageService/importSorter.js +1 -1
  234. package/dist/languageService/importSorter.js.map +1 -1
  235. package/dist/languageService/quickActions.js +10 -6
  236. package/dist/languageService/quickActions.js.map +1 -1
  237. package/dist/languageService/referencesProvider.d.ts +1 -1
  238. package/dist/languageService/referencesProvider.js +24 -20
  239. package/dist/languageService/referencesProvider.js.map +1 -1
  240. package/dist/languageService/signatureHelpProvider.js +8 -4
  241. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  242. package/dist/languageService/symbolIndexer.js +8 -4
  243. package/dist/languageService/symbolIndexer.js.map +1 -1
  244. package/dist/languageService/tooltipUtils.js +20 -16
  245. package/dist/languageService/tooltipUtils.js.map +1 -1
  246. package/dist/languageService/workspaceSymbolProvider.js +5 -1
  247. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  248. package/dist/localization/localize.d.ts +7 -9
  249. package/dist/localization/localize.js +5 -4
  250. package/dist/localization/localize.js.map +1 -1
  251. package/dist/localization/package.nls.cs.json +0 -3
  252. package/dist/localization/package.nls.de.json +0 -3
  253. package/dist/localization/package.nls.en-us.json +4 -3
  254. package/dist/localization/package.nls.es.json +0 -3
  255. package/dist/localization/package.nls.fr.json +0 -3
  256. package/dist/localization/package.nls.it.json +0 -3
  257. package/dist/localization/package.nls.ja.json +0 -3
  258. package/dist/localization/package.nls.ko.json +0 -3
  259. package/dist/localization/package.nls.pl.json +0 -3
  260. package/dist/localization/package.nls.pt-br.json +0 -3
  261. package/dist/localization/package.nls.qps-ploc.json +0 -3
  262. package/dist/localization/package.nls.ru.json +0 -3
  263. package/dist/localization/package.nls.tr.json +0 -3
  264. package/dist/localization/package.nls.zh-cn.json +0 -3
  265. package/dist/localization/package.nls.zh-tw.json +0 -3
  266. package/dist/parser/characterStream.js +3 -3
  267. package/dist/parser/characterStream.js.map +1 -1
  268. package/dist/parser/characters.js +13 -9
  269. package/dist/parser/characters.js.map +1 -1
  270. package/dist/parser/parseNodes.d.ts +12 -12
  271. package/dist/parser/parseNodes.js +193 -193
  272. package/dist/parser/parseNodes.js.map +1 -1
  273. package/dist/parser/parser.js +563 -559
  274. package/dist/parser/parser.js.map +1 -1
  275. package/dist/parser/stringTokenUtils.js +47 -47
  276. package/dist/parser/stringTokenUtils.js.map +1 -1
  277. package/dist/parser/tokenizer.js +288 -288
  278. package/dist/parser/tokenizer.js.map +1 -1
  279. package/dist/parser/tokenizerTypes.js +35 -35
  280. package/dist/parser/tokenizerTypes.js.map +1 -1
  281. package/dist/parser/unicode.d.ts +3 -3
  282. package/dist/pyright.js +21 -17
  283. package/dist/pyright.js.map +1 -1
  284. package/dist/pyrightFileSystem.d.ts +1 -0
  285. package/dist/pyrightFileSystem.js +1 -1
  286. package/dist/pyrightFileSystem.js.map +1 -1
  287. package/dist/readonlyAugmentedFileSystem.d.ts +1 -0
  288. package/dist/tests/chainedSourceFiles.test.js +5 -1
  289. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  290. package/dist/tests/checker.test.js +5 -1
  291. package/dist/tests/checker.test.js.map +1 -1
  292. package/dist/tests/collectionUtils.test.js +5 -1
  293. package/dist/tests/collectionUtils.test.js.map +1 -1
  294. package/dist/tests/common.test.js +5 -1
  295. package/dist/tests/common.test.js.map +1 -1
  296. package/dist/tests/debug.test.js +8 -4
  297. package/dist/tests/debug.test.js.map +1 -1
  298. package/dist/tests/deferred.test.js +5 -1
  299. package/dist/tests/deferred.test.js.map +1 -1
  300. package/dist/tests/diagnosticOverrides.test.js +5 -1
  301. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  302. package/dist/tests/docStringUtils.test.js +5 -1
  303. package/dist/tests/docStringUtils.test.js.map +1 -1
  304. package/dist/tests/filesystem.test.js +5 -1
  305. package/dist/tests/filesystem.test.js.map +1 -1
  306. package/dist/tests/fourSlashParser.test.js +5 -1
  307. package/dist/tests/fourSlashParser.test.js.map +1 -1
  308. package/dist/tests/fourSlashRunner.test.js +5 -1
  309. package/dist/tests/fourSlashRunner.test.js.map +1 -1
  310. package/dist/tests/harness/fourslash/fourSlashParser.js +13 -13
  311. package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
  312. package/dist/tests/harness/fourslash/fourSlashTypes.js +11 -7
  313. package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
  314. package/dist/tests/harness/fourslash/runner.d.ts +1 -1
  315. package/dist/tests/harness/fourslash/runner.js +5 -1
  316. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  317. package/dist/tests/harness/fourslash/testLanguageService.js +5 -1
  318. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  319. package/dist/tests/harness/fourslash/testState.Consts.js +6 -2
  320. package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
  321. package/dist/tests/harness/fourslash/testState.js +17 -13
  322. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  323. package/dist/tests/harness/fourslash/testStateUtils.js +9 -5
  324. package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
  325. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +5 -1
  326. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  327. package/dist/tests/harness/testHost.js +5 -1
  328. package/dist/tests/harness/testHost.js.map +1 -1
  329. package/dist/tests/harness/utils.d.ts +13 -12
  330. package/dist/tests/harness/utils.js.map +1 -1
  331. package/dist/tests/harness/vfs/factory.js +6 -2
  332. package/dist/tests/harness/vfs/factory.js.map +1 -1
  333. package/dist/tests/harness/vfs/filesystem.d.ts +4 -3
  334. package/dist/tests/harness/vfs/filesystem.js +11 -7
  335. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  336. package/dist/tests/harness/vfs/pathValidation.js +30 -26
  337. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  338. package/dist/tests/importStatementUtils.test.js +25 -25
  339. package/dist/tests/importStatementUtils.test.js.map +1 -1
  340. package/dist/tests/ipythonMode.test.js +6 -6
  341. package/dist/tests/ipythonMode.test.js.map +1 -1
  342. package/dist/tests/localizer.test.js +5 -1
  343. package/dist/tests/localizer.test.js.map +1 -1
  344. package/dist/tests/logger.test.js +5 -1
  345. package/dist/tests/logger.test.js.map +1 -1
  346. package/dist/tests/parseTreeUtils.test.js +10 -10
  347. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  348. package/dist/tests/parser.test.js +13 -9
  349. package/dist/tests/parser.test.js.map +1 -1
  350. package/dist/tests/pathUtils.test.js +5 -1
  351. package/dist/tests/pathUtils.test.js.map +1 -1
  352. package/dist/tests/sourceFile.test.js +5 -1
  353. package/dist/tests/sourceFile.test.js.map +1 -1
  354. package/dist/tests/sourceMapperUtils.test.js +5 -1
  355. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  356. package/dist/tests/stringUtils.test.js +10 -6
  357. package/dist/tests/stringUtils.test.js.map +1 -1
  358. package/dist/tests/symbolNameUtils.test.js +5 -1
  359. package/dist/tests/symbolNameUtils.test.js.map +1 -1
  360. package/dist/tests/testState.test.js +5 -1
  361. package/dist/tests/testState.test.js.map +1 -1
  362. package/dist/tests/testUtils.js +11 -7
  363. package/dist/tests/testUtils.js.map +1 -1
  364. package/dist/tests/textRange.test.js +5 -1
  365. package/dist/tests/textRange.test.js.map +1 -1
  366. package/dist/tests/tokenizer.test.js +463 -459
  367. package/dist/tests/tokenizer.test.js.map +1 -1
  368. package/dist/tests/typeEvaluator1.test.js +14 -2
  369. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  370. package/dist/tests/typeEvaluator2.test.js +11 -3
  371. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  372. package/dist/tests/typeEvaluator3.test.js +11 -3
  373. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  374. package/dist/tests/typeEvaluator4.test.js +10 -2
  375. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  376. package/dist/tests/typeEvaluator5.test.js +5 -1
  377. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  378. package/dist/tests/typePrinter.test.js +44 -40
  379. package/dist/tests/typePrinter.test.js.map +1 -1
  380. package/dist/tests/workspaceEditUtils.test.js +5 -1
  381. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  382. package/dist/tests/zipfs.test.js +5 -1
  383. package/dist/tests/zipfs.test.js.map +1 -1
  384. package/dist/workspaceFactory.js +2 -2
  385. package/dist/workspaceFactory.js.map +1 -1
  386. package/package.json +2 -2
@@ -39,7 +39,7 @@ var TypeCategory;
39
39
  TypeCategory[TypeCategory["Union"] = 8] = "Union";
40
40
  // Type variable (defined with TypeVar)
41
41
  TypeCategory[TypeCategory["TypeVar"] = 9] = "TypeVar";
42
- })(TypeCategory = exports.TypeCategory || (exports.TypeCategory = {}));
42
+ })(TypeCategory || (exports.TypeCategory = TypeCategory = {}));
43
43
  var TypeFlags;
44
44
  (function (TypeFlags) {
45
45
  TypeFlags[TypeFlags["None"] = 0] = "None";
@@ -52,7 +52,7 @@ var TypeFlags;
52
52
  TypeFlags[TypeFlags["Annotated"] = 4] = "Annotated";
53
53
  // This type is a special form like "UnionType".
54
54
  TypeFlags[TypeFlags["SpecialForm"] = 8] = "SpecialForm";
55
- })(TypeFlags = exports.TypeFlags || (exports.TypeFlags = {}));
55
+ })(TypeFlags || (exports.TypeFlags = TypeFlags = {}));
56
56
  exports.WildcardTypeVarScopeId = '*';
57
57
  exports.InScopePlaceholderScopeId = '-';
58
58
  class EnumLiteral {
@@ -70,28 +70,30 @@ exports.EnumLiteral = EnumLiteral;
70
70
  // This constant controls the maximum number of nested types (i.e. types
71
71
  // used as type arguments or parameter types in other types) before we
72
72
  // give up. This constant was previously set to 32, but there were certain
73
- // pathological recursive types where this resulted in a hang.
74
- exports.maxTypeRecursionCount = 10;
73
+ // pathological recursive types where this resulted in a hang. It was also
74
+ // previously lowered to 10, but this caused some legitimate failures in
75
+ // code that used numpy.
76
+ exports.maxTypeRecursionCount = 12;
75
77
  var TypeBase;
76
78
  (function (TypeBase) {
77
79
  function isInstantiable(type) {
78
- return (type.flags & 1 /* Instantiable */) !== 0;
80
+ return (type.flags & 1 /* TypeFlags.Instantiable */) !== 0;
79
81
  }
80
82
  TypeBase.isInstantiable = isInstantiable;
81
83
  function isInstance(type) {
82
- return (type.flags & 2 /* Instance */) !== 0;
84
+ return (type.flags & 2 /* TypeFlags.Instance */) !== 0;
83
85
  }
84
86
  TypeBase.isInstance = isInstance;
85
87
  function isAnnotated(type) {
86
- return (type.flags & 4 /* Annotated */) !== 0;
88
+ return (type.flags & 4 /* TypeFlags.Annotated */) !== 0;
87
89
  }
88
90
  TypeBase.isAnnotated = isAnnotated;
89
91
  function isSpecialForm(type) {
90
- return (type.flags & 8 /* SpecialForm */) !== 0;
92
+ return (type.flags & 8 /* TypeFlags.SpecialForm */) !== 0;
91
93
  }
92
94
  TypeBase.isSpecialForm = isSpecialForm;
93
95
  function setSpecialForm(type) {
94
- return (type.flags |= 8 /* SpecialForm */);
96
+ return (type.flags |= 8 /* TypeFlags.SpecialForm */);
95
97
  }
96
98
  TypeBase.setSpecialForm = setSpecialForm;
97
99
  function isAmbiguous(type) {
@@ -108,8 +110,8 @@ var TypeBase;
108
110
  (0, debug_1.assert)(TypeBase.isInstantiable(type));
109
111
  const newInstance = TypeBase.cloneType(type);
110
112
  if (newInstance.instantiableNestingLevel === undefined) {
111
- newInstance.flags &= ~1 /* Instantiable */;
112
- newInstance.flags |= 2 /* Instance */;
113
+ newInstance.flags &= ~1 /* TypeFlags.Instantiable */;
114
+ newInstance.flags |= 2 /* TypeFlags.Instance */;
113
115
  delete newInstance.instantiableNestingLevel;
114
116
  }
115
117
  else {
@@ -133,8 +135,8 @@ var TypeBase;
133
135
  function cloneTypeAsInstantiable(type, cache) {
134
136
  const newInstance = TypeBase.cloneType(type);
135
137
  if (TypeBase.isInstance(type)) {
136
- newInstance.flags &= ~2 /* Instance */;
137
- newInstance.flags |= 1 /* Instantiable */;
138
+ newInstance.flags &= ~2 /* TypeFlags.Instance */;
139
+ newInstance.flags |= 1 /* TypeFlags.Instantiable */;
138
140
  }
139
141
  else {
140
142
  newInstance.instantiableNestingLevel =
@@ -165,7 +167,7 @@ var TypeBase;
165
167
  TypeBase.cloneForTypeAlias = cloneForTypeAlias;
166
168
  function cloneForAnnotated(type) {
167
169
  const typeClone = cloneType(type);
168
- typeClone.flags |= 4 /* Annotated */;
170
+ typeClone.flags |= 4 /* TypeFlags.Annotated */;
169
171
  return typeClone;
170
172
  }
171
173
  TypeBase.cloneForAnnotated = cloneForAnnotated;
@@ -189,29 +191,29 @@ var TypeBase;
189
191
  return typeClone;
190
192
  }
191
193
  TypeBase.cloneForAmbiguousType = cloneForAmbiguousType;
192
- })(TypeBase = exports.TypeBase || (exports.TypeBase = {}));
194
+ })(TypeBase || (exports.TypeBase = TypeBase = {}));
193
195
  var UnboundType;
194
196
  (function (UnboundType) {
195
197
  const _instance = {
196
- category: 0 /* Unbound */,
197
- flags: 1 /* Instantiable */ | 2 /* Instance */,
198
+ category: 0 /* TypeCategory.Unbound */,
199
+ flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
198
200
  };
199
201
  function create() {
200
202
  // All Unbound objects are the same, so use a shared instance.
201
203
  return _instance;
202
204
  }
203
205
  UnboundType.create = create;
204
- })(UnboundType = exports.UnboundType || (exports.UnboundType = {}));
206
+ })(UnboundType || (exports.UnboundType = UnboundType = {}));
205
207
  var UnknownType;
206
208
  (function (UnknownType) {
207
209
  const _instance = {
208
- category: 1 /* Unknown */,
209
- flags: 1 /* Instantiable */ | 2 /* Instance */,
210
+ category: 1 /* TypeCategory.Unknown */,
211
+ flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
210
212
  isIncomplete: false,
211
213
  };
212
214
  const _incompleteInstance = {
213
- category: 1 /* Unknown */,
214
- flags: 1 /* Instantiable */ | 2 /* Instance */,
215
+ category: 1 /* TypeCategory.Unknown */,
216
+ flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
215
217
  isIncomplete: true,
216
218
  };
217
219
  function create(isIncomplete = false) {
@@ -220,23 +222,23 @@ var UnknownType;
220
222
  UnknownType.create = create;
221
223
  function createPossibleType(possibleType, isIncomplete) {
222
224
  const unknownWithPossibleType = {
223
- category: 1 /* Unknown */,
224
- flags: 1 /* Instantiable */ | 2 /* Instance */,
225
+ category: 1 /* TypeCategory.Unknown */,
226
+ flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
225
227
  isIncomplete,
226
228
  possibleType,
227
229
  };
228
230
  return unknownWithPossibleType;
229
231
  }
230
232
  UnknownType.createPossibleType = createPossibleType;
231
- })(UnknownType = exports.UnknownType || (exports.UnknownType = {}));
233
+ })(UnknownType || (exports.UnknownType = UnknownType = {}));
232
234
  var ModuleType;
233
235
  (function (ModuleType) {
234
236
  function create(moduleName, filePath, symbolTable) {
235
237
  const newModuleType = {
236
- category: 7 /* Module */,
238
+ category: 7 /* TypeCategory.Module */,
237
239
  fields: symbolTable || new Map(),
238
240
  loaderFields: new Map(),
239
- flags: 1 /* Instantiable */ | 1 /* Instantiable */,
241
+ flags: 1 /* TypeFlags.Instantiable */ | 1 /* TypeFlags.Instantiable */,
240
242
  moduleName,
241
243
  filePath,
242
244
  };
@@ -265,7 +267,7 @@ var ModuleType;
265
267
  return symbol;
266
268
  }
267
269
  ModuleType.getField = getField;
268
- })(ModuleType = exports.ModuleType || (exports.ModuleType = {}));
270
+ })(ModuleType || (exports.ModuleType = ModuleType = {}));
269
271
  var ClassTypeFlags;
270
272
  (function (ClassTypeFlags) {
271
273
  ClassTypeFlags[ClassTypeFlags["None"] = 0] = "None";
@@ -346,12 +348,12 @@ var ClassTypeFlags;
346
348
  ClassTypeFlags[ClassTypeFlags["SynthesizeDataClassUnsafeHash"] = 67108864] = "SynthesizeDataClassUnsafeHash";
347
349
  // Decorated with @type_check_only.
348
350
  ClassTypeFlags[ClassTypeFlags["TypeCheckOnly"] = 134217728] = "TypeCheckOnly";
349
- })(ClassTypeFlags = exports.ClassTypeFlags || (exports.ClassTypeFlags = {}));
351
+ })(ClassTypeFlags || (exports.ClassTypeFlags = ClassTypeFlags = {}));
350
352
  var ClassType;
351
353
  (function (ClassType) {
352
354
  function createInstantiable(name, fullName, moduleName, filePath, flags, typeSourceId, declaredMetaclass, effectiveMetaclass, docString) {
353
355
  const newClass = {
354
- category: 6 /* Class */,
356
+ category: 6 /* TypeCategory.Class */,
355
357
  details: {
356
358
  name,
357
359
  fullName,
@@ -367,7 +369,7 @@ var ClassType;
367
369
  typeParameters: [],
368
370
  docString,
369
371
  },
370
- flags: 1 /* Instantiable */,
372
+ flags: 1 /* TypeFlags.Instantiable */,
371
373
  };
372
374
  return newClass;
373
375
  }
@@ -381,7 +383,7 @@ var ClassType;
381
383
  return type.cached.typeBaseInstanceType;
382
384
  }
383
385
  const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ includeSubclasses);
384
- newInstance.flags &= ~8 /* SpecialForm */;
386
+ newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
385
387
  if (includeSubclasses) {
386
388
  newInstance.includeSubclasses = true;
387
389
  }
@@ -394,7 +396,7 @@ var ClassType;
394
396
  return type.cached.typeBaseInstantiableType;
395
397
  }
396
398
  const newInstance = TypeBase.cloneTypeAsInstantiable(type, includeSubclasses);
397
- newInstance.flags &= ~8 /* SpecialForm */;
399
+ newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
398
400
  if (includeSubclasses) {
399
401
  newInstance.includeSubclasses = true;
400
402
  }
@@ -572,7 +574,7 @@ var ClassType;
572
574
  }
573
575
  ClassType.isUnspecialized = isUnspecialized;
574
576
  function isSpecialBuiltIn(classType, className) {
575
- if (!(classType.details.flags & 2 /* SpecialBuiltIn */) && !classType.aliasName) {
577
+ if (!(classType.details.flags & 2 /* ClassTypeFlags.SpecialBuiltIn */) && !classType.aliasName) {
576
578
  return false;
577
579
  }
578
580
  if (className !== undefined) {
@@ -582,7 +584,7 @@ var ClassType;
582
584
  }
583
585
  ClassType.isSpecialBuiltIn = isSpecialBuiltIn;
584
586
  function isBuiltIn(classType, className) {
585
- if (!(classType.details.flags & 1 /* BuiltInClass */)) {
587
+ if (!(classType.details.flags & 1 /* ClassTypeFlags.BuiltInClass */)) {
586
588
  return false;
587
589
  }
588
590
  if (className !== undefined) {
@@ -598,79 +600,79 @@ var ClassType;
598
600
  }
599
601
  ClassType.derivesFromAnyOrUnknown = derivesFromAnyOrUnknown;
600
602
  function supportsAbstractMethods(classType) {
601
- return !!(classType.details.flags & 1024 /* SupportsAbstractMethods */);
603
+ return !!(classType.details.flags & 1024 /* ClassTypeFlags.SupportsAbstractMethods */);
602
604
  }
603
605
  ClassType.supportsAbstractMethods = supportsAbstractMethods;
604
606
  function isDataClass(classType) {
605
- return !!(classType.details.flags & 4 /* DataClass */);
607
+ return !!(classType.details.flags & 4 /* ClassTypeFlags.DataClass */);
606
608
  }
607
609
  ClassType.isDataClass = isDataClass;
608
610
  function isSkipSynthesizedDataClassInit(classType) {
609
- return !!(classType.details.flags & 16 /* SkipSynthesizedDataClassInit */);
611
+ return !!(classType.details.flags & 16 /* ClassTypeFlags.SkipSynthesizedDataClassInit */);
610
612
  }
611
613
  ClassType.isSkipSynthesizedDataClassInit = isSkipSynthesizedDataClassInit;
612
614
  function isSkipSynthesizedDataClassEq(classType) {
613
- return !!(classType.details.flags & 32 /* SkipSynthesizedDataClassEq */);
615
+ return !!(classType.details.flags & 32 /* ClassTypeFlags.SkipSynthesizedDataClassEq */);
614
616
  }
615
617
  ClassType.isSkipSynthesizedDataClassEq = isSkipSynthesizedDataClassEq;
616
618
  function isFrozenDataClass(classType) {
617
- return !!(classType.details.flags & 8 /* FrozenDataClass */);
619
+ return !!(classType.details.flags & 8 /* ClassTypeFlags.FrozenDataClass */);
618
620
  }
619
621
  ClassType.isFrozenDataClass = isFrozenDataClass;
620
622
  function isSynthesizedDataclassOrder(classType) {
621
- return !!(classType.details.flags & 64 /* SynthesizedDataClassOrder */);
623
+ return !!(classType.details.flags & 64 /* ClassTypeFlags.SynthesizedDataClassOrder */);
622
624
  }
623
625
  ClassType.isSynthesizedDataclassOrder = isSynthesizedDataclassOrder;
624
626
  function isDataClassKeywordOnlyParams(classType) {
625
- return !!(classType.details.flags & 2097152 /* DataClassKeywordOnlyParams */);
627
+ return !!(classType.details.flags & 2097152 /* ClassTypeFlags.DataClassKeywordOnlyParams */);
626
628
  }
627
629
  ClassType.isDataClassKeywordOnlyParams = isDataClassKeywordOnlyParams;
628
630
  function isGeneratedDataClassSlots(classType) {
629
- return !!(classType.details.flags & 33554432 /* GenerateDataClassSlots */);
631
+ return !!(classType.details.flags & 33554432 /* ClassTypeFlags.GenerateDataClassSlots */);
630
632
  }
631
633
  ClassType.isGeneratedDataClassSlots = isGeneratedDataClassSlots;
632
634
  function isSynthesizeDataClassUnsafeHash(classType) {
633
- return !!(classType.details.flags & 67108864 /* SynthesizeDataClassUnsafeHash */);
635
+ return !!(classType.details.flags & 67108864 /* ClassTypeFlags.SynthesizeDataClassUnsafeHash */);
634
636
  }
635
637
  ClassType.isSynthesizeDataClassUnsafeHash = isSynthesizeDataClassUnsafeHash;
636
638
  function isTypeCheckOnly(classType) {
637
- return !!(classType.details.flags & 134217728 /* TypeCheckOnly */);
639
+ return !!(classType.details.flags & 134217728 /* ClassTypeFlags.TypeCheckOnly */);
638
640
  }
639
641
  ClassType.isTypeCheckOnly = isTypeCheckOnly;
640
642
  function isTypedDictClass(classType) {
641
- return !!(classType.details.flags & 128 /* TypedDictClass */);
643
+ return !!(classType.details.flags & 128 /* ClassTypeFlags.TypedDictClass */);
642
644
  }
643
645
  ClassType.isTypedDictClass = isTypedDictClass;
644
646
  function isCanOmitDictValues(classType) {
645
- return !!(classType.details.flags & 256 /* CanOmitDictValues */);
647
+ return !!(classType.details.flags & 256 /* ClassTypeFlags.CanOmitDictValues */);
646
648
  }
647
649
  ClassType.isCanOmitDictValues = isCanOmitDictValues;
648
650
  function isEnumClass(classType) {
649
- return !!(classType.details.flags & 1048576 /* EnumClass */);
651
+ return !!(classType.details.flags & 1048576 /* ClassTypeFlags.EnumClass */);
650
652
  }
651
653
  ClassType.isEnumClass = isEnumClass;
652
654
  function isPropertyClass(classType) {
653
- return !!(classType.details.flags & 2048 /* PropertyClass */);
655
+ return !!(classType.details.flags & 2048 /* ClassTypeFlags.PropertyClass */);
654
656
  }
655
657
  ClassType.isPropertyClass = isPropertyClass;
656
658
  function isClassProperty(classType) {
657
- return !!(classType.details.flags & 4194304 /* ClassProperty */);
659
+ return !!(classType.details.flags & 4194304 /* ClassTypeFlags.ClassProperty */);
658
660
  }
659
661
  ClassType.isClassProperty = isClassProperty;
660
662
  function isFinal(classType) {
661
- return !!(classType.details.flags & 4096 /* Final */);
663
+ return !!(classType.details.flags & 4096 /* ClassTypeFlags.Final */);
662
664
  }
663
665
  ClassType.isFinal = isFinal;
664
666
  function isProtocolClass(classType) {
665
- return !!(classType.details.flags & 8192 /* ProtocolClass */);
667
+ return !!(classType.details.flags & 8192 /* ClassTypeFlags.ProtocolClass */);
666
668
  }
667
669
  ClassType.isProtocolClass = isProtocolClass;
668
670
  function isDefinedInStub(classType) {
669
- return !!(classType.details.flags & 8388608 /* DefinedInStub */);
671
+ return !!(classType.details.flags & 8388608 /* ClassTypeFlags.DefinedInStub */);
670
672
  }
671
673
  ClassType.isDefinedInStub = isDefinedInStub;
672
674
  function isPseudoGenericClass(classType) {
673
- return !!(classType.details.flags & 16384 /* PseudoGenericClass */);
675
+ return !!(classType.details.flags & 16384 /* ClassTypeFlags.PseudoGenericClass */);
674
676
  }
675
677
  ClassType.isPseudoGenericClass = isPseudoGenericClass;
676
678
  function getDataClassEntries(classType) {
@@ -678,27 +680,27 @@ var ClassType;
678
680
  }
679
681
  ClassType.getDataClassEntries = getDataClassEntries;
680
682
  function isRuntimeCheckable(classType) {
681
- return !!(classType.details.flags & 32768 /* RuntimeCheckable */);
683
+ return !!(classType.details.flags & 32768 /* ClassTypeFlags.RuntimeCheckable */);
682
684
  }
683
685
  ClassType.isRuntimeCheckable = isRuntimeCheckable;
684
686
  function isTypingExtensionClass(classType) {
685
- return !!(classType.details.flags & 65536 /* TypingExtensionClass */);
687
+ return !!(classType.details.flags & 65536 /* ClassTypeFlags.TypingExtensionClass */);
686
688
  }
687
689
  ClassType.isTypingExtensionClass = isTypingExtensionClass;
688
690
  function isPartiallyEvaluated(classType) {
689
- return !!(classType.details.flags & 131072 /* PartiallyEvaluated */);
691
+ return !!(classType.details.flags & 131072 /* ClassTypeFlags.PartiallyEvaluated */);
690
692
  }
691
693
  ClassType.isPartiallyEvaluated = isPartiallyEvaluated;
692
694
  function hasCustomClassGetItem(classType) {
693
- return !!(classType.details.flags & 262144 /* HasCustomClassGetItem */);
695
+ return !!(classType.details.flags & 262144 /* ClassTypeFlags.HasCustomClassGetItem */);
694
696
  }
695
697
  ClassType.hasCustomClassGetItem = hasCustomClassGetItem;
696
698
  function isTupleClass(classType) {
697
- return !!(classType.details.flags & 524288 /* TupleClass */);
699
+ return !!(classType.details.flags & 524288 /* ClassTypeFlags.TupleClass */);
698
700
  }
699
701
  ClassType.isTupleClass = isTupleClass;
700
702
  function isReadOnlyInstanceVariables(classType) {
701
- return !!(classType.details.flags & 16777216 /* ReadOnlyInstanceVariables */);
703
+ return !!(classType.details.flags & 16777216 /* ClassTypeFlags.ReadOnlyInstanceVariables */);
702
704
  }
703
705
  ClassType.isReadOnlyInstanceVariables = isReadOnlyInstanceVariables;
704
706
  function getTypeParameters(classType) {
@@ -829,15 +831,15 @@ var ClassType;
829
831
  return classType.details.mro.slice(0).reverse();
830
832
  }
831
833
  ClassType.getReverseMro = getReverseMro;
832
- })(ClassType = exports.ClassType || (exports.ClassType = {}));
834
+ })(ClassType || (exports.ClassType = ClassType = {}));
833
835
  function isPositionOnlySeparator(param) {
834
836
  // A simple parameter with no name is treated as a "/" separator.
835
- return param.category === 0 /* Simple */ && !param.name;
837
+ return param.category === 0 /* ParameterCategory.Simple */ && !param.name;
836
838
  }
837
839
  exports.isPositionOnlySeparator = isPositionOnlySeparator;
838
840
  function isKeywordOnlySeparator(param) {
839
841
  // An *args parameter with no name is treated as a "*" separator.
840
- return param.category === 1 /* ArgsList */ && !param.name;
842
+ return param.category === 1 /* ParameterCategory.ArgsList */ && !param.name;
841
843
  }
842
844
  exports.isKeywordOnlySeparator = isKeywordOnlySeparator;
843
845
  var FunctionTypeFlags;
@@ -891,24 +893,24 @@ var FunctionTypeFlags;
891
893
  FunctionTypeFlags[FunctionTypeFlags["PartiallyEvaluated"] = 131072] = "PartiallyEvaluated";
892
894
  // Decorated with @override as defined in PEP 698.
893
895
  FunctionTypeFlags[FunctionTypeFlags["Overridden"] = 262144] = "Overridden";
894
- })(FunctionTypeFlags = exports.FunctionTypeFlags || (exports.FunctionTypeFlags = {}));
896
+ })(FunctionTypeFlags || (exports.FunctionTypeFlags = FunctionTypeFlags = {}));
895
897
  var FunctionType;
896
898
  (function (FunctionType) {
897
899
  function createInstance(name, fullName, moduleName, functionFlags, docString) {
898
- return create(name, fullName, moduleName, functionFlags, 2 /* Instance */, docString);
900
+ return create(name, fullName, moduleName, functionFlags, 2 /* TypeFlags.Instance */, docString);
899
901
  }
900
902
  FunctionType.createInstance = createInstance;
901
903
  function createInstantiable(functionFlags, docString) {
902
- return create('', '', '', functionFlags, 1 /* Instantiable */, docString);
904
+ return create('', '', '', functionFlags, 1 /* TypeFlags.Instantiable */, docString);
903
905
  }
904
906
  FunctionType.createInstantiable = createInstantiable;
905
- function createSynthesizedInstance(name, additionalFlags = 0 /* None */) {
906
- return create(name, '', '', additionalFlags | 64 /* SynthesizedMethod */, 2 /* Instance */);
907
+ function createSynthesizedInstance(name, additionalFlags = 0 /* FunctionTypeFlags.None */) {
908
+ return create(name, '', '', additionalFlags | 64 /* FunctionTypeFlags.SynthesizedMethod */, 2 /* TypeFlags.Instance */);
907
909
  }
908
910
  FunctionType.createSynthesizedInstance = createSynthesizedInstance;
909
911
  function create(name, fullName, moduleName, functionFlags, typeFlags, docString) {
910
912
  const newFunctionType = {
911
- category: 4 /* Function */,
913
+ category: 4 /* TypeCategory.Function */,
912
914
  details: {
913
915
  name,
914
916
  fullName,
@@ -932,7 +934,7 @@ var FunctionType;
932
934
  newFunction.preBoundFlags = newFunction.details.flags;
933
935
  if (stripFirstParam) {
934
936
  if (type.details.parameters.length > 0) {
935
- if (type.details.parameters[0].category === 0 /* Simple */) {
937
+ if (type.details.parameters[0].category === 0 /* ParameterCategory.Simple */) {
936
938
  if (type.details.parameters.length > 0 && !type.details.parameters[0].isTypeInferred) {
937
939
  // Stash away the effective type of the first parameter if it
938
940
  // wasn't synthesized.
@@ -946,8 +948,8 @@ var FunctionType;
946
948
  }
947
949
  // If we strip off the first parameter, this is no longer an
948
950
  // instance method or class method.
949
- newFunction.details.flags &= ~(1 /* ConstructorMethod */ | 2 /* ClassMethod */);
950
- newFunction.details.flags |= 4 /* StaticMethod */;
951
+ newFunction.details.flags &= ~(1 /* FunctionTypeFlags.ConstructorMethod */ | 2 /* FunctionTypeFlags.ClassMethod */);
952
+ newFunction.details.flags |= 4 /* FunctionTypeFlags.StaticMethod */;
951
953
  }
952
954
  if (type.typeAliasInfo !== undefined) {
953
955
  newFunction.typeAliasInfo = type.typeAliasInfo;
@@ -974,7 +976,7 @@ var FunctionType;
974
976
  return type.cached.typeBaseInstanceType;
975
977
  }
976
978
  const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ true);
977
- newInstance.flags &= ~8 /* SpecialForm */;
979
+ newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
978
980
  return newInstance;
979
981
  }
980
982
  FunctionType.cloneAsInstance = cloneAsInstance;
@@ -984,7 +986,7 @@ var FunctionType;
984
986
  return type.cached.typeBaseInstantiableType;
985
987
  }
986
988
  const newInstance = TypeBase.cloneTypeAsInstantiable(type, /* cache */ true);
987
- newInstance.flags &= ~8 /* SpecialForm */;
989
+ newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
988
990
  return newInstance;
989
991
  }
990
992
  FunctionType.cloneAsInstantiable = cloneAsInstantiable;
@@ -1036,14 +1038,14 @@ var FunctionType;
1036
1038
  }
1037
1039
  newFunction.details.flags =
1038
1040
  (paramSpecValue.details.flags &
1039
- (2 /* ClassMethod */ |
1040
- 4 /* StaticMethod */ |
1041
- 1 /* ConstructorMethod */ |
1042
- 256 /* Overloaded */ |
1043
- 32768 /* SkipArgsKwargsCompatibilityCheck */)) |
1044
- 64 /* SynthesizedMethod */;
1041
+ (2 /* FunctionTypeFlags.ClassMethod */ |
1042
+ 4 /* FunctionTypeFlags.StaticMethod */ |
1043
+ 1 /* FunctionTypeFlags.ConstructorMethod */ |
1044
+ 256 /* FunctionTypeFlags.Overloaded */ |
1045
+ 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */)) |
1046
+ 64 /* FunctionTypeFlags.SynthesizedMethod */;
1045
1047
  if (FunctionType.isParamSpecValue(type)) {
1046
- newFunction.details.flags |= 65536 /* ParamSpecValue */;
1048
+ newFunction.details.flags |= 65536 /* FunctionTypeFlags.ParamSpecValue */;
1047
1049
  }
1048
1050
  // Update the specialized parameter types as well.
1049
1051
  if (type.specializedTypes) {
@@ -1116,9 +1118,9 @@ var FunctionType;
1116
1118
  newFunction.specializedTypes.parameterTypes = newFunction.specializedTypes.parameterTypes.slice(0, newFunction.specializedTypes.parameterTypes.length - 2);
1117
1119
  }
1118
1120
  // Update the flags of the function.
1119
- newFunction.details.flags &= ~32768 /* SkipArgsKwargsCompatibilityCheck */;
1120
- if (paramSpecValue.details.flags & 32768 /* SkipArgsKwargsCompatibilityCheck */) {
1121
- newFunction.details.flags |= 32768 /* SkipArgsKwargsCompatibilityCheck */;
1121
+ newFunction.details.flags &= ~32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */;
1122
+ if (paramSpecValue.details.flags & 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */) {
1123
+ newFunction.details.flags |= 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */;
1122
1124
  }
1123
1125
  // If there is a position-only separator in the captured param spec signature,
1124
1126
  // remove the position-only separator in the existing signature. Otherwise,
@@ -1185,13 +1187,13 @@ var FunctionType;
1185
1187
  function getDefaultParameters(useUnknown = false) {
1186
1188
  return [
1187
1189
  {
1188
- category: 1 /* ArgsList */,
1190
+ category: 1 /* ParameterCategory.ArgsList */,
1189
1191
  name: 'args',
1190
1192
  type: useUnknown ? UnknownType.create() : AnyType.create(),
1191
1193
  hasDeclaredType: !useUnknown,
1192
1194
  },
1193
1195
  {
1194
- category: 2 /* KwargsDict */,
1196
+ category: 2 /* ParameterCategory.KwargsDict */,
1195
1197
  name: 'kwargs',
1196
1198
  type: useUnknown ? UnknownType.create() : AnyType.create(),
1197
1199
  hasDeclaredType: !useUnknown,
@@ -1209,13 +1211,13 @@ var FunctionType;
1209
1211
  if (!param.name) {
1210
1212
  continue;
1211
1213
  }
1212
- if (param.category === 0 /* Simple */) {
1214
+ if (param.category === 0 /* ParameterCategory.Simple */) {
1213
1215
  return false;
1214
1216
  }
1215
- else if (param.category === 1 /* ArgsList */) {
1217
+ else if (param.category === 1 /* ParameterCategory.ArgsList */) {
1216
1218
  sawArgs = true;
1217
1219
  }
1218
- else if (param.category === 2 /* KwargsDict */) {
1220
+ else if (param.category === 2 /* ParameterCategory.KwargsDict */) {
1219
1221
  sawKwargs = true;
1220
1222
  }
1221
1223
  if (!isAnyOrUnknown(FunctionType.getEffectiveParameterType(functionType, i))) {
@@ -1227,82 +1229,82 @@ var FunctionType;
1227
1229
  FunctionType.hasDefaultParameters = hasDefaultParameters;
1228
1230
  function isInstanceMethod(type) {
1229
1231
  return ((type.details.flags &
1230
- (1 /* ConstructorMethod */ |
1231
- 4 /* StaticMethod */ |
1232
- 2 /* ClassMethod */)) ===
1232
+ (1 /* FunctionTypeFlags.ConstructorMethod */ |
1233
+ 4 /* FunctionTypeFlags.StaticMethod */ |
1234
+ 2 /* FunctionTypeFlags.ClassMethod */)) ===
1233
1235
  0);
1234
1236
  }
1235
1237
  FunctionType.isInstanceMethod = isInstanceMethod;
1236
1238
  function isConstructorMethod(type) {
1237
- return (type.details.flags & 1 /* ConstructorMethod */) !== 0;
1239
+ return (type.details.flags & 1 /* FunctionTypeFlags.ConstructorMethod */) !== 0;
1238
1240
  }
1239
1241
  FunctionType.isConstructorMethod = isConstructorMethod;
1240
1242
  function isStaticMethod(type) {
1241
- return (type.details.flags & 4 /* StaticMethod */) !== 0;
1243
+ return (type.details.flags & 4 /* FunctionTypeFlags.StaticMethod */) !== 0;
1242
1244
  }
1243
1245
  FunctionType.isStaticMethod = isStaticMethod;
1244
1246
  function isClassMethod(type) {
1245
- return (type.details.flags & 2 /* ClassMethod */) !== 0;
1247
+ return (type.details.flags & 2 /* FunctionTypeFlags.ClassMethod */) !== 0;
1246
1248
  }
1247
1249
  FunctionType.isClassMethod = isClassMethod;
1248
1250
  function isAbstractMethod(type) {
1249
- return (type.details.flags & 8 /* AbstractMethod */) !== 0;
1251
+ return (type.details.flags & 8 /* FunctionTypeFlags.AbstractMethod */) !== 0;
1250
1252
  }
1251
1253
  FunctionType.isAbstractMethod = isAbstractMethod;
1252
1254
  function isGenerator(type) {
1253
- return (type.details.flags & 16 /* Generator */) !== 0;
1255
+ return (type.details.flags & 16 /* FunctionTypeFlags.Generator */) !== 0;
1254
1256
  }
1255
1257
  FunctionType.isGenerator = isGenerator;
1256
1258
  function isSynthesizedMethod(type) {
1257
- return (type.details.flags & 64 /* SynthesizedMethod */) !== 0;
1259
+ return (type.details.flags & 64 /* FunctionTypeFlags.SynthesizedMethod */) !== 0;
1258
1260
  }
1259
1261
  FunctionType.isSynthesizedMethod = isSynthesizedMethod;
1260
1262
  function isTypeCheckOnly(type) {
1261
- return (type.details.flags & 128 /* TypeCheckOnly */) !== 0;
1263
+ return (type.details.flags & 128 /* FunctionTypeFlags.TypeCheckOnly */) !== 0;
1262
1264
  }
1263
1265
  FunctionType.isTypeCheckOnly = isTypeCheckOnly;
1264
1266
  function isOverloaded(type) {
1265
- return (type.details.flags & 256 /* Overloaded */) !== 0;
1267
+ return (type.details.flags & 256 /* FunctionTypeFlags.Overloaded */) !== 0;
1266
1268
  }
1267
1269
  FunctionType.isOverloaded = isOverloaded;
1268
1270
  function isDefaultParameterCheckDisabled(type) {
1269
- return (type.details.flags & 32 /* DisableDefaultChecks */) !== 0;
1271
+ return (type.details.flags & 32 /* FunctionTypeFlags.DisableDefaultChecks */) !== 0;
1270
1272
  }
1271
1273
  FunctionType.isDefaultParameterCheckDisabled = isDefaultParameterCheckDisabled;
1272
1274
  function isAsync(type) {
1273
- return (type.details.flags & 512 /* Async */) !== 0;
1275
+ return (type.details.flags & 512 /* FunctionTypeFlags.Async */) !== 0;
1274
1276
  }
1275
1277
  FunctionType.isAsync = isAsync;
1276
1278
  function isStubDefinition(type) {
1277
- return (type.details.flags & 2048 /* StubDefinition */) !== 0;
1279
+ return (type.details.flags & 2048 /* FunctionTypeFlags.StubDefinition */) !== 0;
1278
1280
  }
1279
1281
  FunctionType.isStubDefinition = isStubDefinition;
1280
1282
  function isPyTypedDefinition(type) {
1281
- return (type.details.flags & 4096 /* PyTypedDefinition */) !== 0;
1283
+ return (type.details.flags & 4096 /* FunctionTypeFlags.PyTypedDefinition */) !== 0;
1282
1284
  }
1283
1285
  FunctionType.isPyTypedDefinition = isPyTypedDefinition;
1284
1286
  function isFinal(type) {
1285
- return (type.details.flags & 8192 /* Final */) !== 0;
1287
+ return (type.details.flags & 8192 /* FunctionTypeFlags.Final */) !== 0;
1286
1288
  }
1287
1289
  FunctionType.isFinal = isFinal;
1288
1290
  function hasUnannotatedParams(type) {
1289
- return (type.details.flags & 16384 /* UnannotatedParams */) !== 0;
1291
+ return (type.details.flags & 16384 /* FunctionTypeFlags.UnannotatedParams */) !== 0;
1290
1292
  }
1291
1293
  FunctionType.hasUnannotatedParams = hasUnannotatedParams;
1292
1294
  function shouldSkipArgsKwargsCompatibilityCheck(type) {
1293
- return (type.details.flags & 32768 /* SkipArgsKwargsCompatibilityCheck */) !== 0;
1295
+ return (type.details.flags & 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */) !== 0;
1294
1296
  }
1295
1297
  FunctionType.shouldSkipArgsKwargsCompatibilityCheck = shouldSkipArgsKwargsCompatibilityCheck;
1296
1298
  function isParamSpecValue(type) {
1297
- return (type.details.flags & 65536 /* ParamSpecValue */) !== 0;
1299
+ return (type.details.flags & 65536 /* FunctionTypeFlags.ParamSpecValue */) !== 0;
1298
1300
  }
1299
1301
  FunctionType.isParamSpecValue = isParamSpecValue;
1300
1302
  function isPartiallyEvaluated(type) {
1301
- return !!(type.details.flags & 131072 /* PartiallyEvaluated */);
1303
+ return !!(type.details.flags & 131072 /* FunctionTypeFlags.PartiallyEvaluated */);
1302
1304
  }
1303
1305
  FunctionType.isPartiallyEvaluated = isPartiallyEvaluated;
1304
1306
  function isOverridden(type) {
1305
- return !!(type.details.flags & 262144 /* Overridden */);
1307
+ return !!(type.details.flags & 262144 /* FunctionTypeFlags.Overridden */);
1306
1308
  }
1307
1309
  FunctionType.isOverridden = isOverridden;
1308
1310
  function getEffectiveParameterType(type, index) {
@@ -1346,14 +1348,14 @@ var FunctionType;
1346
1348
  return undefined;
1347
1349
  }
1348
1350
  FunctionType.getSpecializedReturnType = getSpecializedReturnType;
1349
- })(FunctionType = exports.FunctionType || (exports.FunctionType = {}));
1351
+ })(FunctionType || (exports.FunctionType = FunctionType = {}));
1350
1352
  var OverloadedFunctionType;
1351
1353
  (function (OverloadedFunctionType) {
1352
1354
  function create(overloads) {
1353
1355
  const newType = {
1354
- category: 5 /* OverloadedFunction */,
1356
+ category: 5 /* TypeCategory.OverloadedFunction */,
1355
1357
  overloads: [],
1356
- flags: 2 /* Instance */,
1358
+ flags: 2 /* TypeFlags.Instance */,
1357
1359
  };
1358
1360
  overloads.forEach((overload) => {
1359
1361
  OverloadedFunctionType.addOverload(newType, overload);
@@ -1375,17 +1377,17 @@ var OverloadedFunctionType;
1375
1377
  return type.overloads.find((func) => !FunctionType.isOverloaded(func));
1376
1378
  }
1377
1379
  OverloadedFunctionType.getImplementation = getImplementation;
1378
- })(OverloadedFunctionType = exports.OverloadedFunctionType || (exports.OverloadedFunctionType = {}));
1380
+ })(OverloadedFunctionType || (exports.OverloadedFunctionType = OverloadedFunctionType = {}));
1379
1381
  var NeverType;
1380
1382
  (function (NeverType) {
1381
1383
  const _neverInstance = {
1382
- category: 3 /* Never */,
1383
- flags: 2 /* Instance */ | 1 /* Instantiable */,
1384
+ category: 3 /* TypeCategory.Never */,
1385
+ flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
1384
1386
  isNoReturn: false,
1385
1387
  };
1386
1388
  const _noReturnInstance = {
1387
- category: 3 /* Never */,
1388
- flags: 2 /* Instance */ | 1 /* Instantiable */,
1389
+ category: 3 /* TypeCategory.Never */,
1390
+ flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
1389
1391
  isNoReturn: true,
1390
1392
  };
1391
1393
  function createNever() {
@@ -1396,23 +1398,23 @@ var NeverType;
1396
1398
  return _noReturnInstance;
1397
1399
  }
1398
1400
  NeverType.createNoReturn = createNoReturn;
1399
- })(NeverType = exports.NeverType || (exports.NeverType = {}));
1401
+ })(NeverType || (exports.NeverType = NeverType = {}));
1400
1402
  var AnyType;
1401
1403
  (function (AnyType) {
1402
1404
  const _anyInstanceSpecialForm = {
1403
- category: 2 /* Any */,
1405
+ category: 2 /* TypeCategory.Any */,
1404
1406
  isEllipsis: false,
1405
- flags: 2 /* Instance */ | 1 /* Instantiable */ | 8 /* SpecialForm */,
1407
+ flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */ | 8 /* TypeFlags.SpecialForm */,
1406
1408
  };
1407
1409
  const _anyInstance = {
1408
- category: 2 /* Any */,
1410
+ category: 2 /* TypeCategory.Any */,
1409
1411
  isEllipsis: false,
1410
- flags: 2 /* Instance */ | 1 /* Instantiable */,
1412
+ flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
1411
1413
  };
1412
1414
  const _ellipsisInstance = {
1413
- category: 2 /* Any */,
1415
+ category: 2 /* TypeCategory.Any */,
1414
1416
  isEllipsis: true,
1415
- flags: 2 /* Instance */ | 1 /* Instantiable */,
1417
+ flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
1416
1418
  };
1417
1419
  function create(isEllipsis = false) {
1418
1420
  return isEllipsis ? _ellipsisInstance : _anyInstance;
@@ -1422,7 +1424,7 @@ var AnyType;
1422
1424
  return _anyInstanceSpecialForm;
1423
1425
  }
1424
1426
  AnyType.createSpecialForm = createSpecialForm;
1425
- })(AnyType = exports.AnyType || (exports.AnyType = {}));
1427
+ })(AnyType || (exports.AnyType = AnyType = {}));
1426
1428
  (function (AnyType) {
1427
1429
  function convertToInstance(type) {
1428
1430
  // Remove the "special form" flag if it's set. Otherwise
@@ -1433,7 +1435,7 @@ var AnyType;
1433
1435
  return type;
1434
1436
  }
1435
1437
  AnyType.convertToInstance = convertToInstance;
1436
- })(AnyType = exports.AnyType || (exports.AnyType = {}));
1438
+ })(AnyType || (exports.AnyType = AnyType = {}));
1437
1439
  var TypeCondition;
1438
1440
  (function (TypeCondition) {
1439
1441
  function combine(conditions1, conditions2) {
@@ -1504,14 +1506,14 @@ var TypeCondition;
1504
1506
  return true;
1505
1507
  }
1506
1508
  TypeCondition.isCompatible = isCompatible;
1507
- })(TypeCondition = exports.TypeCondition || (exports.TypeCondition = {}));
1509
+ })(TypeCondition || (exports.TypeCondition = TypeCondition = {}));
1508
1510
  var UnionType;
1509
1511
  (function (UnionType) {
1510
1512
  function create() {
1511
1513
  const newUnionType = {
1512
- category: 8 /* Union */,
1514
+ category: 8 /* TypeCategory.Union */,
1513
1515
  subtypes: [],
1514
- flags: 2 /* Instance */ | 1 /* Instantiable */,
1516
+ flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
1515
1517
  };
1516
1518
  return newUnionType;
1517
1519
  }
@@ -1582,7 +1584,7 @@ var UnionType;
1582
1584
  }
1583
1585
  UnionType.containsType = containsType;
1584
1586
  function addTypeAliasSource(unionType, typeAliasSource) {
1585
- if (typeAliasSource.category === 8 /* Union */) {
1587
+ if (typeAliasSource.category === 8 /* TypeCategory.Union */) {
1586
1588
  const sourcesToAdd = typeAliasSource.typeAliasInfo ? [typeAliasSource] : typeAliasSource.typeAliasSources;
1587
1589
  if (sourcesToAdd) {
1588
1590
  if (!unionType.typeAliasSources) {
@@ -1595,7 +1597,7 @@ var UnionType;
1595
1597
  }
1596
1598
  }
1597
1599
  UnionType.addTypeAliasSource = addTypeAliasSource;
1598
- })(UnionType = exports.UnionType || (exports.UnionType = {}));
1600
+ })(UnionType || (exports.UnionType = UnionType = {}));
1599
1601
  var Variance;
1600
1602
  (function (Variance) {
1601
1603
  Variance[Variance["Auto"] = 0] = "Auto";
@@ -1603,21 +1605,21 @@ var Variance;
1603
1605
  Variance[Variance["Invariant"] = 2] = "Invariant";
1604
1606
  Variance[Variance["Covariant"] = 3] = "Covariant";
1605
1607
  Variance[Variance["Contravariant"] = 4] = "Contravariant";
1606
- })(Variance = exports.Variance || (exports.Variance = {}));
1608
+ })(Variance || (exports.Variance = Variance = {}));
1607
1609
  var TypeVarScopeType;
1608
1610
  (function (TypeVarScopeType) {
1609
1611
  TypeVarScopeType[TypeVarScopeType["Class"] = 0] = "Class";
1610
1612
  TypeVarScopeType[TypeVarScopeType["Function"] = 1] = "Function";
1611
1613
  TypeVarScopeType[TypeVarScopeType["TypeAlias"] = 2] = "TypeAlias";
1612
- })(TypeVarScopeType = exports.TypeVarScopeType || (exports.TypeVarScopeType = {}));
1614
+ })(TypeVarScopeType || (exports.TypeVarScopeType = TypeVarScopeType = {}));
1613
1615
  var TypeVarType;
1614
1616
  (function (TypeVarType) {
1615
1617
  function createInstance(name) {
1616
- return create(name, /* isParamSpec */ false, 2 /* Instance */);
1618
+ return create(name, /* isParamSpec */ false, 2 /* TypeFlags.Instance */);
1617
1619
  }
1618
1620
  TypeVarType.createInstance = createInstance;
1619
1621
  function createInstantiable(name, isParamSpec = false, runtimeClass) {
1620
- return create(name, isParamSpec, 1 /* Instantiable */, runtimeClass);
1622
+ return create(name, isParamSpec, 1 /* TypeFlags.Instantiable */, runtimeClass);
1621
1623
  }
1622
1624
  TypeVarType.createInstantiable = createInstantiable;
1623
1625
  function cloneAsInstance(type) {
@@ -1627,7 +1629,7 @@ var TypeVarType;
1627
1629
  return type.cached.typeBaseInstanceType;
1628
1630
  }
1629
1631
  const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ true);
1630
- newInstance.flags &= ~8 /* SpecialForm */;
1632
+ newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
1631
1633
  return newInstance;
1632
1634
  }
1633
1635
  TypeVarType.cloneAsInstance = cloneAsInstance;
@@ -1637,7 +1639,7 @@ var TypeVarType;
1637
1639
  return type.cached.typeBaseInstantiableType;
1638
1640
  }
1639
1641
  const newInstance = TypeBase.cloneTypeAsInstantiable(type, /* cache */ true);
1640
- newInstance.flags &= ~8 /* SpecialForm */;
1642
+ newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
1641
1643
  return newInstance;
1642
1644
  }
1643
1645
  TypeVarType.cloneAsInstantiable = cloneAsInstantiable;
@@ -1683,17 +1685,17 @@ var TypeVarType;
1683
1685
  if (type.details.isParamSpec || type.details.isVariadic) {
1684
1686
  return type;
1685
1687
  }
1686
- if (type.details.declaredVariance === 0 /* Auto */) {
1688
+ if (type.details.declaredVariance === 0 /* Variance.Auto */) {
1687
1689
  return type;
1688
1690
  }
1689
- if (type.details.declaredVariance === 2 /* Invariant */) {
1691
+ if (type.details.declaredVariance === 2 /* Variance.Invariant */) {
1690
1692
  if (type.details.boundType === undefined && type.details.constraints.length === 0) {
1691
1693
  return type;
1692
1694
  }
1693
1695
  }
1694
1696
  const newInstance = TypeBase.cloneType(type);
1695
1697
  newInstance.details = { ...newInstance.details };
1696
- newInstance.details.declaredVariance = 2 /* Invariant */;
1698
+ newInstance.details.declaredVariance = 2 /* Variance.Invariant */;
1697
1699
  newInstance.details.boundType = undefined;
1698
1700
  newInstance.details.constraints = [];
1699
1701
  return newInstance;
@@ -1738,11 +1740,11 @@ var TypeVarType;
1738
1740
  TypeVarType.makeNameWithScope = makeNameWithScope;
1739
1741
  function create(name, isParamSpec, typeFlags, runtimeClass) {
1740
1742
  const newTypeVarType = {
1741
- category: 9 /* TypeVar */,
1743
+ category: 9 /* TypeCategory.TypeVar */,
1742
1744
  details: {
1743
1745
  name,
1744
1746
  constraints: [],
1745
- declaredVariance: 2 /* Invariant */,
1747
+ declaredVariance: 2 /* Variance.Invariant */,
1746
1748
  isParamSpec,
1747
1749
  isVariadic: false,
1748
1750
  isSynthesized: false,
@@ -1772,11 +1774,11 @@ var TypeVarType;
1772
1774
  var _a;
1773
1775
  const variance = (_a = type.computedVariance) !== null && _a !== void 0 ? _a : type.details.declaredVariance;
1774
1776
  // By this point, the variance should have been inferred.
1775
- (0, debug_1.assert)(variance !== 0 /* Auto */, 'Expected variance to be inferred');
1777
+ (0, debug_1.assert)(variance !== 0 /* Variance.Auto */, 'Expected variance to be inferred');
1776
1778
  // If we're in the process of computing variance, it will still be
1777
1779
  // unknown. Default to covariant in this case.
1778
- if (variance === 1 /* Unknown */) {
1779
- return 3 /* Covariant */;
1780
+ if (variance === 1 /* Variance.Unknown */) {
1781
+ return 3 /* Variance.Covariant */;
1780
1782
  }
1781
1783
  return variance;
1782
1784
  }
@@ -1787,21 +1789,21 @@ var TypeVarType;
1787
1789
  return !!type.details.recursiveTypeAliasName && !type.details.boundType;
1788
1790
  }
1789
1791
  TypeVarType.isTypeAliasPlaceholder = isTypeAliasPlaceholder;
1790
- })(TypeVarType = exports.TypeVarType || (exports.TypeVarType = {}));
1792
+ })(TypeVarType || (exports.TypeVarType = TypeVarType = {}));
1791
1793
  function isNever(type) {
1792
- return type.category === 3 /* Never */;
1794
+ return type.category === 3 /* TypeCategory.Never */;
1793
1795
  }
1794
1796
  exports.isNever = isNever;
1795
1797
  function isAny(type) {
1796
- return type.category === 2 /* Any */;
1798
+ return type.category === 2 /* TypeCategory.Any */;
1797
1799
  }
1798
1800
  exports.isAny = isAny;
1799
1801
  function isUnknown(type) {
1800
- return type.category === 1 /* Unknown */;
1802
+ return type.category === 1 /* TypeCategory.Unknown */;
1801
1803
  }
1802
1804
  exports.isUnknown = isUnknown;
1803
1805
  function isAnyOrUnknown(type) {
1804
- if (type.category === 2 /* Any */ || type.category === 1 /* Unknown */) {
1806
+ if (type.category === 2 /* TypeCategory.Any */ || type.category === 1 /* TypeCategory.Unknown */) {
1805
1807
  return true;
1806
1808
  }
1807
1809
  if (isUnion(type)) {
@@ -1811,11 +1813,11 @@ function isAnyOrUnknown(type) {
1811
1813
  }
1812
1814
  exports.isAnyOrUnknown = isAnyOrUnknown;
1813
1815
  function isUnbound(type) {
1814
- return type.category === 0 /* Unbound */;
1816
+ return type.category === 0 /* TypeCategory.Unbound */;
1815
1817
  }
1816
1818
  exports.isUnbound = isUnbound;
1817
1819
  function isUnion(type) {
1818
- return type.category === 8 /* Union */;
1820
+ return type.category === 8 /* TypeCategory.Union */;
1819
1821
  }
1820
1822
  exports.isUnion = isUnion;
1821
1823
  function isPossiblyUnbound(type) {
@@ -1829,31 +1831,31 @@ function isPossiblyUnbound(type) {
1829
1831
  }
1830
1832
  exports.isPossiblyUnbound = isPossiblyUnbound;
1831
1833
  function isClass(type) {
1832
- return type.category === 6 /* Class */;
1834
+ return type.category === 6 /* TypeCategory.Class */;
1833
1835
  }
1834
1836
  exports.isClass = isClass;
1835
1837
  function isInstantiableClass(type) {
1836
- return type.category === 6 /* Class */ && TypeBase.isInstantiable(type);
1838
+ return type.category === 6 /* TypeCategory.Class */ && TypeBase.isInstantiable(type);
1837
1839
  }
1838
1840
  exports.isInstantiableClass = isInstantiableClass;
1839
1841
  function isClassInstance(type) {
1840
- return type.category === 6 /* Class */ && TypeBase.isInstance(type);
1842
+ return type.category === 6 /* TypeCategory.Class */ && TypeBase.isInstance(type);
1841
1843
  }
1842
1844
  exports.isClassInstance = isClassInstance;
1843
1845
  function isModule(type) {
1844
- return type.category === 7 /* Module */;
1846
+ return type.category === 7 /* TypeCategory.Module */;
1845
1847
  }
1846
1848
  exports.isModule = isModule;
1847
1849
  function isTypeVar(type) {
1848
- return type.category === 9 /* TypeVar */;
1850
+ return type.category === 9 /* TypeCategory.TypeVar */;
1849
1851
  }
1850
1852
  exports.isTypeVar = isTypeVar;
1851
1853
  function isVariadicTypeVar(type) {
1852
- return type.category === 9 /* TypeVar */ && type.details.isVariadic;
1854
+ return type.category === 9 /* TypeCategory.TypeVar */ && type.details.isVariadic;
1853
1855
  }
1854
1856
  exports.isVariadicTypeVar = isVariadicTypeVar;
1855
1857
  function isUnpackedVariadicTypeVar(type) {
1856
- return (type.category === 9 /* TypeVar */ &&
1858
+ return (type.category === 9 /* TypeCategory.TypeVar */ &&
1857
1859
  type.details.isVariadic &&
1858
1860
  !!type.isVariadicUnpacked &&
1859
1861
  !type.isVariadicInUnion);
@@ -1871,15 +1873,15 @@ function isUnpacked(type) {
1871
1873
  }
1872
1874
  exports.isUnpacked = isUnpacked;
1873
1875
  function isParamSpec(type) {
1874
- return type.category === 9 /* TypeVar */ && type.details.isParamSpec;
1876
+ return type.category === 9 /* TypeCategory.TypeVar */ && type.details.isParamSpec;
1875
1877
  }
1876
1878
  exports.isParamSpec = isParamSpec;
1877
1879
  function isFunction(type) {
1878
- return type.category === 4 /* Function */;
1880
+ return type.category === 4 /* TypeCategory.Function */;
1879
1881
  }
1880
1882
  exports.isFunction = isFunction;
1881
1883
  function isOverloadedFunction(type) {
1882
- return type.category === 5 /* OverloadedFunction */;
1884
+ return type.category === 5 /* TypeCategory.OverloadedFunction */;
1883
1885
  }
1884
1886
  exports.isOverloadedFunction = isOverloadedFunction;
1885
1887
  function getTypeAliasInfo(type) {
@@ -1905,10 +1907,10 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
1905
1907
  }
1906
1908
  if (type1.category !== type2.category) {
1907
1909
  if (options.treatAnySameAsUnknown) {
1908
- if (type1.category === 2 /* Any */ && type2.category === 1 /* Unknown */) {
1910
+ if (type1.category === 2 /* TypeCategory.Any */ && type2.category === 1 /* TypeCategory.Unknown */) {
1909
1911
  return true;
1910
1912
  }
1911
- if (type1.category === 1 /* Unknown */ && type2.category === 2 /* Any */) {
1913
+ if (type1.category === 1 /* TypeCategory.Unknown */ && type2.category === 2 /* TypeCategory.Any */) {
1912
1914
  return true;
1913
1915
  }
1914
1916
  }
@@ -1924,8 +1926,8 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
1924
1926
  }
1925
1927
  else {
1926
1928
  // By default, we don't care about the Annotated flag.
1927
- type1Flags &= ~4 /* Annotated */;
1928
- type2Flags &= ~4 /* Annotated */;
1929
+ type1Flags &= ~4 /* TypeFlags.Annotated */;
1930
+ type2Flags &= ~4 /* TypeFlags.Annotated */;
1929
1931
  }
1930
1932
  if (type1Flags !== type2Flags) {
1931
1933
  return false;
@@ -1936,7 +1938,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
1936
1938
  }
1937
1939
  recursionCount++;
1938
1940
  switch (type1.category) {
1939
- case 6 /* Class */: {
1941
+ case 6 /* TypeCategory.Class */: {
1940
1942
  const classType2 = type2;
1941
1943
  // If the details are not the same it's not the same class.
1942
1944
  if (!ClassType.isSameGenericClass(type1, classType2, recursionCount)) {
@@ -1987,7 +1989,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
1987
1989
  }
1988
1990
  return true;
1989
1991
  }
1990
- case 4 /* Function */: {
1992
+ case 4 /* TypeCategory.Function */: {
1991
1993
  // Make sure the parameter counts match.
1992
1994
  const functionType2 = type2;
1993
1995
  const params1 = type1.details.parameters;
@@ -2058,7 +2060,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
2058
2060
  }
2059
2061
  return true;
2060
2062
  }
2061
- case 5 /* OverloadedFunction */: {
2063
+ case 5 /* TypeCategory.OverloadedFunction */: {
2062
2064
  // Make sure the overload counts match.
2063
2065
  const functionType2 = type2;
2064
2066
  if (type1.overloads.length !== functionType2.overloads.length) {
@@ -2073,7 +2075,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
2073
2075
  }
2074
2076
  return true;
2075
2077
  }
2076
- case 8 /* Union */: {
2078
+ case 8 /* TypeCategory.Union */: {
2077
2079
  const unionType2 = type2;
2078
2080
  const subtypes1 = type1.subtypes;
2079
2081
  const subtypes2 = unionType2.subtypes;
@@ -2085,7 +2087,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
2085
2087
  const exclusionSet = new Set();
2086
2088
  return (findSubtype(type1, (subtype) => !UnionType.containsType(unionType2, subtype, exclusionSet, recursionCount)) === undefined);
2087
2089
  }
2088
- case 9 /* TypeVar */: {
2090
+ case 9 /* TypeCategory.TypeVar */: {
2089
2091
  const type2TypeVar = type2;
2090
2092
  if (type1.scopeId !== type2TypeVar.scopeId) {
2091
2093
  return false;
@@ -2144,7 +2146,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
2144
2146
  }
2145
2147
  return true;
2146
2148
  }
2147
- case 7 /* Module */: {
2149
+ case 7 /* TypeCategory.Module */: {
2148
2150
  const type2Module = type2;
2149
2151
  // Module types are the same if they share the same
2150
2152
  // module symbol table.
@@ -2158,7 +2160,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
2158
2160
  }
2159
2161
  return false;
2160
2162
  }
2161
- case 1 /* Unknown */: {
2163
+ case 1 /* TypeCategory.Unknown */: {
2162
2164
  const type2Unknown = type2;
2163
2165
  return type1.isIncomplete === type2Unknown.isIncomplete;
2164
2166
  }
@@ -2214,12 +2216,12 @@ exports.findSubtype = findSubtype;
2214
2216
  function combineTypes(subtypes, maxSubtypeCount) {
2215
2217
  // Filter out any "Never" and "NoReturn" types.
2216
2218
  let sawNoReturn = false;
2217
- if (subtypes.some((subtype) => subtype.category === 3 /* Never */))
2219
+ if (subtypes.some((subtype) => subtype.category === 3 /* TypeCategory.Never */))
2218
2220
  subtypes = subtypes.filter((subtype) => {
2219
- if (subtype.category === 3 /* Never */ && subtype.isNoReturn) {
2221
+ if (subtype.category === 3 /* TypeCategory.Never */ && subtype.isNoReturn) {
2220
2222
  sawNoReturn = true;
2221
2223
  }
2222
- return subtype.category !== 3 /* Never */;
2224
+ return subtype.category !== 3 /* TypeCategory.Never */;
2223
2225
  });
2224
2226
  if (subtypes.length === 0) {
2225
2227
  return sawNoReturn ? NeverType.createNoReturn() : NeverType.createNever();