@zzzen/pyright-internal 1.2.0-dev.20240128 → 1.2.0-dev.20240218

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 (572) hide show
  1. package/dist/analyzer/analysis.js +4 -1
  2. package/dist/analyzer/analysis.js.map +1 -1
  3. package/dist/analyzer/analyzerFileInfo.js.map +1 -1
  4. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  5. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  6. package/dist/analyzer/binder.js.map +1 -1
  7. package/dist/analyzer/cacheManager.js.map +1 -1
  8. package/dist/analyzer/checker.js +115 -74
  9. package/dist/analyzer/checker.js.map +1 -1
  10. package/dist/analyzer/circularDependency.js.map +1 -1
  11. package/dist/analyzer/codeFlowEngine.js +29 -3
  12. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  13. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  14. package/dist/analyzer/codeFlowUtils.js.map +1 -1
  15. package/dist/analyzer/commentUtils.js.map +1 -1
  16. package/dist/analyzer/constraintSolver.d.ts +2 -2
  17. package/dist/analyzer/constraintSolver.js +28 -6
  18. package/dist/analyzer/constraintSolver.js.map +1 -1
  19. package/dist/analyzer/constructorTransform.js.map +1 -1
  20. package/dist/analyzer/constructors.js.map +1 -1
  21. package/dist/analyzer/dataClasses.js.map +1 -1
  22. package/dist/analyzer/declaration.js.map +1 -1
  23. package/dist/analyzer/declarationUtils.js.map +1 -1
  24. package/dist/analyzer/decorators.js.map +1 -1
  25. package/dist/analyzer/deprecatedSymbols.js.map +1 -1
  26. package/dist/analyzer/docStringConversion.js.map +1 -1
  27. package/dist/analyzer/docStringUtils.js.map +1 -1
  28. package/dist/analyzer/enums.d.ts +4 -1
  29. package/dist/analyzer/enums.js +29 -15
  30. package/dist/analyzer/enums.js.map +1 -1
  31. package/dist/analyzer/functionTransform.js.map +1 -1
  32. package/dist/analyzer/importResolver.js +1 -1
  33. package/dist/analyzer/importResolver.js.map +1 -1
  34. package/dist/analyzer/importResult.js.map +1 -1
  35. package/dist/analyzer/importStatementUtils.js.map +1 -1
  36. package/dist/analyzer/namedTuples.js.map +1 -1
  37. package/dist/analyzer/operations.js +6 -0
  38. package/dist/analyzer/operations.js.map +1 -1
  39. package/dist/analyzer/packageTypeReport.js.map +1 -1
  40. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  41. package/dist/analyzer/parameterUtils.d.ts +1 -0
  42. package/dist/analyzer/parameterUtils.js +5 -1
  43. package/dist/analyzer/parameterUtils.js.map +1 -1
  44. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  45. package/dist/analyzer/parseTreeCleaner.js.map +1 -1
  46. package/dist/analyzer/parseTreeUtils.d.ts +1 -0
  47. package/dist/analyzer/parseTreeUtils.js +4 -3
  48. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  49. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  50. package/dist/analyzer/patternMatching.js +87 -58
  51. package/dist/analyzer/patternMatching.js.map +1 -1
  52. package/dist/analyzer/program.d.ts +1 -1
  53. package/dist/analyzer/program.js +2 -2
  54. package/dist/analyzer/program.js.map +1 -1
  55. package/dist/analyzer/properties.js.map +1 -1
  56. package/dist/analyzer/protocols.js.map +1 -1
  57. package/dist/analyzer/pyTypedUtils.js.map +1 -1
  58. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  59. package/dist/analyzer/regions.js.map +1 -1
  60. package/dist/analyzer/scope.js.map +1 -1
  61. package/dist/analyzer/scopeUtils.js.map +1 -1
  62. package/dist/analyzer/service.js.map +1 -1
  63. package/dist/analyzer/sourceFile.js.map +1 -1
  64. package/dist/analyzer/sourceFileInfo.js +1 -1
  65. package/dist/analyzer/sourceFileInfo.js.map +1 -1
  66. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  67. package/dist/analyzer/sourceMapper.js.map +1 -1
  68. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  69. package/dist/analyzer/staticExpressions.js.map +1 -1
  70. package/dist/analyzer/symbol.js.map +1 -1
  71. package/dist/analyzer/symbolNameUtils.js.map +1 -1
  72. package/dist/analyzer/symbolUtils.js.map +1 -1
  73. package/dist/analyzer/testWalker.js.map +1 -1
  74. package/dist/analyzer/tracePrinter.js.map +1 -1
  75. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  76. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  77. package/dist/analyzer/typeEvaluator.js +274 -237
  78. package/dist/analyzer/typeEvaluator.js.map +1 -1
  79. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  80. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  81. package/dist/analyzer/typeGuards.js +5 -0
  82. package/dist/analyzer/typeGuards.js.map +1 -1
  83. package/dist/analyzer/typePrinter.js.map +1 -1
  84. package/dist/analyzer/typeStubWriter.js.map +1 -1
  85. package/dist/analyzer/typeUtils.d.ts +0 -1
  86. package/dist/analyzer/typeUtils.js +18 -5
  87. package/dist/analyzer/typeUtils.js.map +1 -1
  88. package/dist/analyzer/typeVarContext.d.ts +2 -2
  89. package/dist/analyzer/typeVarContext.js +10 -4
  90. package/dist/analyzer/typeVarContext.js.map +1 -1
  91. package/dist/analyzer/typeWalker.js.map +1 -1
  92. package/dist/analyzer/typedDicts.js.map +1 -1
  93. package/dist/analyzer/types.d.ts +7 -3
  94. package/dist/analyzer/types.js +40 -28
  95. package/dist/analyzer/types.js.map +1 -1
  96. package/dist/backgroundAnalysis.js.map +1 -1
  97. package/dist/backgroundAnalysisBase.js.map +1 -1
  98. package/dist/backgroundThreadBase.js.map +1 -1
  99. package/dist/commands/commandController.js.map +1 -1
  100. package/dist/commands/commandResult.js.map +1 -1
  101. package/dist/commands/commands.js.map +1 -1
  102. package/dist/commands/createTypeStub.js.map +1 -1
  103. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  104. package/dist/commands/quickActionCommand.js.map +1 -1
  105. package/dist/commands/restartServer.js.map +1 -1
  106. package/dist/common/cancellationUtils.d.ts +2 -1
  107. package/dist/common/cancellationUtils.js +17 -4
  108. package/dist/common/cancellationUtils.js.map +1 -1
  109. package/dist/common/charCodes.js.map +1 -1
  110. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  111. package/dist/common/collectionUtils.js.map +1 -1
  112. package/dist/common/commandLineOptions.js.map +1 -1
  113. package/dist/common/commandUtils.js.map +1 -1
  114. package/dist/common/configOptions.js.map +1 -1
  115. package/dist/common/console.js.map +1 -1
  116. package/dist/common/core.js.map +1 -1
  117. package/dist/common/crypto.js.map +1 -1
  118. package/dist/common/debug.js.map +1 -1
  119. package/dist/common/deferred.js.map +1 -1
  120. package/dist/common/diagnostic.js.map +1 -1
  121. package/dist/common/diagnosticRules.js.map +1 -1
  122. package/dist/common/diagnosticSink.js.map +1 -1
  123. package/dist/common/editAction.js.map +1 -1
  124. package/dist/common/envVarUtils.d.ts +2 -1
  125. package/dist/common/envVarUtils.js +5 -1
  126. package/dist/common/envVarUtils.js.map +1 -1
  127. package/dist/common/extensibility.js.map +1 -1
  128. package/dist/common/extensions.js.map +1 -1
  129. package/dist/common/fileBasedCancellationUtils.js.map +1 -1
  130. package/dist/common/fileSystem.js.map +1 -1
  131. package/dist/common/fileWatcher.js.map +1 -1
  132. package/dist/common/fullAccessHost.js +1 -1
  133. package/dist/common/fullAccessHost.js.map +1 -1
  134. package/dist/common/host.js.map +1 -1
  135. package/dist/common/logTracker.js.map +1 -1
  136. package/dist/common/lspUtils.js.map +1 -1
  137. package/dist/common/memUtils.js.map +1 -1
  138. package/dist/common/pathConsts.js.map +1 -1
  139. package/dist/common/pathUtils.js.map +1 -1
  140. package/dist/common/positionUtils.js.map +1 -1
  141. package/dist/common/progressReporter.js.map +1 -1
  142. package/dist/common/pythonVersion.js.map +1 -1
  143. package/dist/common/realFileSystem.js +1 -1
  144. package/dist/common/realFileSystem.js.map +1 -1
  145. package/dist/common/serviceProvider.js.map +1 -1
  146. package/dist/common/serviceProviderExtensions.js.map +1 -1
  147. package/dist/common/stringUtils.js.map +1 -1
  148. package/dist/common/textEditTracker.js.map +1 -1
  149. package/dist/common/textRange.js.map +1 -1
  150. package/dist/common/textRangeCollection.js.map +1 -1
  151. package/dist/common/timing.js.map +1 -1
  152. package/dist/common/uri/baseUri.d.ts +2 -0
  153. package/dist/common/uri/baseUri.js +7 -7
  154. package/dist/common/uri/baseUri.js.map +1 -1
  155. package/dist/common/uri/emptyUri.d.ts +2 -0
  156. package/dist/common/uri/emptyUri.js +6 -0
  157. package/dist/common/uri/emptyUri.js.map +1 -1
  158. package/dist/common/uri/fileUri.d.ts +6 -4
  159. package/dist/common/uri/fileUri.js +18 -9
  160. package/dist/common/uri/fileUri.js.map +1 -1
  161. package/dist/common/uri/memoization.js.map +1 -1
  162. package/dist/common/uri/uri.d.ts +8 -0
  163. package/dist/common/uri/uri.js +16 -7
  164. package/dist/common/uri/uri.js.map +1 -1
  165. package/dist/common/uri/uriUtils.js.map +1 -1
  166. package/dist/common/uri/webUri.d.ts +3 -1
  167. package/dist/common/uri/webUri.js +21 -8
  168. package/dist/common/uri/webUri.js.map +1 -1
  169. package/dist/common/workspaceEditUtils.js.map +1 -1
  170. package/dist/languageServerBase.js.map +1 -1
  171. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  172. package/dist/languageService/autoImporter.js.map +1 -1
  173. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  174. package/dist/languageService/codeActionProvider.js.map +1 -1
  175. package/dist/languageService/completionProvider.js +9 -1
  176. package/dist/languageService/completionProvider.js.map +1 -1
  177. package/dist/languageService/completionProviderUtils.js.map +1 -1
  178. package/dist/languageService/definitionProvider.js.map +1 -1
  179. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  180. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  181. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  182. package/dist/languageService/hoverProvider.js.map +1 -1
  183. package/dist/languageService/importSorter.js.map +1 -1
  184. package/dist/languageService/navigationUtils.js.map +1 -1
  185. package/dist/languageService/quickActions.js.map +1 -1
  186. package/dist/languageService/referencesProvider.js +11 -1
  187. package/dist/languageService/referencesProvider.js.map +1 -1
  188. package/dist/languageService/renameProvider.js.map +1 -1
  189. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  190. package/dist/languageService/symbolIndexer.js.map +1 -1
  191. package/dist/languageService/tooltipUtils.js.map +1 -1
  192. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  193. package/dist/localization/localize.d.ts +15 -1
  194. package/dist/localization/localize.js +7 -1
  195. package/dist/localization/localize.js.map +1 -1
  196. package/dist/localization/package.nls.cs.json +15 -7
  197. package/dist/localization/package.nls.de.json +17 -9
  198. package/dist/localization/package.nls.en-us.json +7 -1
  199. package/dist/localization/package.nls.es.json +16 -8
  200. package/dist/localization/package.nls.fr.json +16 -8
  201. package/dist/localization/package.nls.it.json +16 -8
  202. package/dist/localization/package.nls.ja.json +17 -9
  203. package/dist/localization/package.nls.ko.json +14 -6
  204. package/dist/localization/package.nls.pl.json +14 -6
  205. package/dist/localization/package.nls.pt-br.json +17 -9
  206. package/dist/localization/package.nls.qps-ploc.json +12 -4
  207. package/dist/localization/package.nls.ru.json +17 -9
  208. package/dist/localization/package.nls.tr.json +16 -8
  209. package/dist/localization/package.nls.zh-cn.json +17 -9
  210. package/dist/localization/package.nls.zh-tw.json +17 -9
  211. package/dist/nodeMain.js.map +1 -1
  212. package/dist/nodeServer.js.map +1 -1
  213. package/dist/parser/characterStream.js.map +1 -1
  214. package/dist/parser/characters.js.map +1 -1
  215. package/dist/parser/parseNodes.js.map +1 -1
  216. package/dist/parser/parser.js.map +1 -1
  217. package/dist/parser/stringTokenUtils.js.map +1 -1
  218. package/dist/parser/tokenizer.js.map +1 -1
  219. package/dist/parser/tokenizerTypes.js.map +1 -1
  220. package/dist/parser/unicode.js.map +1 -1
  221. package/dist/pprof/profiler.js.map +1 -1
  222. package/dist/pyright.js.map +1 -1
  223. package/dist/pyrightFileSystem.js.map +1 -1
  224. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  225. package/dist/server.d.ts +2 -1
  226. package/dist/server.js +9 -7
  227. package/dist/server.js.map +1 -1
  228. package/dist/tests/cacheManager.test.js.map +1 -1
  229. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  230. package/dist/tests/checker.test.js.map +1 -1
  231. package/dist/tests/classDeclaration.test.js.map +1 -1
  232. package/dist/tests/collectionUtils.test.js.map +1 -1
  233. package/dist/tests/common.test.js.map +1 -1
  234. package/dist/tests/completions.test.js +23 -0
  235. package/dist/tests/completions.test.js.map +1 -1
  236. package/dist/tests/config.test.js +1 -2
  237. package/dist/tests/config.test.js.map +1 -1
  238. package/dist/tests/debug.test.js.map +1 -1
  239. package/dist/tests/deferred.test.js.map +1 -1
  240. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  241. package/dist/tests/diagnostics.test.js.map +1 -1
  242. package/dist/tests/docStringConversion.test.js.map +1 -1
  243. package/dist/tests/docStringUtils.test.js.map +1 -1
  244. package/dist/tests/documentSymbolCollector.test.js.map +1 -1
  245. package/dist/tests/envVarUtils.test.d.ts +1 -0
  246. package/dist/tests/envVarUtils.test.js +130 -0
  247. package/dist/tests/envVarUtils.test.js.map +1 -0
  248. package/dist/tests/filesystem.test.js.map +1 -1
  249. package/dist/tests/fourSlashParser.test.js.map +1 -1
  250. package/dist/tests/fourSlashRunner.test.js.map +1 -1
  251. package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -1
  252. package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -1
  253. package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js.map +1 -1
  254. package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js.map +1 -1
  255. package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -1
  256. package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -1
  257. package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -1
  258. package/dist/tests/fourslash/completions.autoimport.lib.alias.fourslash.js.map +1 -1
  259. package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -1
  260. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  261. package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -1
  262. package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -1
  263. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  264. package/dist/tests/fourslash/completions.builtinOverride.fourslash.js.map +1 -1
  265. package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -1
  266. package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
  267. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
  268. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
  269. package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
  270. package/dist/tests/fourslash/completions.comment.fourslash.js.map +1 -1
  271. package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -1
  272. package/dist/tests/fourslash/completions.declNames.exception.fourslash.js.map +1 -1
  273. package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -1
  274. package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js.map +1 -1
  275. package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -1
  276. package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -1
  277. package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -1
  278. package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -1
  279. package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -1
  280. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
  281. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
  282. package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -1
  283. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
  284. package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -1
  285. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -1
  286. package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -1
  287. package/dist/tests/fourslash/completions.enums.members.fourslash.js.map +1 -1
  288. package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -1
  289. package/dist/tests/fourslash/completions.excluded.fourslash.js.map +1 -1
  290. package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
  291. package/dist/tests/fourslash/completions.fstring.fourslash.js.map +1 -1
  292. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
  293. package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js.map +1 -1
  294. package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +1 -1
  295. package/dist/tests/fourslash/completions.importInterimFile.fourslash.disabled.js.map +1 -1
  296. package/dist/tests/fourslash/completions.importPrivateNoPytyped.fourslash.js.map +1 -1
  297. package/dist/tests/fourslash/completions.importPytyped.fourslash.js.map +1 -1
  298. package/dist/tests/fourslash/completions.importPytypedLocal.fourslash.js.map +1 -1
  299. package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +1 -1
  300. package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js.map +1 -1
  301. package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -1
  302. package/dist/tests/fourslash/completions.included.fourslash.js.map +1 -1
  303. package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -1
  304. package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js.map +1 -1
  305. package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -1
  306. package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -1
  307. package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js.map +1 -1
  308. package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js.map +1 -1
  309. package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -1
  310. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
  311. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
  312. package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
  313. package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -1
  314. package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
  315. package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js.map +1 -1
  316. package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js.map +1 -1
  317. package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js.map +1 -1
  318. package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -1
  319. package/dist/tests/fourslash/completions.override.default.fourslash.js.map +1 -1
  320. package/dist/tests/fourslash/completions.override.default.importStub.js.map +1 -1
  321. package/dist/tests/fourslash/completions.override.default.imported.fourslash.js.map +1 -1
  322. package/dist/tests/fourslash/completions.override.default.stub.fourslash.js.map +1 -1
  323. package/dist/tests/fourslash/completions.override.fourslash.js.map +1 -1
  324. package/dist/tests/fourslash/completions.override.property.fourslash.js.map +1 -1
  325. package/dist/tests/fourslash/completions.override.property.stub.fourslash.js.map +1 -1
  326. package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -1
  327. package/dist/tests/fourslash/completions.override.stub.fourslash.js.map +1 -1
  328. package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
  329. package/dist/tests/fourslash/completions.parameters.fourslash.js.map +1 -1
  330. package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -1
  331. package/dist/tests/fourslash/completions.parentFolder.fourslash.js.map +1 -1
  332. package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -1
  333. package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
  334. package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -1
  335. package/dist/tests/fourslash/completions.property.fourslash.js.map +1 -1
  336. package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js.map +1 -1
  337. package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
  338. package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -1
  339. package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
  340. package/dist/tests/fourslash/completions.triggers.fourslash.js.map +1 -1
  341. package/dist/tests/fourslash/completions.typeAlias.fourslash.js.map +1 -1
  342. package/dist/tests/fourslash/completions.typeshed.fourslash.js.map +1 -1
  343. package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -1
  344. package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -1
  345. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
  346. package/dist/tests/fourslash/completions.with.fourslash.js.map +1 -1
  347. package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -1
  348. package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -1
  349. package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -1
  350. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -1
  351. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -1
  352. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -1
  353. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -1
  354. package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -1
  355. package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -1
  356. package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -1
  357. package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -1
  358. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  359. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -1
  360. package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -1
  361. package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -1
  362. package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -1
  363. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -1
  364. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -1
  365. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -1
  366. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -1
  367. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -1
  368. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -1
  369. package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -1
  370. package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -1
  371. package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -1
  372. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -1
  373. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -1
  374. package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -1
  375. package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -1
  376. package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -1
  377. package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -1
  378. package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -1
  379. package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -1
  380. package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -1
  381. package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -1
  382. package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -1
  383. package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -1
  384. package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -1
  385. package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -1
  386. package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -1
  387. package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -1
  388. package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -1
  389. package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -1
  390. package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -1
  391. package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -1
  392. package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -1
  393. package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -1
  394. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -1
  395. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -1
  396. package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -1
  397. package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -1
  398. package/dist/tests/fourslash/fourslash.js.map +1 -1
  399. package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -1
  400. package/dist/tests/fourslash/hover.async.fourslash.js.map +1 -1
  401. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  402. package/dist/tests/fourslash/hover.class.docString.fourslash.js.map +1 -1
  403. package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -1
  404. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
  405. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
  406. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
  407. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
  408. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
  409. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
  410. package/dist/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.js.map +1 -1
  411. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
  412. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
  413. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
  414. package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
  415. package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js.map +1 -1
  416. package/dist/tests/fourslash/hover.docstring.parameter.fourslash.js.map +1 -1
  417. package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
  418. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -1
  419. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -1
  420. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -1
  421. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -1
  422. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -1
  423. package/dist/tests/fourslash/hover.formatted.fourslash.js.map +1 -1
  424. package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
  425. package/dist/tests/fourslash/hover.import.django.view.fourslash.js.map +1 -1
  426. package/dist/tests/fourslash/hover.import.fourslash.js.map +1 -1
  427. package/dist/tests/fourslash/hover.inferred.fourslash.js.map +1 -1
  428. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  429. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
  430. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  431. package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -1
  432. package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -1
  433. package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js.map +1 -1
  434. package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js.map +1 -1
  435. package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
  436. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
  437. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
  438. package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
  439. package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js.map +1 -1
  440. package/dist/tests/fourslash/hover.overloadedFunction.fourslash.js.map +1 -1
  441. package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
  442. package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -1
  443. package/dist/tests/fourslash/hover.typedDict.key.fourslash.js.map +1 -1
  444. package/dist/tests/fourslash/hover.unpackedTypedDict.key.fourslash.js.map +1 -1
  445. package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -1
  446. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
  447. package/dist/tests/fourslash/import.multipart.fourslash.js.map +1 -1
  448. package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -1
  449. package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js.map +1 -1
  450. package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js.map +1 -1
  451. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
  452. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
  453. package/dist/tests/fourslash/import.wildcard.fourslash.js.map +1 -1
  454. package/dist/tests/fourslash/importnotresolved.fourslash.js.map +1 -1
  455. package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js.map +1 -1
  456. package/dist/tests/fourslash/missingModuleSource.fourslash.js.map +1 -1
  457. package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -1
  458. package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js.map +1 -1
  459. package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js.map +1 -1
  460. package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js.map +1 -1
  461. package/dist/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.js.map +1 -1
  462. package/dist/tests/fourslash/missingTypeStub.fourslash.js.map +1 -1
  463. package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js.map +1 -1
  464. package/dist/tests/fourslash/noerrors.fourslash.js.map +1 -1
  465. package/dist/tests/fourslash/orderImports1.command.fourslash.js.map +1 -1
  466. package/dist/tests/fourslash/orderImports2.command.fourslash.js.map +1 -1
  467. package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -1
  468. package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -1
  469. package/dist/tests/fourslash/rename.fourslash.js.map +1 -1
  470. package/dist/tests/fourslash/rename.function.untitledFile.fourslash.js.map +1 -1
  471. package/dist/tests/fourslash/rename.init.fourslash.js.map +1 -1
  472. package/dist/tests/fourslash/rename.library.fourslash.js.map +1 -1
  473. package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js.map +1 -1
  474. package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +1 -1
  475. package/dist/tests/fourslash/rename.multipleDecl.fourslash.js.map +1 -1
  476. package/dist/tests/fourslash/rename.parens.fourslash.js.map +1 -1
  477. package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -1
  478. package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -1
  479. package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -1
  480. package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -1
  481. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.js.map +1 -1
  482. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.js.map +1 -1
  483. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.js.map +1 -1
  484. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.js.map +1 -1
  485. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.js.map +1 -1
  486. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.js.map +1 -1
  487. package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -1
  488. package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
  489. package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -1
  490. package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -1
  491. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
  492. package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -1
  493. package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -1
  494. package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -1
  495. package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -1
  496. package/dist/tests/fourslash/typeVerifier.fourslash.js.map +1 -1
  497. package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
  498. package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
  499. package/dist/tests/harness/fourslash/runner.js +1 -1
  500. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  501. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  502. package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
  503. package/dist/tests/harness/fourslash/testState.d.ts +0 -13
  504. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  505. package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
  506. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  507. package/dist/tests/harness/testAccessHost.js.map +1 -1
  508. package/dist/tests/harness/testHost.js.map +1 -1
  509. package/dist/tests/harness/utils.js.map +1 -1
  510. package/dist/tests/harness/vfs/factory.js.map +1 -1
  511. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  512. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  513. package/dist/tests/hoverProvider.test.js.map +1 -1
  514. package/dist/tests/importResolver.test.js.map +1 -1
  515. package/dist/tests/importStatementUtils.test.js.map +1 -1
  516. package/dist/tests/ipythonMode.test.js.map +1 -1
  517. package/dist/tests/languageServer.test.d.ts +1 -0
  518. package/dist/tests/languageServer.test.js +137 -0
  519. package/dist/tests/languageServer.test.js.map +1 -0
  520. package/dist/tests/localizer.test.js.map +1 -1
  521. package/dist/tests/logger.test.js.map +1 -1
  522. package/dist/tests/lsp/customLsp.d.ts +112 -0
  523. package/dist/tests/lsp/customLsp.js +67 -0
  524. package/dist/tests/lsp/customLsp.js.map +1 -0
  525. package/dist/tests/lsp/languageServer.d.ts +1 -0
  526. package/dist/tests/lsp/languageServer.js +326 -0
  527. package/dist/tests/lsp/languageServer.js.map +1 -0
  528. package/dist/tests/lsp/languageServerTestUtils.d.ts +100 -0
  529. package/dist/tests/lsp/languageServerTestUtils.js +803 -0
  530. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -0
  531. package/dist/tests/lsp/main.d.ts +1 -0
  532. package/dist/tests/lsp/main.js +12 -0
  533. package/dist/tests/lsp/main.js.map +1 -0
  534. package/dist/tests/lsp/webpack.testserver.config.d.ts +4 -0
  535. package/dist/tests/lsp/webpack.testserver.config.js +64 -0
  536. package/dist/tests/lsp/webpack.testserver.config.js.map +1 -0
  537. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  538. package/dist/tests/parser.test.js.map +1 -1
  539. package/dist/tests/pathUtils.test.js.map +1 -1
  540. package/dist/tests/positionUtils.test.js.map +1 -1
  541. package/dist/tests/pyrightFileSystem.test.js.map +1 -1
  542. package/dist/tests/serialization.test.js.map +1 -1
  543. package/dist/tests/service.test.js.map +1 -1
  544. package/dist/tests/signatureHelp.test.js.map +1 -1
  545. package/dist/tests/sourceFile.test.js.map +1 -1
  546. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  547. package/dist/tests/stringUtils.test.js.map +1 -1
  548. package/dist/tests/symbolNameUtils.test.js.map +1 -1
  549. package/dist/tests/testState.test.js.map +1 -1
  550. package/dist/tests/testStateUtils.js.map +1 -1
  551. package/dist/tests/testUtils.js.map +1 -1
  552. package/dist/tests/textEditUtil.test.js.map +1 -1
  553. package/dist/tests/textRange.test.js.map +1 -1
  554. package/dist/tests/tokenizer.test.js.map +1 -1
  555. package/dist/tests/typeEvaluator1.test.js +9 -5
  556. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  557. package/dist/tests/typeEvaluator2.test.js +7 -3
  558. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  559. package/dist/tests/typeEvaluator3.test.js +1 -1
  560. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  561. package/dist/tests/typeEvaluator4.test.js +1 -1
  562. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  563. package/dist/tests/typeEvaluator5.test.js +1 -1
  564. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  565. package/dist/tests/typePrinter.test.js.map +1 -1
  566. package/dist/tests/uri.test.js +74 -26
  567. package/dist/tests/uri.test.js.map +1 -1
  568. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  569. package/dist/tests/zipfs.test.js.map +1 -1
  570. package/dist/workspaceFactory.js +2 -1
  571. package/dist/workspaceFactory.js.map +1 -1
  572. package/package.json +20 -12
@@ -494,7 +494,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
494
494
  (0, types_1.isInstantiableClass)(objectClass) &&
495
495
  typeClassType &&
496
496
  (0, types_1.isInstantiableClass)(typeClassType)) {
497
- const anyClass = types_1.ClassType.createInstantiable('Any', 'typing.Any', 'typing', uri_1.Uri.empty(), 1 /* ClassTypeFlags.BuiltInClass */,
497
+ const anyClass = types_1.ClassType.createInstantiable('Any', 'typing.Any', 'typing', uri_1.Uri.empty(), 1 /* ClassTypeFlags.BuiltInClass */ | 1073741824 /* ClassTypeFlags.SpecialFormClass */,
498
498
  /* typeSourceId */ -1,
499
499
  /* declaredMetaclass */ undefined,
500
500
  /* effectiveMetaclass */ typeClassType);
@@ -1002,11 +1002,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
1002
1002
  function stripLiteralValue(type) {
1003
1003
  var _a, _b, _c;
1004
1004
  // Handle the not-uncommon case where the type is a union that consists
1005
- // only of literal str or literal int values.
1005
+ // only of literal values.
1006
1006
  if ((0, types_1.isUnion)(type) && type.subtypes.length > 0) {
1007
- if (((_a = type.literalStrMap) === null || _a === void 0 ? void 0 : _a.size) === type.subtypes.length ||
1008
- ((_b = type.literalIntMap) === null || _b === void 0 ? void 0 : _b.size) === type.subtypes.length ||
1009
- ((_c = type.literalEnumMap) === null || _c === void 0 ? void 0 : _c.size) === type.subtypes.length) {
1007
+ if (((_a = type.literalInstances.literalStrMap) === null || _a === void 0 ? void 0 : _a.size) === type.subtypes.length ||
1008
+ ((_b = type.literalInstances.literalIntMap) === null || _b === void 0 ? void 0 : _b.size) === type.subtypes.length ||
1009
+ ((_c = type.literalInstances.literalEnumMap) === null || _c === void 0 ? void 0 : _c.size) === type.subtypes.length) {
1010
1010
  return stripLiteralValue(type.subtypes[0]);
1011
1011
  }
1012
1012
  }
@@ -1392,7 +1392,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
1392
1392
  // an instance of a class. Limit access to metaclass instance members
1393
1393
  // in this case.
1394
1394
  if (!objectTypeIsInstantiable) {
1395
- effectiveFlags |= 32 /* MemberAccessFlags.SkipClassMembers */ | 512 /* MemberAccessFlags.SkipAttributeAccessOverride */;
1395
+ effectiveFlags |=
1396
+ 32 /* MemberAccessFlags.SkipClassMembers */ |
1397
+ 512 /* MemberAccessFlags.SkipAttributeAccessOverride */ |
1398
+ 8 /* MemberAccessFlags.SkipTypeBaseClass */;
1396
1399
  effectiveFlags &= ~16 /* MemberAccessFlags.SkipInstanceMembers */;
1397
1400
  }
1398
1401
  const metaclassDiag = diag ? new diagnostic_1.DiagnosticAddendum() : undefined;
@@ -1779,8 +1782,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
1779
1782
  let isValidIterator = true;
1780
1783
  let type = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(typeResult.type);
1781
1784
  type = makeTopLevelTypeVarsConcrete(type);
1782
- if ((0, typeUtils_1.isOptionalType)(type)) {
1783
- if (!typeResult.isIncomplete && emitNotIterableError) {
1785
+ type = (0, types_1.removeUnbound)(type);
1786
+ if ((0, typeUtils_1.isOptionalType)(type) && emitNotIterableError) {
1787
+ if (!typeResult.isIncomplete) {
1784
1788
  addDiagnostic(diagnosticRules_1.DiagnosticRule.reportOptionalIterable, localize_1.LocMessage.noneNotIterable(), errorNode);
1785
1789
  }
1786
1790
  type = (0, typeUtils_1.removeNoneFromUnion)(type);
@@ -2418,15 +2422,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2418
2422
  });
2419
2423
  // Have we accounted for all of the targets and sources? If not, we have a size mismatch.
2420
2424
  if (sourceEntryTypes.length !== targetExpressions.length) {
2421
- const expectedEntryCount = unpackIndex >= 0 ? targetExpressions.length - 1 : targetExpressions.length;
2422
2425
  const subDiag = diagAddendum.createAddendum();
2423
2426
  subDiag.addMessage((target.nodeType === 31 /* ParseNodeType.List */
2424
2427
  ? localize_1.LocAddendum.listAssignmentMismatch()
2425
2428
  : localize_1.LocAddendum.tupleAssignmentMismatch()).format({
2426
2429
  type: printType(subtype),
2427
2430
  }));
2428
- subDiag.createAddendum().addMessage(localize_1.LocAddendum.tupleSizeMismatch().format({
2429
- expected: expectedEntryCount,
2431
+ subDiag.createAddendum().addMessage((unpackIndex >= 0
2432
+ ? localize_1.LocAddendum.tupleSizeMismatchIndeterminateDest()
2433
+ : localize_1.LocAddendum.tupleSizeMismatch()).format({
2434
+ expected: unpackIndex >= 0 ? targetExpressions.length - 1 : targetExpressions.length,
2430
2435
  received: sourceEntryTypes.length,
2431
2436
  }));
2432
2437
  }
@@ -2493,11 +2498,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2493
2498
  var _a, _b;
2494
2499
  if ((0, types_1.isParamSpec)(subtype)) {
2495
2500
  if (subtype.paramSpecAccess === 'args') {
2496
- if (tupleClassType &&
2497
- (0, types_1.isInstantiableClass)(tupleClassType) &&
2498
- objectType &&
2499
- (0, types_1.isClassInstance)(objectType)) {
2500
- return types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: objectType, isUnbounded: true }]));
2501
+ if (objectType && (0, types_1.isClassInstance)(objectType)) {
2502
+ return makeTupleObject([{ type: objectType, isUnbounded: true }]);
2501
2503
  }
2502
2504
  return types_1.UnknownType.create();
2503
2505
  }
@@ -3282,9 +3284,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3282
3284
  defaultType = (0, typeUtils_1.applySolvedTypeVars)(param, typeVarContext, { unknownIfNotFound: true });
3283
3285
  }
3284
3286
  else if (param.details.isVariadic && tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
3285
- defaultType = types_1.ClassType.cloneForUnpacked((0, typeUtils_1.specializeTupleClass)(types_1.ClassType.cloneAsInstance(tupleClassType), [
3286
- { type: types_1.UnknownType.create(), isUnbounded: true },
3287
- ]));
3287
+ defaultType = makeTupleObject([{ type: types_1.UnknownType.create(), isUnbounded: true }],
3288
+ /* isUnpackedTuple */ true);
3288
3289
  }
3289
3290
  else {
3290
3291
  defaultType = types_1.UnknownType.create();
@@ -3904,18 +3905,18 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3904
3905
  else {
3905
3906
  resultType = subtype;
3906
3907
  }
3907
- // If this is a "set" operation, we have a bit more work to do.
3908
- if (usage.method !== 'set') {
3908
+ // If this is a "set" or "delete" operation, we have a bit more work to do.
3909
+ if (usage.method === 'get') {
3909
3910
  return resultType;
3910
3911
  }
3911
- // Check for an attempt to overwrite a ClassVar member from an instance.
3912
+ // Check for an attempt to overwrite or delete a ClassVar member from an instance.
3912
3913
  if (!isDescriptorApplied &&
3913
3914
  (memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.symbol.isClassVar()) &&
3914
3915
  (flags & 128 /* MemberAccessFlags.DisallowClassVarWrites */) !== 0) {
3915
3916
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.memberSetClassVar().format({ name: memberName }));
3916
3917
  isDescriptorError = true;
3917
3918
  }
3918
- // Check for an attempt to overwrite a final member variable.
3919
+ // Check for an attempt to overwrite or delete a final member variable.
3919
3920
  const finalVarTypeDecl = memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.symbol.getDeclarations().find((decl) => isFinalVariableDeclaration(decl));
3920
3921
  if (finalVarTypeDecl &&
3921
3922
  errorNode &&
@@ -3928,7 +3929,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3928
3929
  isDescriptorError = true;
3929
3930
  }
3930
3931
  }
3931
- // Check for an attempt to overwrite an instance variable that is
3932
+ // Check for an attempt to overwrite or delete an instance variable that is
3932
3933
  // read-only (e.g. in a named tuple).
3933
3934
  if ((memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.isInstanceMember) &&
3934
3935
  (0, types_1.isClass)(memberInfo.classType) &&
@@ -4444,55 +4445,49 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
4444
4445
  // param somewhere in the list?
4445
4446
  if (variadicIndex >= 0) {
4446
4447
  const variadicTypeVar = typeParameters[variadicIndex];
4447
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
4448
- if (variadicIndex < typeArgs.length) {
4449
- const variadicTypeResults = typeArgs.slice(variadicIndex, variadicIndex + 1 + typeArgs.length - typeParameters.length);
4450
- // If the type args consist of a lone variadic type variable, don't wrap it in a tuple.
4451
- if (variadicTypeResults.length === 1 && (0, types_1.isVariadicTypeVar)(variadicTypeResults[0].type)) {
4452
- validateVariadicTypeVarIsUnpacked(variadicTypeResults[0].type, variadicTypeResults[0].node);
4453
- }
4454
- else {
4455
- variadicTypeResults.forEach((arg, index) => {
4456
- validateTypeArg(arg, {
4457
- allowEmptyTuple: index === 0,
4458
- allowVariadicTypeVar: true,
4459
- allowUnpackedTuples: true,
4460
- });
4448
+ if (variadicIndex < typeArgs.length) {
4449
+ const variadicTypeResults = typeArgs.slice(variadicIndex, variadicIndex + 1 + typeArgs.length - typeParameters.length);
4450
+ // If the type args consist of a lone variadic type variable, don't wrap it in a tuple.
4451
+ if (variadicTypeResults.length === 1 && (0, types_1.isVariadicTypeVar)(variadicTypeResults[0].type)) {
4452
+ validateVariadicTypeVarIsUnpacked(variadicTypeResults[0].type, variadicTypeResults[0].node);
4453
+ }
4454
+ else {
4455
+ variadicTypeResults.forEach((arg, index) => {
4456
+ validateTypeArg(arg, {
4457
+ allowEmptyTuple: index === 0,
4458
+ allowVariadicTypeVar: true,
4459
+ allowUnpackedTuples: true,
4461
4460
  });
4462
- const variadicTypes = [];
4463
- if (variadicTypeResults.length !== 1 || !variadicTypeResults[0].isEmptyTupleShorthand) {
4464
- variadicTypeResults.forEach((typeResult) => {
4465
- if ((0, types_1.isUnpackedClass)(typeResult.type) && typeResult.type.tupleTypeArguments) {
4466
- (0, collectionUtils_1.appendArray)(variadicTypes, typeResult.type.tupleTypeArguments);
4467
- }
4468
- else {
4469
- variadicTypes.push({
4470
- type: (0, typeUtils_1.convertToInstance)(typeResult.type),
4471
- isUnbounded: false,
4472
- });
4473
- }
4474
- });
4475
- }
4476
- const tupleObject = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, variadicTypes,
4477
- /* isTypeArgumentExplicit */ true,
4478
- /* isUnpackedTuple */ true));
4479
- typeArgs = [
4480
- ...typeArgs.slice(0, variadicIndex),
4481
- { node: typeArgs[variadicIndex].node, type: tupleObject },
4482
- ...typeArgs.slice(variadicIndex + 1 + typeArgs.length - typeParameters.length, typeArgs.length),
4483
- ];
4484
- }
4485
- }
4486
- else if (!variadicTypeVar.details.defaultType) {
4487
- // Add an empty tuple that maps to the TypeVarTuple type parameter.
4488
- typeArgs.push({
4489
- node: errorNode,
4490
- type: (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, [],
4491
- /* isTypeArgumentExplicit */ true,
4492
- /* isUnpackedTuple */ true)),
4493
4461
  });
4462
+ const variadicTypes = [];
4463
+ if (variadicTypeResults.length !== 1 || !variadicTypeResults[0].isEmptyTupleShorthand) {
4464
+ variadicTypeResults.forEach((typeResult) => {
4465
+ if ((0, types_1.isUnpackedClass)(typeResult.type) && typeResult.type.tupleTypeArguments) {
4466
+ (0, collectionUtils_1.appendArray)(variadicTypes, typeResult.type.tupleTypeArguments);
4467
+ }
4468
+ else {
4469
+ variadicTypes.push({
4470
+ type: (0, typeUtils_1.convertToInstance)(typeResult.type),
4471
+ isUnbounded: false,
4472
+ });
4473
+ }
4474
+ });
4475
+ }
4476
+ const tupleObject = makeTupleObject(variadicTypes, /* isUnpackedTuple */ true);
4477
+ typeArgs = [
4478
+ ...typeArgs.slice(0, variadicIndex),
4479
+ { node: typeArgs[variadicIndex].node, type: tupleObject },
4480
+ ...typeArgs.slice(variadicIndex + 1 + typeArgs.length - typeParameters.length, typeArgs.length),
4481
+ ];
4494
4482
  }
4495
4483
  }
4484
+ else if (!variadicTypeVar.details.defaultType) {
4485
+ // Add an empty tuple that maps to the TypeVarTuple type parameter.
4486
+ typeArgs.push({
4487
+ node: errorNode,
4488
+ type: makeTupleObject([], /* isUnpackedTuple */ true),
4489
+ });
4490
+ }
4496
4491
  }
4497
4492
  return typeArgs;
4498
4493
  }
@@ -4936,11 +4931,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
4936
4931
  }
4937
4932
  });
4938
4933
  }
4939
- function makeTupleObject(entryTypes, isUnspecifiedLength = false) {
4934
+ function makeTupleObject(typeArgs, isUnpackedTuple = false) {
4940
4935
  if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
4941
- return (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, entryTypes.map((t) => {
4942
- return { type: t, isUnbounded: isUnspecifiedLength };
4943
- })));
4936
+ return (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, typeArgs, /* isTypeArgumentExplicit */ true, isUnpackedTuple));
4944
4937
  }
4945
4938
  return types_1.UnknownType.create();
4946
4939
  }
@@ -5032,17 +5025,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5032
5025
  }
5033
5026
  else if (positionalArgs.length === 0 && unpackedListArgs.length === 0) {
5034
5027
  // Handle the case where there are no positionals provided but there are keywords.
5035
- positionalIndexType =
5036
- tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)
5037
- ? (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, []))
5038
- : types_1.UnknownType.create();
5028
+ positionalIndexType = makeTupleObject([]);
5039
5029
  }
5040
5030
  else {
5041
5031
  // Package up all of the positionals into a tuple.
5042
- const tupleEntries = [];
5032
+ const tupleTypeArgs = [];
5043
5033
  positionalArgs.forEach((arg) => {
5044
5034
  const typeResult = getTypeOfExpression(arg.valueExpression);
5045
- tupleEntries.push(typeResult.type);
5035
+ tupleTypeArgs.push({ type: typeResult.type, isUnbounded: false });
5046
5036
  if (typeResult.isIncomplete) {
5047
5037
  isPositionalIndexTypeIncomplete = true;
5048
5038
  }
@@ -5054,9 +5044,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5054
5044
  isPositionalIndexTypeIncomplete = true;
5055
5045
  }
5056
5046
  const iterableType = (_b = (_a = getTypeOfIterator(typeResult, /* isAsync */ false, arg.valueExpression)) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : types_1.UnknownType.create();
5057
- tupleEntries.push(iterableType);
5047
+ tupleTypeArgs.push({ type: iterableType, isUnbounded: true });
5058
5048
  });
5059
- positionalIndexType = makeTupleObject(tupleEntries, unpackedListArgs.length > 0);
5049
+ positionalIndexType = makeTupleObject(tupleTypeArgs);
5060
5050
  }
5061
5051
  let argList = [
5062
5052
  {
@@ -5101,7 +5091,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5101
5091
  // which type to use.
5102
5092
  if (keywordArgs.length === 0 && unpackedDictArgs.length === 0 && positionalArgs.length === 1) {
5103
5093
  useSpeculativeMode(node, () => {
5104
- callResult = validateCallArguments(node, argList, { type: itemMethodType });
5094
+ callResult = validateCallArguments(node, argList, { type: itemMethodType },
5095
+ /* typeVarContext */ undefined,
5096
+ /* skipUnknownArgCheck */ true);
5105
5097
  if (callResult.argumentErrors) {
5106
5098
  // If the object supports "__index__" magic method, convert
5107
5099
  // the index to an int and try again.
@@ -5124,7 +5116,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5124
5116
  }
5125
5117
  });
5126
5118
  }
5127
- callResult = validateCallArguments(node, argList, { type: itemMethodType });
5119
+ callResult = validateCallArguments(node, argList, { type: itemMethodType },
5120
+ /* typeVarContext */ undefined,
5121
+ /* skipUnknownArgCheck */ true);
5128
5122
  return {
5129
5123
  type: (_d = callResult.returnType) !== null && _d !== void 0 ? _d : types_1.UnknownType.create(),
5130
5124
  isIncomplete: !!callResult.isTypeIncomplete,
@@ -5144,7 +5138,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5144
5138
  return undefined;
5145
5139
  }
5146
5140
  const slicedTypeArgs = tupleTypeArgs.slice(startValue, endValue);
5147
- return types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleType, slicedTypeArgs));
5141
+ return makeTupleObject(slicedTypeArgs);
5148
5142
  }
5149
5143
  function getTupleSliceParameter(expression, defaultValue, tupleTypeArgs) {
5150
5144
  let value = defaultValue;
@@ -5412,8 +5406,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5412
5406
  const entryTypeResults = node.expressions.map((expr, index) => getTypeOfExpression(expr,
5413
5407
  /* flags */ undefined, (0, typeUtils_1.makeInferenceContext)(index < expectedTypes.length ? expectedTypes[index] : undefined, inferenceContext.isTypeIncomplete, inferenceContext.signatureTracker)));
5414
5408
  const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
5415
- const type = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, buildTupleTypesList(entryTypeResults),
5416
- /* isTypeArgumentExplicit */ true));
5409
+ const type = makeTupleObject(buildTupleTypesList(entryTypeResults));
5417
5410
  // Copy any expected type diag addenda for precision error reporting.
5418
5411
  let expectedTypeDiagAddendum;
5419
5412
  if (entryTypeResults.some((result) => result.expectedTypeDiagAddendum)) {
@@ -5429,10 +5422,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5429
5422
  function getTypeOfTupleInferred(node) {
5430
5423
  const entryTypeResults = node.expressions.map((expr) => getTypeOfExpression(expr));
5431
5424
  const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
5432
- if (!tupleClassType || !(0, types_1.isInstantiableClass)(tupleClassType)) {
5433
- return { type: types_1.UnknownType.create() };
5434
- }
5435
- const type = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, buildTupleTypesList(entryTypeResults)));
5425
+ const type = makeTupleObject(buildTupleTypesList(entryTypeResults));
5436
5426
  if (isIncomplete) {
5437
5427
  if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
5438
5428
  return { type: types_1.UnknownType.create() };
@@ -5889,10 +5879,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5889
5879
  // If the bind-to type is a protocol, don't use the effective target class.
5890
5880
  // This pattern is used for mixins, where the mixin type is a protocol class
5891
5881
  // that is used to decorate the "self" or "cls" parameter.
5882
+ let isProtocolClass = false;
5892
5883
  if (bindToType &&
5893
5884
  types_1.ClassType.isProtocolClass(bindToType) &&
5894
5885
  effectiveTargetClass &&
5895
5886
  !types_1.ClassType.isSameGenericClass(bindToType, effectiveTargetClass)) {
5887
+ isProtocolClass = true;
5896
5888
  effectiveTargetClass = undefined;
5897
5889
  }
5898
5890
  const lookupResults = bindToType
@@ -5901,6 +5893,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5901
5893
  let resultType;
5902
5894
  if (lookupResults && (0, types_1.isInstantiableClass)(lookupResults.classType)) {
5903
5895
  resultType = lookupResults.classType;
5896
+ if (isProtocolClass) {
5897
+ // If the bindToType is a protocol class, set the "include subclasses" flag
5898
+ // so we don't enforce that called methods are implemented within the protocol.
5899
+ resultType = types_1.ClassType.cloneIncludeSubclasses(resultType);
5900
+ }
5904
5901
  }
5905
5902
  else if (effectiveTargetClass &&
5906
5903
  !(0, types_1.isAnyOrUnknown)(effectiveTargetClass) &&
@@ -6416,7 +6413,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6416
6413
  if (callTypeResult.type.specialForm) {
6417
6414
  const exprNode = errorNode.nodeType === 9 /* ParseNodeType.Call */ ? errorNode.leftExpression : errorNode;
6418
6415
  addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.objectNotCallable().format({
6419
- type: printType(callTypeResult.type, { expandTypeAlias: true }),
6416
+ type: printType(callTypeResult.type.specialForm, { expandTypeAlias: true }),
6420
6417
  }), exprNode);
6421
6418
  return { returnType: types_1.UnknownType.create(), argumentErrors: true, overloadsUsedForCall };
6422
6419
  }
@@ -6906,7 +6903,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6906
6903
  argumentCategory: 1 /* ArgumentCategory.UnpackedList */,
6907
6904
  valueExpression: undefined,
6908
6905
  typeResult: {
6909
- type: (0, typeUtils_1.specializeTupleClass)(combinedArgType, [tupleTypeArg]),
6906
+ type: makeTupleObject([tupleTypeArg]),
6910
6907
  },
6911
6908
  });
6912
6909
  }
@@ -6934,7 +6931,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6934
6931
  // validation is left to the caller.
6935
6932
  // This logic is based on PEP 3102: https://www.python.org/dev/peps/pep-3102/
6936
6933
  function matchFunctionArgumentsToParameters(errorNode, argList, typeResult, overloadIndex) {
6937
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6934
+ var _a, _b, _c, _d, _e, _f, _g, _h;
6938
6935
  const paramDetails = (0, parameterUtils_1.getParameterListDetails)(typeResult.type);
6939
6936
  let argIndex = 0;
6940
6937
  let matchedUnpackedListOfUnknownLength = false;
@@ -7162,10 +7159,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7162
7159
  listElementType = undefined;
7163
7160
  }
7164
7161
  else {
7165
- listElementType =
7166
- (_e = (_d = getTypeOfIterator({ type: argType, isIncomplete: argTypeResult.isIncomplete },
7167
- /* isAsync */ false, errorNode,
7168
- /* emitNotIterableError */ false)) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : types_1.UnknownType.create();
7162
+ listElementType = (_d = getTypeOfIterator({ type: argType, isIncomplete: argTypeResult.isIncomplete },
7163
+ /* isAsync */ false, errorNode,
7164
+ /* emitNotIterableError */ false)) === null || _d === void 0 ? void 0 : _d.type;
7169
7165
  if (paramDetails.params[paramIndex].param.category !== 1 /* ParameterCategory.ArgsList */) {
7170
7166
  matchedUnpackedListOfUnknownLength = true;
7171
7167
  }
@@ -7175,8 +7171,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7175
7171
  argumentCategory: 0 /* ArgumentCategory.Simple */,
7176
7172
  typeResult: { type: listElementType, isIncomplete: argTypeResult.isIncomplete },
7177
7173
  }
7178
- : undefined;
7179
- if (funcArg && argTypeResult.isIncomplete) {
7174
+ : { ...argList[argIndex] };
7175
+ if (argTypeResult.isIncomplete) {
7180
7176
  isTypeIncomplete = true;
7181
7177
  }
7182
7178
  // It's not allowed to use unpacked arguments with a variadic *args
@@ -7197,7 +7193,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7197
7193
  paramType,
7198
7194
  requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
7199
7195
  argument: funcArg,
7200
- errorNode: (_f = argList[argIndex].valueExpression) !== null && _f !== void 0 ? _f : errorNode,
7196
+ errorNode: (_e = argList[argIndex].valueExpression) !== null && _e !== void 0 ? _e : errorNode,
7201
7197
  paramName,
7202
7198
  isParamNameSynthesized: paramDetails.params[paramIndex].param.isNameSynthesized,
7203
7199
  mapsToVarArgList: isParamVariadic && remainingArgCount > remainingParamCount,
@@ -7501,7 +7497,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7501
7497
  paramType,
7502
7498
  requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
7503
7499
  argument: argList[argIndex],
7504
- errorNode: (_g = argList[argIndex].valueExpression) !== null && _g !== void 0 ? _g : errorNode,
7500
+ errorNode: (_f = argList[argIndex].valueExpression) !== null && _f !== void 0 ? _f : errorNode,
7505
7501
  paramName: paramNameValue,
7506
7502
  });
7507
7503
  trySetActive(argList[argIndex], paramDetails.params[paramInfoIndex].param);
@@ -7517,7 +7513,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7517
7513
  paramType,
7518
7514
  requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
7519
7515
  argument: argList[argIndex],
7520
- errorNode: (_h = argList[argIndex].valueExpression) !== null && _h !== void 0 ? _h : errorNode,
7516
+ errorNode: (_g = argList[argIndex].valueExpression) !== null && _g !== void 0 ? _g : errorNode,
7521
7517
  paramName: paramNameValue,
7522
7518
  });
7523
7519
  // Remember that this parameter has already received a value.
@@ -7567,7 +7563,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7567
7563
  requiresTypeVarMatching: false,
7568
7564
  argument: argList[argIndex],
7569
7565
  argType: (0, types_1.isParamSpec)(argType) ? undefined : types_1.AnyType.create(),
7570
- errorNode: (_j = argList[argIndex].valueExpression) !== null && _j !== void 0 ? _j : errorNode,
7566
+ errorNode: (_h = argList[argIndex].valueExpression) !== null && _h !== void 0 ? _h : errorNode,
7571
7567
  });
7572
7568
  }
7573
7569
  }
@@ -7675,61 +7671,57 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7675
7671
  const paramType = paramDetails.params[paramDetails.argsIndex].type;
7676
7672
  const variadicArgs = validateArgTypeParams.filter((argParam) => argParam.mapsToVarArgList);
7677
7673
  if ((0, types_1.isVariadicTypeVar)(paramType) && !paramType.isVariadicInUnion) {
7678
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
7679
- const tupleTypeArgs = variadicArgs.map((argParam) => {
7680
- var _a;
7681
- const argType = getTypeOfArgument(argParam.argument).type;
7682
- const containsVariadicTypeVar = (0, types_1.isUnpackedVariadicTypeVar)(argType) ||
7683
- ((0, types_1.isClassInstance)(argType) &&
7684
- (0, typeUtils_1.isTupleClass)(argType) &&
7685
- argType.tupleTypeArguments &&
7686
- argType.tupleTypeArguments.length === 1 &&
7687
- (0, types_1.isUnpackedVariadicTypeVar)(argType.tupleTypeArguments[0].type));
7688
- if (containsVariadicTypeVar &&
7689
- argParam.argument.argumentCategory !== 1 /* ArgumentCategory.UnpackedList */ &&
7690
- !argParam.mapsToVarArgList) {
7691
- if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7692
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeVarTupleMustBeUnpacked(), (_a = argParam.argument.valueExpression) !== null && _a !== void 0 ? _a : errorNode);
7693
- }
7694
- reportedArgError = true;
7674
+ const tupleTypeArgs = variadicArgs.map((argParam) => {
7675
+ var _a;
7676
+ const argType = getTypeOfArgument(argParam.argument).type;
7677
+ const containsVariadicTypeVar = (0, types_1.isUnpackedVariadicTypeVar)(argType) ||
7678
+ ((0, types_1.isClassInstance)(argType) &&
7679
+ (0, typeUtils_1.isTupleClass)(argType) &&
7680
+ argType.tupleTypeArguments &&
7681
+ argType.tupleTypeArguments.length === 1 &&
7682
+ (0, types_1.isUnpackedVariadicTypeVar)(argType.tupleTypeArguments[0].type));
7683
+ if (containsVariadicTypeVar &&
7684
+ argParam.argument.argumentCategory !== 1 /* ArgumentCategory.UnpackedList */ &&
7685
+ !argParam.mapsToVarArgList) {
7686
+ if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7687
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeVarTupleMustBeUnpacked(), (_a = argParam.argument.valueExpression) !== null && _a !== void 0 ? _a : errorNode);
7695
7688
  }
7696
- return {
7697
- type: argType,
7698
- isUnbounded: argParam.argument.argumentCategory === 1 /* ArgumentCategory.UnpackedList */,
7699
- };
7700
- });
7701
- let specializedTuple;
7702
- if (tupleTypeArgs.length === 1 &&
7703
- !tupleTypeArgs[0].isUnbounded &&
7704
- ((0, types_1.isUnpackedClass)(tupleTypeArgs[0].type) || (0, types_1.isVariadicTypeVar)(tupleTypeArgs[0].type))) {
7705
- // If there is a single unpacked tuple or unpacked variadic type variable
7706
- // (including an unpacked TypeVarTuple union) within this tuple,
7707
- // simplify the type.
7708
- specializedTuple = tupleTypeArgs[0].type;
7709
- }
7710
- else {
7711
- specializedTuple = types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, tupleTypeArgs,
7712
- /* isTypeArgumentExplicit */ true,
7713
- /* isUnpackedTuple */ true));
7689
+ reportedArgError = true;
7714
7690
  }
7715
- const combinedArg = {
7716
- paramCategory: 1 /* ParameterCategory.ArgsList */,
7717
- paramType,
7718
- requiresTypeVarMatching: true,
7719
- argument: {
7720
- argumentCategory: 0 /* ArgumentCategory.Simple */,
7721
- typeResult: { type: specializedTuple },
7722
- },
7723
- errorNode,
7724
- paramName: paramDetails.params[paramDetails.argsIndex].param.name,
7725
- isParamNameSynthesized: paramDetails.params[paramDetails.argsIndex].param.isNameSynthesized,
7726
- mapsToVarArgList: true,
7691
+ return {
7692
+ type: argType,
7693
+ isUnbounded: argParam.argument.argumentCategory === 1 /* ArgumentCategory.UnpackedList */,
7727
7694
  };
7728
- validateArgTypeParams = [
7729
- ...validateArgTypeParams.filter((argParam) => !argParam.mapsToVarArgList),
7730
- combinedArg,
7731
- ];
7695
+ });
7696
+ let specializedTuple;
7697
+ if (tupleTypeArgs.length === 1 &&
7698
+ !tupleTypeArgs[0].isUnbounded &&
7699
+ ((0, types_1.isUnpackedClass)(tupleTypeArgs[0].type) || (0, types_1.isVariadicTypeVar)(tupleTypeArgs[0].type))) {
7700
+ // If there is a single unpacked tuple or unpacked variadic type variable
7701
+ // (including an unpacked TypeVarTuple union) within this tuple,
7702
+ // simplify the type.
7703
+ specializedTuple = tupleTypeArgs[0].type;
7732
7704
  }
7705
+ else {
7706
+ specializedTuple = makeTupleObject(tupleTypeArgs, /* isUnpackedTuple */ true);
7707
+ }
7708
+ const combinedArg = {
7709
+ paramCategory: 1 /* ParameterCategory.ArgsList */,
7710
+ paramType,
7711
+ requiresTypeVarMatching: true,
7712
+ argument: {
7713
+ argumentCategory: 0 /* ArgumentCategory.Simple */,
7714
+ typeResult: { type: specializedTuple },
7715
+ },
7716
+ errorNode,
7717
+ paramName: paramDetails.params[paramDetails.argsIndex].param.name,
7718
+ isParamNameSynthesized: paramDetails.params[paramDetails.argsIndex].param.isNameSynthesized,
7719
+ mapsToVarArgList: true,
7720
+ };
7721
+ validateArgTypeParams = [
7722
+ ...validateArgTypeParams.filter((argParam) => !argParam.mapsToVarArgList),
7723
+ combinedArg,
7724
+ ];
7733
7725
  }
7734
7726
  }
7735
7727
  }
@@ -8067,7 +8059,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8067
8059
  let specializedReturnType = (0, typeUtils_1.applySolvedTypeVars)(returnType, typeVarContext, {
8068
8060
  unknownIfNotFound,
8069
8061
  unknownExemptTypeVars: getUnknownExemptTypeVarsForReturnType(type, returnType),
8070
- useUnknownOverDefault: skipUnknownArgCheck,
8071
8062
  eliminateUnsolvedInUnions,
8072
8063
  applyInScopePlaceholders: true,
8073
8064
  });
@@ -8913,7 +8904,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8913
8904
  typeParamsExpr.expressions.map((expr) => {
8914
8905
  let entryType = getTypeOfExpression(expr, 128 /* EvaluatorFlags.ExpectingInstantiableType */ | 4096 /* EvaluatorFlags.AllowTypeVarsWithoutScopeId */).type;
8915
8906
  if ((0, types_1.isTypeVar)(entryType)) {
8916
- if (entryType.scopeId) {
8907
+ if (entryType.scopeId || entryType.isVariadicUnpacked) {
8917
8908
  isTypeParamListValid = false;
8918
8909
  }
8919
8910
  else {
@@ -10048,7 +10039,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10048
10039
  if (!expectedValueOrElementType || !(0, typeUtils_1.containsLiteralType)(expectedValueOrElementType)) {
10049
10040
  valueType = stripLiteralValue(valueType);
10050
10041
  }
10051
- type = makeTupleObject([keyType, valueType]);
10042
+ type = makeTupleObject([
10043
+ { type: keyType, isUnbounded: false },
10044
+ { type: valueType, isUnbounded: false },
10045
+ ]);
10052
10046
  }
10053
10047
  else if (node.expression.nodeType === 16 /* ParseNodeType.DictionaryExpandEntry */) {
10054
10048
  // The parser should have reported an error in this case because it's not allowed.
@@ -10916,7 +10910,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10916
10910
  if (isPep695Syntax || isPep695TypeVarType) {
10917
10911
  const typeAliasTypeClass = getTypingType(errorNode, 'TypeAliasType');
10918
10912
  if (typeAliasTypeClass && (0, types_1.isInstantiableClass)(typeAliasTypeClass)) {
10919
- typeAlias = types_1.TypeBase.cloneAsSpecialForm(typeAlias, typeAliasTypeClass);
10913
+ typeAlias = types_1.TypeBase.cloneAsSpecialForm(typeAlias, types_1.ClassType.cloneAsInstance(typeAliasTypeClass));
10920
10914
  }
10921
10915
  }
10922
10916
  return typeAlias;
@@ -11168,9 +11162,19 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
11168
11162
  }
11169
11163
  // If this is an enum, transform the type as required.
11170
11164
  rightHandType = srcType;
11171
- if (node.leftExpression.nodeType === 38 /* ParseNodeType.Name */ && !node.typeAnnotationComment) {
11165
+ let targetName;
11166
+ if (node.leftExpression.nodeType === 38 /* ParseNodeType.Name */) {
11167
+ targetName = node.leftExpression;
11168
+ }
11169
+ else if (node.leftExpression.nodeType === 54 /* ParseNodeType.TypeAnnotation */ &&
11170
+ node.leftExpression.valueExpression.nodeType === 38 /* ParseNodeType.Name */) {
11171
+ targetName = node.leftExpression.valueExpression;
11172
+ }
11173
+ if (targetName) {
11172
11174
  rightHandType =
11173
- (_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, node.leftExpression, () => rightHandType)) !== null && _a !== void 0 ? _a : rightHandType;
11175
+ (_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, targetName, () => {
11176
+ return { assignedType: rightHandType };
11177
+ })) !== null && _a !== void 0 ? _a : rightHandType;
11174
11178
  }
11175
11179
  if (typeAliasNameNode) {
11176
11180
  // If this was a speculative type alias, it becomes a real type alias
@@ -12239,7 +12243,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
12239
12243
  }
12240
12244
  // In case this is an enum class and a method wrapped in an enum.member.
12241
12245
  decoratedType =
12242
- (_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, node.name, () => decoratedType)) !== null && _a !== void 0 ? _a : decoratedType;
12246
+ (_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, node.name, () => {
12247
+ return { assignedType: decoratedType };
12248
+ })) !== null && _a !== void 0 ? _a : decoratedType;
12243
12249
  // See if there are any overloads provided by previous function declarations.
12244
12250
  if ((0, types_1.isFunction)(decoratedType)) {
12245
12251
  decoratedType.details.deprecatedMessage = functionType.details.deprecatedMessage;
@@ -12750,11 +12756,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
12750
12756
  if ((0, types_1.isUnpackedClass)(type)) {
12751
12757
  return types_1.ClassType.cloneForUnpacked(type, /* isUnpackedTuple */ false);
12752
12758
  }
12753
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
12754
- return types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type, isUnbounded: !(0, types_1.isVariadicTypeVar)(type) }],
12755
- /* isTypeArgumentExplicit */ true));
12756
- }
12757
- return types_1.UnknownType.create();
12759
+ return makeTupleObject([{ type, isUnbounded: !(0, types_1.isVariadicTypeVar)(type) }]);
12758
12760
  }
12759
12761
  case 2 /* ParameterCategory.KwargsDict */: {
12760
12762
  // Leave a ParamSpec alone.
@@ -14826,7 +14828,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14826
14828
  const variableNode = (_c = ParseTreeUtils.getParentNodeOfType(declaration.node, 3 /* ParseNodeType.Assignment */)) !== null && _c !== void 0 ? _c : ParseTreeUtils.getParentNodeOfType(declaration.node, 54 /* ParseNodeType.TypeAnnotation */);
14827
14829
  if (variableNode) {
14828
14830
  declaredType =
14829
- (_d = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, variableNode, declaration.node, () => declaredType)) !== null && _d !== void 0 ? _d : declaredType;
14831
+ (_d = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, variableNode, declaration.node, () => {
14832
+ return { declaredType };
14833
+ })) !== null && _d !== void 0 ? _d : declaredType;
14830
14834
  }
14831
14835
  }
14832
14836
  if ((0, types_1.isClassInstance)(declaredType) && types_1.ClassType.isBuiltIn(declaredType, 'TypeAlias')) {
@@ -15081,9 +15085,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15081
15085
  var _a, _b;
15082
15086
  (0, debug_1.assert)(resolvedDecl.inferredTypeSource !== undefined);
15083
15087
  const inferredTypeSource = resolvedDecl.inferredTypeSource;
15084
- return ((_b = (_a = evaluateTypeForSubnode(inferredTypeSource, () => {
15085
- evaluateTypesForStatement(inferredTypeSource);
15086
- })) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : types_1.UnknownType.create());
15088
+ return {
15089
+ assignedType: (_b = (_a = evaluateTypeForSubnode(inferredTypeSource, () => {
15090
+ evaluateTypesForStatement(inferredTypeSource);
15091
+ })) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : types_1.UnknownType.create(),
15092
+ };
15087
15093
  });
15088
15094
  if (enumMemberType) {
15089
15095
  inferredType = enumMemberType;
@@ -16039,26 +16045,28 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16039
16045
  const destUnboundedOrVariadicIndex = destTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type));
16040
16046
  const srcUnboundedIndex = srcTypeArgs.findIndex((t) => t.isUnbounded);
16041
16047
  const srcVariadicIndex = srcTypeArgs.findIndex((t) => (0, types_1.isVariadicTypeVar)(t.type));
16042
- let isSrcVariadicAny = false;
16043
- // If the src contains an unbounded type but the dest does not, it's incompatible.
16044
- if (srcUnboundedIndex >= 0 && destUnboundedOrVariadicIndex < 0) {
16045
- // Unless the source contains an [Any, ...].
16048
+ if (srcUnboundedIndex >= 0) {
16046
16049
  if ((0, types_1.isAnyOrUnknown)(srcTypeArgs[srcUnboundedIndex].type)) {
16047
- isSrcVariadicAny = true;
16050
+ // If the source contains an unbounded Any, expand it to match the dest length.
16051
+ const typeToReplicate = srcTypeArgs.length > 0 ? srcTypeArgs[srcUnboundedIndex].type : types_1.AnyType.create();
16052
+ while (srcTypeArgs.length < destTypeArgs.length) {
16053
+ srcTypeArgs.splice(srcUnboundedIndex, 0, { type: typeToReplicate, isUnbounded: true });
16054
+ }
16055
+ if (srcTypeArgs.length > destTypeArgs.length) {
16056
+ srcTypeArgs.splice(srcUnboundedIndex, 1);
16057
+ }
16048
16058
  }
16049
- else {
16059
+ else if (destUnboundedOrVariadicIndex < 0) {
16060
+ // If the source contains an unbounded type but the dest does not, it's incompatible.
16050
16061
  return false;
16051
16062
  }
16052
16063
  }
16053
- if (srcUnboundedIndex >= 0) {
16054
- // The source is unbounded, so expand the unbounded argument to try
16055
- // to make the source and dest arg counts match.
16056
- const typeToReplicate = srcTypeArgs.length > 0 ? srcTypeArgs[srcUnboundedIndex].type : types_1.AnyType.create();
16057
- while (srcTypeArgs.length < destTypeArgs.length) {
16058
- srcTypeArgs.splice(srcUnboundedIndex, 0, { type: typeToReplicate, isUnbounded: true });
16059
- }
16060
- if (isSrcVariadicAny && srcTypeArgs.length > destTypeArgs.length) {
16061
- srcTypeArgs.splice(srcUnboundedIndex, 1);
16064
+ // If the dest contains an unbounded Any, expand it to match the source length.
16065
+ if (destUnboundedOrVariadicIndex >= 0 &&
16066
+ destTypeArgs[destUnboundedOrVariadicIndex].isUnbounded &&
16067
+ (0, types_1.isAnyOrUnknown)(destTypeArgs[destUnboundedOrVariadicIndex].type)) {
16068
+ while (destTypeArgs.length < srcTypeArgs.length) {
16069
+ destTypeArgs.splice(destUnboundedOrVariadicIndex, 0, destTypeArgs[destUnboundedOrVariadicIndex]);
16062
16070
  }
16063
16071
  }
16064
16072
  // Remove any optional parameters from the end of the two lists until the lengths match.
@@ -16068,23 +16076,26 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16068
16076
  while (destTypeArgs.length > srcTypeArgs.length && destTypeArgs[destTypeArgs.length - 1].isOptional) {
16069
16077
  destTypeArgs.splice(destTypeArgs.length - 1, 1);
16070
16078
  }
16071
- if (srcVariadicIndex >= 0) {
16079
+ // If we're doing reverse type mappings and the source contains a variadic
16080
+ // TypeVar, we need to adjust the dest so the reverse type mapping assignment
16081
+ // can be performed.
16082
+ if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0) {
16072
16083
  const destArgsToCapture = destTypeArgs.length - srcTypeArgs.length + 1;
16073
- // If we're doing reverse type mappings and the source contains a variadic
16074
- // TypeVar, we need to adjust the dest so the reverse type mapping assignment
16075
- // can be performed.
16076
- if (destArgsToCapture >= 0 && (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0) {
16084
+ if (srcVariadicIndex >= 0 && destArgsToCapture >= 0) {
16077
16085
  // If the only removed arg from the dest type args is itself a variadic,
16078
16086
  // don't bother adjusting it.
16079
16087
  const skipAdjustment = destArgsToCapture === 1 && (0, types_1.isVariadicTypeVar)(destTypeArgs[srcVariadicIndex].type);
16080
16088
  if (!skipAdjustment && tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
16081
16089
  const removedArgs = destTypeArgs.splice(srcVariadicIndex, destArgsToCapture);
16082
16090
  // Package up the remaining type arguments into a tuple object.
16083
- const variadicTuple = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, removedArgs.map((typeArg) => {
16084
- return { type: typeArg.type, isUnbounded: typeArg.isUnbounded };
16091
+ const variadicTuple = makeTupleObject(removedArgs.map((typeArg) => {
16092
+ return {
16093
+ type: typeArg.type,
16094
+ isUnbounded: typeArg.isUnbounded,
16095
+ isOptional: typeArg.isOptional,
16096
+ };
16085
16097
  }),
16086
- /* isTypeArgumentExplicit */ true,
16087
- /* isUnpackedTuple */ true));
16098
+ /* isUnpackedTuple */ true);
16088
16099
  destTypeArgs.splice(srcVariadicIndex, 0, {
16089
16100
  type: variadicTuple,
16090
16101
  isUnbounded: false,
@@ -16101,11 +16112,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16101
16112
  if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
16102
16113
  const removedArgs = srcTypeArgs.splice(destUnboundedOrVariadicIndex, srcArgsToCapture);
16103
16114
  // Package up the remaining type arguments into a tuple object.
16104
- const variadicTuple = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, removedArgs.map((typeArg) => {
16105
- return { type: typeArg.type, isUnbounded: typeArg.isUnbounded };
16115
+ const variadicTuple = makeTupleObject(removedArgs.map((typeArg) => {
16116
+ return {
16117
+ type: typeArg.type,
16118
+ isUnbounded: typeArg.isUnbounded,
16119
+ isOptional: typeArg.isOptional,
16120
+ };
16106
16121
  }),
16107
- /* isTypeArgumentExplicit */ true,
16108
- /* isUnpackedTuple */ true));
16122
+ /* isUnpackedTuple */ true);
16109
16123
  srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
16110
16124
  type: variadicTuple,
16111
16125
  isUnbounded: false,
@@ -16113,18 +16127,27 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16113
16127
  }
16114
16128
  }
16115
16129
  else {
16116
- const removedArgTypes = srcTypeArgs
16117
- .splice(destUnboundedOrVariadicIndex, srcArgsToCapture)
16118
- .map((t) => {
16119
- if ((0, types_1.isTypeVar)(t.type) && (0, types_1.isUnpackedVariadicTypeVar)(t.type) && !t.type.isVariadicInUnion) {
16120
- return types_1.TypeVarType.cloneForUnpacked(t.type, /* isInUnion */ true);
16121
- }
16122
- return t.type;
16123
- });
16124
- srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
16125
- type: removedArgTypes.length > 0 ? (0, types_1.combineTypes)(removedArgTypes) : types_1.AnyType.create(),
16126
- isUnbounded: false,
16127
- });
16130
+ // If possible, package up the source entries that correspond to
16131
+ // the dest unbounded tuple. This isn't possible if the source contains
16132
+ // an unbounded tuple outside of this range.
16133
+ if (srcUnboundedIndex < 0 ||
16134
+ (srcUnboundedIndex >= destUnboundedOrVariadicIndex &&
16135
+ srcUnboundedIndex < destUnboundedOrVariadicIndex + srcArgsToCapture)) {
16136
+ const removedArgTypes = srcTypeArgs
16137
+ .splice(destUnboundedOrVariadicIndex, srcArgsToCapture)
16138
+ .map((t) => {
16139
+ if ((0, types_1.isTypeVar)(t.type) &&
16140
+ (0, types_1.isUnpackedVariadicTypeVar)(t.type) &&
16141
+ !t.type.isVariadicInUnion) {
16142
+ return types_1.TypeVarType.cloneForUnpacked(t.type, /* isInUnion */ true);
16143
+ }
16144
+ return t.type;
16145
+ });
16146
+ srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
16147
+ type: removedArgTypes.length > 0 ? (0, types_1.combineTypes)(removedArgTypes) : types_1.AnyType.create(),
16148
+ isUnbounded: false,
16149
+ });
16150
+ }
16128
16151
  }
16129
16152
  }
16130
16153
  }
@@ -16148,16 +16171,32 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16148
16171
  }
16149
16172
  }
16150
16173
  else {
16151
- if (srcTypeArgs.find((t) => t.isUnbounded)) {
16152
- diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeIndeterminate().format({
16153
- expected: destTypeArgs.length,
16154
- }));
16174
+ const isDestIndeterminate = destTypeArgs.some((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type));
16175
+ if (srcTypeArgs.some((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type))) {
16176
+ if (isDestIndeterminate) {
16177
+ diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeIndeterminateSrcDest().format({
16178
+ expected: destTypeArgs.length - 1,
16179
+ }));
16180
+ }
16181
+ else {
16182
+ diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeIndeterminateSrc().format({
16183
+ expected: destTypeArgs.length,
16184
+ }));
16185
+ }
16155
16186
  }
16156
16187
  else {
16157
- diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeMismatch().format({
16158
- expected: destTypeArgs.length,
16159
- received: srcTypeArgs.length,
16160
- }));
16188
+ if (isDestIndeterminate) {
16189
+ diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeMismatchIndeterminateDest().format({
16190
+ expected: destTypeArgs.length - 1,
16191
+ received: srcTypeArgs.length,
16192
+ }));
16193
+ }
16194
+ else {
16195
+ diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeMismatch().format({
16196
+ expected: destTypeArgs.length,
16197
+ received: srcTypeArgs.length,
16198
+ }));
16199
+ }
16161
16200
  }
16162
16201
  return false;
16163
16202
  }
@@ -16248,6 +16287,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16248
16287
  const typeParam = destType.details.typeParameters[i];
16249
16288
  const variance = types_1.TypeVarType.getVariance(typeParam);
16250
16289
  (0, constraintSolver_1.updateTypeVarType)(evaluatorInterface, destTypeVarContext, typeParam, variance !== 4 /* Variance.Contravariant */ ? typeArgType : undefined, variance !== 3 /* Variance.Covariant */ ? typeArgType : undefined,
16290
+ /* tupleTypes */ curSrcType.tupleTypeArguments,
16251
16291
  /* forceRetainLiterals */ true);
16252
16292
  }
16253
16293
  }
@@ -17010,7 +17050,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17010
17050
  return false;
17011
17051
  });
17012
17052
  if (destTypeIndex >= 0) {
17013
- if (assignType(remainingDestSubtypes[destTypeIndex], srcSubtype, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
17053
+ if (assignType(remainingDestSubtypes[destTypeIndex], srcSubtype,
17054
+ /* diag */ undefined, destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
17014
17055
  // Note that we have matched at least one subtype indicating
17015
17056
  // there is at least some overlap.
17016
17057
  matchedSomeSubtypes = true;
@@ -17459,15 +17500,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17459
17500
  }
17460
17501
  });
17461
17502
  if (srcTupleTypes.length !== 1 || !(0, types_1.isVariadicTypeVar)(srcTupleTypes[0].type)) {
17462
- let srcPositionalsType;
17463
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
17464
- srcPositionalsType = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, srcTupleTypes,
17465
- /* isTypeArgumentExplicit */ true,
17466
- /* isUnpackedTuple */ true));
17467
- }
17468
- else {
17469
- srcPositionalsType = types_1.UnknownType.create();
17470
- }
17503
+ const srcPositionalsType = makeTupleObject(srcTupleTypes, /* isUnpackedTuple */ true);
17471
17504
  // Snip out the portion of the source positionals that map to the variadic
17472
17505
  // dest parameter and replace it with a single parameter that is typed as a
17473
17506
  // tuple containing the individual types of the replaced parameters.
@@ -17675,15 +17708,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17675
17708
  !types_1.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(destType)) {
17676
17709
  let destArgsType = destParamDetails.params[destParamDetails.argsIndex].type;
17677
17710
  let srcArgsType = srcParamDetails.params[srcParamDetails.argsIndex].type;
17678
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
17679
- if (!(0, types_1.isUnpacked)(destArgsType)) {
17680
- destArgsType = types_1.ClassType.cloneForUnpacked(types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: destArgsType, isUnbounded: true }],
17681
- /* isTypeArgumentExplicit */ true)));
17682
- }
17683
- if (!(0, types_1.isUnpacked)(srcArgsType)) {
17684
- srcArgsType = types_1.ClassType.cloneForUnpacked(types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: srcArgsType, isUnbounded: true }],
17685
- /* isTypeArgumentExplicit */ true)));
17686
- }
17711
+ if (!(0, types_1.isUnpacked)(destArgsType)) {
17712
+ destArgsType = makeTupleObject([{ type: destArgsType, isUnbounded: true }], /* isUnpackedTuple */ true);
17713
+ }
17714
+ if (!(0, types_1.isUnpacked)(srcArgsType)) {
17715
+ srcArgsType = makeTupleObject([{ type: srcArgsType, isUnbounded: true }], /* isUnpackedTuple */ true);
17687
17716
  }
17688
17717
  if (!assignFunctionParameter(destArgsType, srcArgsType, destParamDetails.params[destParamDetails.argsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
17689
17718
  canAssign = false;
@@ -18012,6 +18041,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
18012
18041
  // we may be able to narrow the type based on the assignment.
18013
18042
  function narrowTypeBasedOnAssignment(node, declaredType, assignedType) {
18014
18043
  const narrowedType = (0, typeUtils_1.mapSubtypes)(assignedType, (assignedSubtype) => {
18044
+ // Handle the special case where the assigned type is a literal type.
18045
+ // Some types include very large unions of literal types, and we don't
18046
+ // want to use an n^2 loop to compare them.
18047
+ if ((0, types_1.isClass)(assignedSubtype) && (0, typeUtils_1.isLiteralType)(assignedSubtype)) {
18048
+ if ((0, types_1.isUnion)(declaredType) && types_1.UnionType.containsType(declaredType, assignedSubtype)) {
18049
+ return assignedSubtype;
18050
+ }
18051
+ }
18015
18052
  const narrowedSubtype = (0, typeUtils_1.mapSubtypes)(declaredType, (declaredSubtype) => {
18016
18053
  // We can't narrow "Any".
18017
18054
  if ((0, types_1.isAnyOrUnknown)(declaredSubtype)) {