@zzzen/pyright-internal 1.2.0-dev.20240121 → 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 (583) 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 +2 -2
  7. package/dist/analyzer/binder.js.map +1 -1
  8. package/dist/analyzer/cacheManager.js.map +1 -1
  9. package/dist/analyzer/checker.js +139 -98
  10. package/dist/analyzer/checker.js.map +1 -1
  11. package/dist/analyzer/circularDependency.js.map +1 -1
  12. package/dist/analyzer/codeFlowEngine.js +29 -3
  13. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  14. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  15. package/dist/analyzer/codeFlowUtils.js.map +1 -1
  16. package/dist/analyzer/commentUtils.js.map +1 -1
  17. package/dist/analyzer/constraintSolver.d.ts +2 -2
  18. package/dist/analyzer/constraintSolver.js +28 -6
  19. package/dist/analyzer/constraintSolver.js.map +1 -1
  20. package/dist/analyzer/constructorTransform.js +8 -8
  21. package/dist/analyzer/constructorTransform.js.map +1 -1
  22. package/dist/analyzer/constructors.js +1 -1
  23. package/dist/analyzer/constructors.js.map +1 -1
  24. package/dist/analyzer/dataClasses.js +1 -1
  25. package/dist/analyzer/dataClasses.js.map +1 -1
  26. package/dist/analyzer/declaration.js.map +1 -1
  27. package/dist/analyzer/declarationUtils.js.map +1 -1
  28. package/dist/analyzer/decorators.js +1 -1
  29. package/dist/analyzer/decorators.js.map +1 -1
  30. package/dist/analyzer/deprecatedSymbols.js.map +1 -1
  31. package/dist/analyzer/docStringConversion.js.map +1 -1
  32. package/dist/analyzer/docStringUtils.js.map +1 -1
  33. package/dist/analyzer/enums.d.ts +4 -1
  34. package/dist/analyzer/enums.js +29 -25
  35. package/dist/analyzer/enums.js.map +1 -1
  36. package/dist/analyzer/functionTransform.js.map +1 -1
  37. package/dist/analyzer/importResolver.js +1 -1
  38. package/dist/analyzer/importResolver.js.map +1 -1
  39. package/dist/analyzer/importResult.js.map +1 -1
  40. package/dist/analyzer/importStatementUtils.js.map +1 -1
  41. package/dist/analyzer/namedTuples.js +4 -4
  42. package/dist/analyzer/namedTuples.js.map +1 -1
  43. package/dist/analyzer/operations.js +14 -8
  44. package/dist/analyzer/operations.js.map +1 -1
  45. package/dist/analyzer/packageTypeReport.js.map +1 -1
  46. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  47. package/dist/analyzer/parameterUtils.d.ts +1 -0
  48. package/dist/analyzer/parameterUtils.js +5 -1
  49. package/dist/analyzer/parameterUtils.js.map +1 -1
  50. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  51. package/dist/analyzer/parseTreeCleaner.js.map +1 -1
  52. package/dist/analyzer/parseTreeUtils.d.ts +1 -0
  53. package/dist/analyzer/parseTreeUtils.js +4 -3
  54. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  55. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  56. package/dist/analyzer/patternMatching.js +87 -58
  57. package/dist/analyzer/patternMatching.js.map +1 -1
  58. package/dist/analyzer/program.d.ts +1 -1
  59. package/dist/analyzer/program.js +2 -2
  60. package/dist/analyzer/program.js.map +1 -1
  61. package/dist/analyzer/properties.js.map +1 -1
  62. package/dist/analyzer/protocols.js.map +1 -1
  63. package/dist/analyzer/pyTypedUtils.js.map +1 -1
  64. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  65. package/dist/analyzer/regions.js.map +1 -1
  66. package/dist/analyzer/scope.js.map +1 -1
  67. package/dist/analyzer/scopeUtils.js.map +1 -1
  68. package/dist/analyzer/service.js.map +1 -1
  69. package/dist/analyzer/sourceFile.js.map +1 -1
  70. package/dist/analyzer/sourceFileInfo.js +1 -1
  71. package/dist/analyzer/sourceFileInfo.js.map +1 -1
  72. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  73. package/dist/analyzer/sourceMapper.js.map +1 -1
  74. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  75. package/dist/analyzer/staticExpressions.js.map +1 -1
  76. package/dist/analyzer/symbol.js.map +1 -1
  77. package/dist/analyzer/symbolNameUtils.js.map +1 -1
  78. package/dist/analyzer/symbolUtils.js.map +1 -1
  79. package/dist/analyzer/testWalker.js.map +1 -1
  80. package/dist/analyzer/tracePrinter.js.map +1 -1
  81. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  82. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  83. package/dist/analyzer/typeEvaluator.js +352 -310
  84. package/dist/analyzer/typeEvaluator.js.map +1 -1
  85. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  86. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  87. package/dist/analyzer/typeGuards.js +5 -0
  88. package/dist/analyzer/typeGuards.js.map +1 -1
  89. package/dist/analyzer/typePrinter.js.map +1 -1
  90. package/dist/analyzer/typeStubWriter.js.map +1 -1
  91. package/dist/analyzer/typeUtils.d.ts +0 -1
  92. package/dist/analyzer/typeUtils.js +25 -11
  93. package/dist/analyzer/typeUtils.js.map +1 -1
  94. package/dist/analyzer/typeVarContext.d.ts +2 -2
  95. package/dist/analyzer/typeVarContext.js +10 -4
  96. package/dist/analyzer/typeVarContext.js.map +1 -1
  97. package/dist/analyzer/typeWalker.js.map +1 -1
  98. package/dist/analyzer/typedDicts.js +5 -5
  99. package/dist/analyzer/typedDicts.js.map +1 -1
  100. package/dist/analyzer/types.d.ts +7 -3
  101. package/dist/analyzer/types.js +40 -28
  102. package/dist/analyzer/types.js.map +1 -1
  103. package/dist/backgroundAnalysis.js.map +1 -1
  104. package/dist/backgroundAnalysisBase.js.map +1 -1
  105. package/dist/backgroundThreadBase.js.map +1 -1
  106. package/dist/commands/commandController.js.map +1 -1
  107. package/dist/commands/commandResult.js.map +1 -1
  108. package/dist/commands/commands.js.map +1 -1
  109. package/dist/commands/createTypeStub.js.map +1 -1
  110. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  111. package/dist/commands/quickActionCommand.js.map +1 -1
  112. package/dist/commands/restartServer.js.map +1 -1
  113. package/dist/common/cancellationUtils.d.ts +2 -1
  114. package/dist/common/cancellationUtils.js +17 -4
  115. package/dist/common/cancellationUtils.js.map +1 -1
  116. package/dist/common/charCodes.js.map +1 -1
  117. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  118. package/dist/common/collectionUtils.js.map +1 -1
  119. package/dist/common/commandLineOptions.js.map +1 -1
  120. package/dist/common/commandUtils.js.map +1 -1
  121. package/dist/common/configOptions.d.ts +16 -0
  122. package/dist/common/configOptions.js +80 -0
  123. package/dist/common/configOptions.js.map +1 -1
  124. package/dist/common/console.js.map +1 -1
  125. package/dist/common/core.js.map +1 -1
  126. package/dist/common/crypto.js.map +1 -1
  127. package/dist/common/debug.js.map +1 -1
  128. package/dist/common/deferred.js.map +1 -1
  129. package/dist/common/diagnostic.js.map +1 -1
  130. package/dist/common/diagnosticRules.d.ts +16 -0
  131. package/dist/common/diagnosticRules.js +16 -0
  132. package/dist/common/diagnosticRules.js.map +1 -1
  133. package/dist/common/diagnosticSink.js.map +1 -1
  134. package/dist/common/editAction.js.map +1 -1
  135. package/dist/common/envVarUtils.d.ts +2 -1
  136. package/dist/common/envVarUtils.js +5 -1
  137. package/dist/common/envVarUtils.js.map +1 -1
  138. package/dist/common/extensibility.js.map +1 -1
  139. package/dist/common/extensions.js.map +1 -1
  140. package/dist/common/fileBasedCancellationUtils.js.map +1 -1
  141. package/dist/common/fileSystem.js.map +1 -1
  142. package/dist/common/fileWatcher.js.map +1 -1
  143. package/dist/common/fullAccessHost.js +1 -1
  144. package/dist/common/fullAccessHost.js.map +1 -1
  145. package/dist/common/host.js.map +1 -1
  146. package/dist/common/logTracker.js.map +1 -1
  147. package/dist/common/lspUtils.js.map +1 -1
  148. package/dist/common/memUtils.js.map +1 -1
  149. package/dist/common/pathConsts.js.map +1 -1
  150. package/dist/common/pathUtils.js.map +1 -1
  151. package/dist/common/positionUtils.js.map +1 -1
  152. package/dist/common/progressReporter.js.map +1 -1
  153. package/dist/common/pythonVersion.js.map +1 -1
  154. package/dist/common/realFileSystem.js +1 -1
  155. package/dist/common/realFileSystem.js.map +1 -1
  156. package/dist/common/serviceProvider.js.map +1 -1
  157. package/dist/common/serviceProviderExtensions.js.map +1 -1
  158. package/dist/common/stringUtils.js.map +1 -1
  159. package/dist/common/textEditTracker.js.map +1 -1
  160. package/dist/common/textRange.js.map +1 -1
  161. package/dist/common/textRangeCollection.js.map +1 -1
  162. package/dist/common/timing.js.map +1 -1
  163. package/dist/common/uri/baseUri.d.ts +2 -0
  164. package/dist/common/uri/baseUri.js +7 -7
  165. package/dist/common/uri/baseUri.js.map +1 -1
  166. package/dist/common/uri/emptyUri.d.ts +2 -0
  167. package/dist/common/uri/emptyUri.js +6 -0
  168. package/dist/common/uri/emptyUri.js.map +1 -1
  169. package/dist/common/uri/fileUri.d.ts +6 -4
  170. package/dist/common/uri/fileUri.js +18 -9
  171. package/dist/common/uri/fileUri.js.map +1 -1
  172. package/dist/common/uri/memoization.js.map +1 -1
  173. package/dist/common/uri/uri.d.ts +8 -0
  174. package/dist/common/uri/uri.js +16 -7
  175. package/dist/common/uri/uri.js.map +1 -1
  176. package/dist/common/uri/uriUtils.js.map +1 -1
  177. package/dist/common/uri/webUri.d.ts +3 -1
  178. package/dist/common/uri/webUri.js +21 -8
  179. package/dist/common/uri/webUri.js.map +1 -1
  180. package/dist/common/workspaceEditUtils.js.map +1 -1
  181. package/dist/languageServerBase.js.map +1 -1
  182. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  183. package/dist/languageService/autoImporter.js.map +1 -1
  184. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  185. package/dist/languageService/codeActionProvider.js.map +1 -1
  186. package/dist/languageService/completionProvider.js +9 -1
  187. package/dist/languageService/completionProvider.js.map +1 -1
  188. package/dist/languageService/completionProviderUtils.js.map +1 -1
  189. package/dist/languageService/definitionProvider.js.map +1 -1
  190. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  191. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  192. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  193. package/dist/languageService/hoverProvider.js.map +1 -1
  194. package/dist/languageService/importSorter.js.map +1 -1
  195. package/dist/languageService/navigationUtils.js.map +1 -1
  196. package/dist/languageService/quickActions.js.map +1 -1
  197. package/dist/languageService/referencesProvider.js +11 -1
  198. package/dist/languageService/referencesProvider.js.map +1 -1
  199. package/dist/languageService/renameProvider.js.map +1 -1
  200. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  201. package/dist/languageService/symbolIndexer.js.map +1 -1
  202. package/dist/languageService/tooltipUtils.js.map +1 -1
  203. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  204. package/dist/localization/localize.d.ts +15 -2
  205. package/dist/localization/localize.js +7 -2
  206. package/dist/localization/localize.js.map +1 -1
  207. package/dist/localization/package.nls.cs.json +15 -7
  208. package/dist/localization/package.nls.de.json +17 -9
  209. package/dist/localization/package.nls.en-us.json +7 -2
  210. package/dist/localization/package.nls.es.json +16 -8
  211. package/dist/localization/package.nls.fr.json +16 -8
  212. package/dist/localization/package.nls.it.json +16 -8
  213. package/dist/localization/package.nls.ja.json +17 -9
  214. package/dist/localization/package.nls.ko.json +14 -6
  215. package/dist/localization/package.nls.pl.json +14 -6
  216. package/dist/localization/package.nls.pt-br.json +17 -9
  217. package/dist/localization/package.nls.qps-ploc.json +12 -4
  218. package/dist/localization/package.nls.ru.json +17 -9
  219. package/dist/localization/package.nls.tr.json +16 -8
  220. package/dist/localization/package.nls.zh-cn.json +17 -9
  221. package/dist/localization/package.nls.zh-tw.json +17 -9
  222. package/dist/nodeMain.js.map +1 -1
  223. package/dist/nodeServer.js.map +1 -1
  224. package/dist/parser/characterStream.js.map +1 -1
  225. package/dist/parser/characters.js.map +1 -1
  226. package/dist/parser/parseNodes.js.map +1 -1
  227. package/dist/parser/parser.js.map +1 -1
  228. package/dist/parser/stringTokenUtils.js.map +1 -1
  229. package/dist/parser/tokenizer.js.map +1 -1
  230. package/dist/parser/tokenizerTypes.js.map +1 -1
  231. package/dist/parser/unicode.js.map +1 -1
  232. package/dist/pprof/profiler.js.map +1 -1
  233. package/dist/pyright.js.map +1 -1
  234. package/dist/pyrightFileSystem.js.map +1 -1
  235. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  236. package/dist/server.d.ts +2 -1
  237. package/dist/server.js +9 -7
  238. package/dist/server.js.map +1 -1
  239. package/dist/tests/cacheManager.test.js.map +1 -1
  240. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  241. package/dist/tests/checker.test.js.map +1 -1
  242. package/dist/tests/classDeclaration.test.js.map +1 -1
  243. package/dist/tests/collectionUtils.test.js.map +1 -1
  244. package/dist/tests/common.test.js.map +1 -1
  245. package/dist/tests/completions.test.js +23 -0
  246. package/dist/tests/completions.test.js.map +1 -1
  247. package/dist/tests/config.test.js +1 -2
  248. package/dist/tests/config.test.js.map +1 -1
  249. package/dist/tests/debug.test.js.map +1 -1
  250. package/dist/tests/deferred.test.js.map +1 -1
  251. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  252. package/dist/tests/diagnostics.test.js.map +1 -1
  253. package/dist/tests/docStringConversion.test.js.map +1 -1
  254. package/dist/tests/docStringUtils.test.js.map +1 -1
  255. package/dist/tests/documentSymbolCollector.test.js.map +1 -1
  256. package/dist/tests/envVarUtils.test.d.ts +1 -0
  257. package/dist/tests/envVarUtils.test.js +130 -0
  258. package/dist/tests/envVarUtils.test.js.map +1 -0
  259. package/dist/tests/filesystem.test.js.map +1 -1
  260. package/dist/tests/fourSlashParser.test.js.map +1 -1
  261. package/dist/tests/fourSlashRunner.test.js.map +1 -1
  262. package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -1
  263. package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -1
  264. package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js.map +1 -1
  265. package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js.map +1 -1
  266. package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -1
  267. package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -1
  268. package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -1
  269. package/dist/tests/fourslash/completions.autoimport.lib.alias.fourslash.js.map +1 -1
  270. package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -1
  271. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  272. package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -1
  273. package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -1
  274. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  275. package/dist/tests/fourslash/completions.builtinOverride.fourslash.js.map +1 -1
  276. package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -1
  277. package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
  278. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
  279. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
  280. package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
  281. package/dist/tests/fourslash/completions.comment.fourslash.js.map +1 -1
  282. package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -1
  283. package/dist/tests/fourslash/completions.declNames.exception.fourslash.js.map +1 -1
  284. package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -1
  285. package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js.map +1 -1
  286. package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -1
  287. package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -1
  288. package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -1
  289. package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -1
  290. package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -1
  291. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
  292. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
  293. package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -1
  294. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
  295. package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -1
  296. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -1
  297. package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -1
  298. package/dist/tests/fourslash/completions.enums.members.fourslash.js.map +1 -1
  299. package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -1
  300. package/dist/tests/fourslash/completions.excluded.fourslash.js.map +1 -1
  301. package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
  302. package/dist/tests/fourslash/completions.fstring.fourslash.js.map +1 -1
  303. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
  304. package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js.map +1 -1
  305. package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +1 -1
  306. package/dist/tests/fourslash/completions.importInterimFile.fourslash.disabled.js.map +1 -1
  307. package/dist/tests/fourslash/completions.importPrivateNoPytyped.fourslash.js.map +1 -1
  308. package/dist/tests/fourslash/completions.importPytyped.fourslash.js.map +1 -1
  309. package/dist/tests/fourslash/completions.importPytypedLocal.fourslash.js.map +1 -1
  310. package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +1 -1
  311. package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js.map +1 -1
  312. package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -1
  313. package/dist/tests/fourslash/completions.included.fourslash.js.map +1 -1
  314. package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -1
  315. package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js.map +1 -1
  316. package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -1
  317. package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -1
  318. package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js.map +1 -1
  319. package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js.map +1 -1
  320. package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -1
  321. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
  322. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
  323. package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
  324. package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -1
  325. package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
  326. package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js.map +1 -1
  327. package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js.map +1 -1
  328. package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js.map +1 -1
  329. package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -1
  330. package/dist/tests/fourslash/completions.override.default.fourslash.js.map +1 -1
  331. package/dist/tests/fourslash/completions.override.default.importStub.js.map +1 -1
  332. package/dist/tests/fourslash/completions.override.default.imported.fourslash.js.map +1 -1
  333. package/dist/tests/fourslash/completions.override.default.stub.fourslash.js.map +1 -1
  334. package/dist/tests/fourslash/completions.override.fourslash.js.map +1 -1
  335. package/dist/tests/fourslash/completions.override.property.fourslash.js.map +1 -1
  336. package/dist/tests/fourslash/completions.override.property.stub.fourslash.js.map +1 -1
  337. package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -1
  338. package/dist/tests/fourslash/completions.override.stub.fourslash.js.map +1 -1
  339. package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
  340. package/dist/tests/fourslash/completions.parameters.fourslash.js.map +1 -1
  341. package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -1
  342. package/dist/tests/fourslash/completions.parentFolder.fourslash.js.map +1 -1
  343. package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -1
  344. package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
  345. package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -1
  346. package/dist/tests/fourslash/completions.property.fourslash.js.map +1 -1
  347. package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js.map +1 -1
  348. package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
  349. package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -1
  350. package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
  351. package/dist/tests/fourslash/completions.triggers.fourslash.js.map +1 -1
  352. package/dist/tests/fourslash/completions.typeAlias.fourslash.js.map +1 -1
  353. package/dist/tests/fourslash/completions.typeshed.fourslash.js.map +1 -1
  354. package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -1
  355. package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -1
  356. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
  357. package/dist/tests/fourslash/completions.with.fourslash.js.map +1 -1
  358. package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -1
  359. package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -1
  360. package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -1
  361. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -1
  362. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -1
  363. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -1
  364. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -1
  365. package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -1
  366. package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -1
  367. package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -1
  368. package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -1
  369. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  370. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -1
  371. package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -1
  372. package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -1
  373. package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -1
  374. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -1
  375. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -1
  376. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -1
  377. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -1
  378. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -1
  379. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -1
  380. package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -1
  381. package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -1
  382. package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -1
  383. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -1
  384. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -1
  385. package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -1
  386. package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -1
  387. package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -1
  388. package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -1
  389. package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -1
  390. package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -1
  391. package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -1
  392. package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -1
  393. package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -1
  394. package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -1
  395. package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -1
  396. package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -1
  397. package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -1
  398. package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -1
  399. package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -1
  400. package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -1
  401. package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -1
  402. package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -1
  403. package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -1
  404. package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -1
  405. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -1
  406. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -1
  407. package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -1
  408. package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -1
  409. package/dist/tests/fourslash/fourslash.js.map +1 -1
  410. package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -1
  411. package/dist/tests/fourslash/hover.async.fourslash.js.map +1 -1
  412. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  413. package/dist/tests/fourslash/hover.class.docString.fourslash.js.map +1 -1
  414. package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -1
  415. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
  416. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
  417. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
  418. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
  419. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
  420. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
  421. package/dist/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.js.map +1 -1
  422. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
  423. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
  424. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
  425. package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
  426. package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js.map +1 -1
  427. package/dist/tests/fourslash/hover.docstring.parameter.fourslash.js.map +1 -1
  428. package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
  429. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -1
  430. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -1
  431. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -1
  432. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -1
  433. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -1
  434. package/dist/tests/fourslash/hover.formatted.fourslash.js.map +1 -1
  435. package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
  436. package/dist/tests/fourslash/hover.import.django.view.fourslash.js.map +1 -1
  437. package/dist/tests/fourslash/hover.import.fourslash.js.map +1 -1
  438. package/dist/tests/fourslash/hover.inferred.fourslash.js.map +1 -1
  439. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  440. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
  441. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  442. package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -1
  443. package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -1
  444. package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js.map +1 -1
  445. package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js.map +1 -1
  446. package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
  447. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
  448. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
  449. package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
  450. package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js.map +1 -1
  451. package/dist/tests/fourslash/hover.overloadedFunction.fourslash.js.map +1 -1
  452. package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
  453. package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -1
  454. package/dist/tests/fourslash/hover.typedDict.key.fourslash.js.map +1 -1
  455. package/dist/tests/fourslash/hover.unpackedTypedDict.key.fourslash.js.map +1 -1
  456. package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -1
  457. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
  458. package/dist/tests/fourslash/import.multipart.fourslash.js.map +1 -1
  459. package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -1
  460. package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js.map +1 -1
  461. package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js.map +1 -1
  462. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
  463. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
  464. package/dist/tests/fourslash/import.wildcard.fourslash.js.map +1 -1
  465. package/dist/tests/fourslash/importnotresolved.fourslash.js.map +1 -1
  466. package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js.map +1 -1
  467. package/dist/tests/fourslash/missingModuleSource.fourslash.js.map +1 -1
  468. package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -1
  469. package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js.map +1 -1
  470. package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js.map +1 -1
  471. package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js.map +1 -1
  472. package/dist/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.js.map +1 -1
  473. package/dist/tests/fourslash/missingTypeStub.fourslash.js.map +1 -1
  474. package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js.map +1 -1
  475. package/dist/tests/fourslash/noerrors.fourslash.js.map +1 -1
  476. package/dist/tests/fourslash/orderImports1.command.fourslash.js.map +1 -1
  477. package/dist/tests/fourslash/orderImports2.command.fourslash.js.map +1 -1
  478. package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -1
  479. package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -1
  480. package/dist/tests/fourslash/rename.fourslash.js.map +1 -1
  481. package/dist/tests/fourslash/rename.function.untitledFile.fourslash.js.map +1 -1
  482. package/dist/tests/fourslash/rename.init.fourslash.js.map +1 -1
  483. package/dist/tests/fourslash/rename.library.fourslash.js.map +1 -1
  484. package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js.map +1 -1
  485. package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +1 -1
  486. package/dist/tests/fourslash/rename.multipleDecl.fourslash.js.map +1 -1
  487. package/dist/tests/fourslash/rename.parens.fourslash.js.map +1 -1
  488. package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -1
  489. package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -1
  490. package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -1
  491. package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -1
  492. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.js.map +1 -1
  493. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.js.map +1 -1
  494. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.js.map +1 -1
  495. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.js.map +1 -1
  496. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.js.map +1 -1
  497. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.js.map +1 -1
  498. package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -1
  499. package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
  500. package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -1
  501. package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -1
  502. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
  503. package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -1
  504. package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -1
  505. package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -1
  506. package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -1
  507. package/dist/tests/fourslash/typeVerifier.fourslash.js.map +1 -1
  508. package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
  509. package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
  510. package/dist/tests/harness/fourslash/runner.js +1 -1
  511. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  512. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  513. package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
  514. package/dist/tests/harness/fourslash/testState.d.ts +0 -13
  515. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  516. package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
  517. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  518. package/dist/tests/harness/testAccessHost.js.map +1 -1
  519. package/dist/tests/harness/testHost.js.map +1 -1
  520. package/dist/tests/harness/utils.js.map +1 -1
  521. package/dist/tests/harness/vfs/factory.js.map +1 -1
  522. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  523. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  524. package/dist/tests/hoverProvider.test.js.map +1 -1
  525. package/dist/tests/importResolver.test.js.map +1 -1
  526. package/dist/tests/importStatementUtils.test.js.map +1 -1
  527. package/dist/tests/ipythonMode.test.js.map +1 -1
  528. package/dist/tests/languageServer.test.d.ts +1 -0
  529. package/dist/tests/languageServer.test.js +137 -0
  530. package/dist/tests/languageServer.test.js.map +1 -0
  531. package/dist/tests/localizer.test.js.map +1 -1
  532. package/dist/tests/logger.test.js.map +1 -1
  533. package/dist/tests/lsp/customLsp.d.ts +112 -0
  534. package/dist/tests/lsp/customLsp.js +67 -0
  535. package/dist/tests/lsp/customLsp.js.map +1 -0
  536. package/dist/tests/lsp/languageServer.d.ts +1 -0
  537. package/dist/tests/lsp/languageServer.js +326 -0
  538. package/dist/tests/lsp/languageServer.js.map +1 -0
  539. package/dist/tests/lsp/languageServerTestUtils.d.ts +100 -0
  540. package/dist/tests/lsp/languageServerTestUtils.js +803 -0
  541. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -0
  542. package/dist/tests/lsp/main.d.ts +1 -0
  543. package/dist/tests/lsp/main.js +12 -0
  544. package/dist/tests/lsp/main.js.map +1 -0
  545. package/dist/tests/lsp/webpack.testserver.config.d.ts +4 -0
  546. package/dist/tests/lsp/webpack.testserver.config.js +64 -0
  547. package/dist/tests/lsp/webpack.testserver.config.js.map +1 -0
  548. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  549. package/dist/tests/parser.test.js.map +1 -1
  550. package/dist/tests/pathUtils.test.js.map +1 -1
  551. package/dist/tests/positionUtils.test.js.map +1 -1
  552. package/dist/tests/pyrightFileSystem.test.js.map +1 -1
  553. package/dist/tests/serialization.test.js.map +1 -1
  554. package/dist/tests/service.test.js.map +1 -1
  555. package/dist/tests/signatureHelp.test.js.map +1 -1
  556. package/dist/tests/sourceFile.test.js.map +1 -1
  557. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  558. package/dist/tests/stringUtils.test.js.map +1 -1
  559. package/dist/tests/symbolNameUtils.test.js.map +1 -1
  560. package/dist/tests/testState.test.js.map +1 -1
  561. package/dist/tests/testStateUtils.js.map +1 -1
  562. package/dist/tests/testUtils.js.map +1 -1
  563. package/dist/tests/textEditUtil.test.js.map +1 -1
  564. package/dist/tests/textRange.test.js.map +1 -1
  565. package/dist/tests/tokenizer.test.js.map +1 -1
  566. package/dist/tests/typeEvaluator1.test.js +12 -8
  567. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  568. package/dist/tests/typeEvaluator2.test.js +7 -3
  569. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  570. package/dist/tests/typeEvaluator3.test.js +2 -2
  571. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  572. package/dist/tests/typeEvaluator4.test.js +2 -2
  573. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  574. package/dist/tests/typeEvaluator5.test.js +1 -1
  575. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  576. package/dist/tests/typePrinter.test.js.map +1 -1
  577. package/dist/tests/uri.test.js +74 -26
  578. package/dist/tests/uri.test.js.map +1 -1
  579. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  580. package/dist/tests/zipfs.test.js.map +1 -1
  581. package/dist/workspaceFactory.js +2 -1
  582. package/dist/workspaceFactory.js.map +1 -1
  583. 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);
@@ -2188,7 +2192,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2188
2192
  if (expectedTypeDiagAddendum) {
2189
2193
  diagAddendum = expectedTypeDiagAddendum;
2190
2194
  }
2191
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAssignmentMismatch().format(printSrcDestTypes(type, declaredType)) +
2195
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssignmentType, localize_1.LocMessage.typeAssignmentMismatch().format(printSrcDestTypes(type, declaredType)) +
2192
2196
  diagAddendum.getString(), srcExpression !== null && srcExpression !== void 0 ? srcExpression : nameNode, (_c = (_b = diagAddendum.getEffectiveTextRange()) !== null && _b !== void 0 ? _b : srcExpression) !== null && _c !== void 0 ? _c : nameNode);
2193
2197
  // Replace the assigned type with the (unnarrowed) declared type.
2194
2198
  destType = declaredType;
@@ -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
  }
@@ -2441,7 +2446,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
2441
2446
  }
2442
2447
  });
2443
2448
  if (!diagAddendum.isEmpty()) {
2444
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, (target.nodeType === 31 /* ParseNodeType.List */
2449
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssignmentType, (target.nodeType === 31 /* ParseNodeType.List */
2445
2450
  ? localize_1.LocMessage.listAssignmentMismatch()
2446
2451
  : localize_1.LocMessage.tupleAssignmentMismatch()).format({
2447
2452
  type: printType(type),
@@ -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
  }
@@ -3018,7 +3020,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3018
3020
  if (effectiveTypeInfo.includesIllegalTypeAliasDecl ||
3019
3021
  !types_1.TypeBase.isInstantiable(type) ||
3020
3022
  (flags & 2 /* EvaluatorFlags.DoNotSpecialize */) !== 0) {
3021
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAnnotationVariable(), node);
3023
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeAnnotationVariable(), node);
3022
3024
  type = types_1.UnknownType.create();
3023
3025
  }
3024
3026
  }
@@ -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();
@@ -3655,7 +3656,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3655
3656
  }
3656
3657
  if (!type) {
3657
3658
  if (!isIncomplete) {
3658
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.moduleUnknownMember().format({
3659
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAttributeAccessIssue, localize_1.LocMessage.moduleUnknownMember().format({
3659
3660
  memberName,
3660
3661
  moduleName: baseType.moduleName,
3661
3662
  }), node.memberName);
@@ -3741,7 +3742,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
3741
3742
  }
3742
3743
  const rule = isFunctionRule
3743
3744
  ? diagnosticRules_1.DiagnosticRule.reportFunctionMemberAccess
3744
- : diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues;
3745
+ : diagnosticRules_1.DiagnosticRule.reportAttributeAccessIssue;
3745
3746
  addDiagnostic(rule, diagMessage.format({ name: memberName, type: printType(baseType) }) + diag.getString(), node.memberName, (_a = diag.getEffectiveTextRange()) !== null && _a !== void 0 ? _a : node.memberName);
3746
3747
  }
3747
3748
  // If this is member access on a function, use "Any" so if the
@@ -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
  }
@@ -4732,7 +4727,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
4732
4727
  const itemMethodType = getBoundMagicMethod(concreteSubtype, getIndexAccessMagicMethodName(usage));
4733
4728
  if ((flags & 256 /* EvaluatorFlags.ExpectingTypeAnnotation */) !== 0) {
4734
4729
  // If the class doesn't derive from Generic, a type argument should not be allowed.
4735
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeArgsExpectingNone().format({
4730
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeArgsExpectingNone().format({
4736
4731
  name: printType(types_1.ClassType.cloneAsInstance(concreteSubtype)),
4737
4732
  }), node);
4738
4733
  }
@@ -4800,7 +4795,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
4800
4795
  return concreteSubtype;
4801
4796
  }
4802
4797
  if (concreteSubtype.typeArguments) {
4803
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.classAlreadySpecialized().format({
4798
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.classAlreadySpecialized().format({
4804
4799
  type: printType((0, typeUtils_1.convertToInstance)(concreteSubtype), { expandTypeAlias: true }),
4805
4800
  }), node.baseExpression);
4806
4801
  return concreteSubtype;
@@ -4837,7 +4832,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
4837
4832
  return types_1.UnknownType.create();
4838
4833
  }
4839
4834
  if (!isIncomplete) {
4840
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeNotSubscriptable().format({ type: printType(concreteSubtype) }), node.baseExpression);
4835
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIndexIssue, localize_1.LocMessage.typeNotSubscriptable().format({ type: printType(concreteSubtype) }), node.baseExpression);
4841
4836
  }
4842
4837
  return types_1.UnknownType.create();
4843
4838
  });
@@ -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
  }
@@ -4968,7 +4961,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
4968
4961
  const magicMethodName = getIndexAccessMagicMethodName(usage);
4969
4962
  const itemMethodType = getBoundMagicMethod(baseType, magicMethodName, selfType);
4970
4963
  if (!itemMethodType) {
4971
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.methodNotDefinedOnType().format({
4964
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIndexIssue, localize_1.LocMessage.methodNotDefinedOnType().format({
4972
4965
  name: magicMethodName,
4973
4966
  type: printType(baseType),
4974
4967
  }), node.baseExpression);
@@ -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;
@@ -5324,7 +5318,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5324
5318
  // a zero-length tuple.
5325
5319
  const diag = new diagnostic_1.DiagnosticAddendum();
5326
5320
  diag.addMessage(localize_1.LocAddendum.useTupleInstead());
5327
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.tupleInAnnotation() + diag.getString(), node);
5321
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.tupleInAnnotation() + diag.getString(), node);
5328
5322
  return { type: types_1.UnknownType.create() };
5329
5323
  }
5330
5324
  if ((flags & 128 /* EvaluatorFlags.ExpectingInstantiableType */) !== 0 &&
@@ -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() };
@@ -5493,7 +5483,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5493
5483
  node.leftExpression.value === 'type') {
5494
5484
  const diag = new diagnostic_1.DiagnosticAddendum();
5495
5485
  diag.addMessage(localize_1.LocAddendum.useTypeInstead());
5496
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeCallNotAllowed() + diag.getString(), node);
5486
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeCallNotAllowed() + diag.getString(), node);
5497
5487
  }
5498
5488
  // Handle immediate calls of lambdas specially.
5499
5489
  if (node.leftExpression.nodeType === 30 /* ParseNodeType.Lambda */) {
@@ -5593,7 +5583,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5593
5583
  }
5594
5584
  }
5595
5585
  if ((flags & 256 /* EvaluatorFlags.ExpectingTypeAnnotation */) !== 0) {
5596
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAnnotationCall(), node);
5586
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeAnnotationCall(), node);
5597
5587
  typeResult = { type: types_1.UnknownType.create() };
5598
5588
  }
5599
5589
  return typeResult;
@@ -5662,7 +5652,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5662
5652
  const assertedType = (0, typeUtils_1.convertToInstance)(getTypeOfArgumentExpectingType(node.arguments[1]).type);
5663
5653
  if (!(0, types_1.isTypeSame)(assertedType, arg0TypeResult.type, { treatAnySameAsUnknown: true, ignorePseudoGeneric: true })) {
5664
5654
  const srcDestTypes = printSrcDestTypes(arg0TypeResult.type, assertedType, { expandTypeAlias: true });
5665
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.assertTypeTypeMismatch().format({
5655
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssertTypeFailure, localize_1.LocMessage.assertTypeTypeMismatch().format({
5666
5656
  expected: srcDestTypes.destType,
5667
5657
  received: srcDestTypes.sourceType,
5668
5658
  }), node.arguments[0].valueExpression);
@@ -5777,7 +5767,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5777
5767
  targetClassType = getTypeOfExpression(node.arguments[0].valueExpression).type;
5778
5768
  const concreteTargetClassType = makeTopLevelTypeVarsConcrete(targetClassType);
5779
5769
  if (!(0, types_1.isAnyOrUnknown)(concreteTargetClassType) && !(0, types_1.isInstantiableClass)(concreteTargetClassType)) {
5780
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.superCallFirstArg().format({ type: printType(targetClassType) }), node.arguments[0].valueExpression);
5770
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportArgumentType, localize_1.LocMessage.superCallFirstArg().format({ type: printType(targetClassType) }), node.arguments[0].valueExpression);
5781
5771
  }
5782
5772
  }
5783
5773
  else {
@@ -5829,7 +5819,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
5829
5819
  reportError = true;
5830
5820
  }
5831
5821
  if (reportError) {
5832
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.superCallSecondArg().format({ type: printType(targetClassType) }), node.arguments[1].valueExpression);
5822
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportArgumentType, localize_1.LocMessage.superCallSecondArg().format({ type: printType(targetClassType) }), node.arguments[1].valueExpression);
5833
5823
  return { type: types_1.UnknownType.create() };
5834
5824
  }
5835
5825
  }
@@ -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) &&
@@ -6264,7 +6261,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6264
6261
  return typeString;
6265
6262
  });
6266
6263
  diagAddendum.addMessage(localize_1.LocAddendum.argumentTypes().format({ types: argTypes.join(', ') }));
6267
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.noOverload().format({ name: functionName }) + diagAddendum.getString(), errorNode);
6264
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.noOverload().format({ name: functionName }) + diagAddendum.getString(), errorNode);
6268
6265
  }
6269
6266
  return { argumentErrors: true, isTypeIncomplete, overloadsUsedForCall: [] };
6270
6267
  }
@@ -6284,7 +6281,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6284
6281
  // was possible and emit a diagnostic that provides the most likely.
6285
6282
  if (emitNoOverloadFoundError) {
6286
6283
  const functionName = bestMatch.overload.details.name || '<anonymous function>';
6287
- const diagnostic = addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.noOverload().format({ name: functionName }), errorNode);
6284
+ const diagnostic = addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.noOverload().format({ name: functionName }), errorNode);
6288
6285
  const overrideDecl = bestMatch.overload.details.declaration;
6289
6286
  if (diagnostic && overrideDecl) {
6290
6287
  diagnostic.addRelatedInfo(localize_1.LocAddendum.overloadIndex().format({ index: bestMatch.overloadIndex + 1 }), overrideDecl.uri, overrideDecl.range);
@@ -6415,8 +6412,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6415
6412
  // Special forms are not callable.
6416
6413
  if (callTypeResult.type.specialForm) {
6417
6414
  const exprNode = errorNode.nodeType === 9 /* ParseNodeType.Call */ ? errorNode.leftExpression : errorNode;
6418
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.objectNotCallable().format({
6419
- type: printType(callTypeResult.type, { expandTypeAlias: true }),
6415
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.objectNotCallable().format({
6416
+ type: printType(callTypeResult.type.specialForm, { expandTypeAlias: true }),
6420
6417
  }), exprNode);
6421
6418
  return { returnType: types_1.UnknownType.create(), argumentErrors: true, overloadsUsedForCall };
6422
6419
  }
@@ -6495,7 +6492,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6495
6492
  return validateCallArguments(errorNode, argList, { type: (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(expandedCallType), isIncomplete: isCallTypeIncomplete }, typeVarContext, skipUnknownArgCheck, inferenceContext, recursionCount);
6496
6493
  }
6497
6494
  case 7 /* TypeCategory.Module */: {
6498
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.moduleNotCallable(), errorNode);
6495
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.moduleNotCallable(), errorNode);
6499
6496
  return { argumentErrors: true };
6500
6497
  }
6501
6498
  }
@@ -6504,7 +6501,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6504
6501
  function validateCallForFunction(errorNode, argList, expandedCallType, isCallTypeIncomplete, typeVarContext, skipUnknownArgCheck, inferenceContext) {
6505
6502
  var _a;
6506
6503
  if (types_1.TypeBase.isInstantiable(expandedCallType)) {
6507
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.callableNotInstantiable().format({
6504
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.callableNotInstantiable().format({
6508
6505
  type: printType(expandedCallType),
6509
6506
  }), errorNode);
6510
6507
  return { returnType: undefined, argumentErrors: true };
@@ -6671,7 +6668,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6671
6668
  function validateCallForInstantiableClass(errorNode, argList, expandedCallType, unexpandedCallType, skipUnknownArgCheck, inferenceContext) {
6672
6669
  var _a, _b;
6673
6670
  if (expandedCallType.literalValue !== undefined) {
6674
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.literalNotCallable(), errorNode);
6671
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.literalNotCallable(), errorNode);
6675
6672
  return { returnType: types_1.UnknownType.create(), argumentErrors: true };
6676
6673
  }
6677
6674
  if (types_1.ClassType.isBuiltIn(expandedCallType)) {
@@ -6679,7 +6676,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6679
6676
  // Handle a call to a metaclass explicitly.
6680
6677
  if ((0, typeUtils_1.isInstantiableMetaclass)(expandedCallType)) {
6681
6678
  if (expandedCallType.typeArguments && expandedCallType.isTypeArgumentExplicit) {
6682
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.objectNotCallable().format({
6679
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.objectNotCallable().format({
6683
6680
  type: printType(expandedCallType),
6684
6681
  }), errorNode);
6685
6682
  return { returnType: types_1.UnknownType.create(), argumentErrors: true };
@@ -6751,7 +6748,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6751
6748
  return { returnType: createNewType(errorNode, argList) };
6752
6749
  }
6753
6750
  if (types_1.ClassType.isSpecialFormClass(expandedCallType)) {
6754
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeNotIntantiable().format({ type: className }), errorNode);
6751
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeNotIntantiable().format({ type: className }), errorNode);
6755
6752
  return { returnType: types_1.UnknownType.create(), argumentErrors: true };
6756
6753
  }
6757
6754
  if (className === 'TypedDict') {
@@ -6793,14 +6790,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6793
6790
  }
6794
6791
  }
6795
6792
  });
6796
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.instantiateAbstract().format({
6793
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAbstractUsage, localize_1.LocMessage.instantiateAbstract().format({
6797
6794
  type: expandedCallType.details.name,
6798
6795
  }) + diagAddendum.getString(), errorNode);
6799
6796
  }
6800
6797
  }
6801
6798
  if (types_1.ClassType.isProtocolClass(expandedCallType) && !expandedCallType.includeSubclasses) {
6802
6799
  // If the class is a protocol, it can't be instantiated.
6803
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.instantiateProtocol().format({
6800
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAbstractUsage, localize_1.LocMessage.instantiateProtocol().format({
6804
6801
  type: expandedCallType.details.name,
6805
6802
  }), errorNode);
6806
6803
  }
@@ -6848,7 +6845,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
6848
6845
  /* selfType */ undefined, recursionCount);
6849
6846
  const callMethodType = callMethodResult === null || callMethodResult === void 0 ? void 0 : callMethodResult.type;
6850
6847
  if (!callMethodType) {
6851
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.objectNotCallable().format({
6848
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.objectNotCallable().format({
6852
6849
  type: printType(expandedCallType),
6853
6850
  }), errorNode);
6854
6851
  return { returnType: types_1.UnknownType.create(), argumentErrors: true };
@@ -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;
@@ -7049,7 +7046,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7049
7046
  if (argIndex < positionalOnlyLimitIndex && argList[argIndex].name) {
7050
7047
  const nameNode = argList[argIndex].name;
7051
7048
  if (nameNode) {
7052
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.argPositional(), nameNode);
7049
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.argPositional(), nameNode);
7053
7050
  reportedArgError = true;
7054
7051
  }
7055
7052
  }
@@ -7083,7 +7080,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7083
7080
  }
7084
7081
  if (tooManyPositionals) {
7085
7082
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7086
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, positionParamLimitIndex === 1
7083
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, positionParamLimitIndex === 1
7087
7084
  ? localize_1.LocMessage.argPositionalExpectedOne()
7088
7085
  : localize_1.LocMessage.argPositionalExpectedCount().format({
7089
7086
  expected: positionParamLimitIndex,
@@ -7116,7 +7113,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7116
7113
  argTypeResult.type.paramSpecAccess === 'args' &&
7117
7114
  paramDetails.params[paramIndex].param.category !== 1 /* ParameterCategory.ArgsList */) {
7118
7115
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7119
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, positionParamLimitIndex === 1
7116
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, positionParamLimitIndex === 1
7120
7117
  ? localize_1.LocMessage.argPositionalExpectedOne()
7121
7118
  : localize_1.LocMessage.argPositionalExpectedCount().format({
7122
7119
  expected: positionParamLimitIndex,
@@ -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,15 +7171,15 @@ 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
7183
7179
  // parameter unless the argument is a variadic arg as well.
7184
7180
  if (isParamVariadic && !isArgCompatibleWithVariadic) {
7185
7181
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7186
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.unpackedArgWithVariadicParam(), argList[argIndex].valueExpression || errorNode);
7182
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.unpackedArgWithVariadicParam(), argList[argIndex].valueExpression || errorNode);
7187
7183
  }
7188
7184
  reportedArgError = true;
7189
7185
  }
@@ -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,
@@ -7241,7 +7237,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7241
7237
  if (remainingArgCount < remainingParamCount) {
7242
7238
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7243
7239
  // Have we run out of arguments and still have parameters left to fill?
7244
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, remainingArgCount === 1
7240
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, remainingArgCount === 1
7245
7241
  ? localize_1.LocMessage.argMorePositionalExpectedOne()
7246
7242
  : localize_1.LocMessage.argMorePositionalExpectedCount().format({
7247
7243
  expected: remainingArgCount,
@@ -7323,7 +7319,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7323
7319
  }
7324
7320
  if (argsRemainingCount > 0) {
7325
7321
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7326
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, argsRemainingCount === 1
7322
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, argsRemainingCount === 1
7327
7323
  ? localize_1.LocMessage.argMorePositionalExpectedOne()
7328
7324
  : localize_1.LocMessage.argMorePositionalExpectedCount().format({
7329
7325
  expected: argsRemainingCount,
@@ -7405,7 +7401,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7405
7401
  });
7406
7402
  if (!diag.isEmpty()) {
7407
7403
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7408
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.unpackedTypedDictArgument() + diag.getString(), argList[argIndex].valueExpression || errorNode);
7404
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.unpackedTypedDictArgument() + diag.getString(), argList[argIndex].valueExpression || errorNode);
7409
7405
  }
7410
7406
  reportedArgError = true;
7411
7407
  }
@@ -7466,7 +7462,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7466
7462
  }
7467
7463
  if (!isValidMappingType) {
7468
7464
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7469
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.unpackedDictArgumentNotMapping(), argList[argIndex].valueExpression || errorNode);
7465
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.unpackedDictArgumentNotMapping(), argList[argIndex].valueExpression || errorNode);
7470
7466
  }
7471
7467
  reportedArgError = true;
7472
7468
  }
@@ -7487,7 +7483,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7487
7483
  if (paramEntry && !paramEntry.isPositionalOnly) {
7488
7484
  if (paramEntry.argsReceived > 0) {
7489
7485
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7490
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.paramAlreadyAssigned().format({ name: paramNameValue }), paramName);
7486
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.paramAlreadyAssigned().format({ name: paramNameValue }), paramName);
7491
7487
  }
7492
7488
  reportedArgError = true;
7493
7489
  }
@@ -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.
@@ -7531,7 +7527,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7531
7527
  }
7532
7528
  else {
7533
7529
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7534
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.paramNameMissing().format({ name: paramName.value }), paramName);
7530
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.paramNameMissing().format({ name: paramName.value }), paramName);
7535
7531
  }
7536
7532
  reportedArgError = true;
7537
7533
  }
@@ -7542,7 +7538,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7542
7538
  }
7543
7539
  else {
7544
7540
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7545
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, positionParamLimitIndex === 1
7541
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, positionParamLimitIndex === 1
7546
7542
  ? localize_1.LocMessage.argPositionalExpectedOne()
7547
7543
  : localize_1.LocMessage.argPositionalExpectedCount().format({
7548
7544
  expected: positionParamLimitIndex,
@@ -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
  }
@@ -7619,7 +7615,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7619
7615
  if (!isDiagnosticSuppressedForNode(errorNode)) {
7620
7616
  const missingParamNames = unassignedParams.map((p) => `"${p}"`).join(', ');
7621
7617
  if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
7622
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, unassignedParams.length === 1
7618
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, unassignedParams.length === 1
7623
7619
  ? localize_1.LocMessage.argMissingForParam().format({ name: missingParamNames })
7624
7620
  : localize_1.LocMessage.argMissingForParams().format({ names: missingParamNames }), errorNode);
7625
7621
  }
@@ -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.reportGeneralTypeIssues, 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
  }
@@ -7867,7 +7859,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
7867
7859
  if (type.boundToType && !type.boundToType.includeSubclasses && type.details.methodClass) {
7868
7860
  const abstractSymbolInfo = getAbstractSymbolInfo(type.details.methodClass, type.details.name);
7869
7861
  if (abstractSymbolInfo && !abstractSymbolInfo.hasImplementation) {
7870
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.abstractMethodInvocation().format({
7862
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAbstractUsage, localize_1.LocMessage.abstractMethodInvocation().format({
7871
7863
  method: type.details.name,
7872
7864
  }), errorNode.nodeType === 9 /* ParseNodeType.Call */ ? errorNode.leftExpression : errorNode);
7873
7865
  }
@@ -8021,7 +8013,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8021
8013
  else if (type.details.paramSpec) {
8022
8014
  if (!sawParamSpecArgs || !sawParamSpecKwargs) {
8023
8015
  if (!isTypeIncomplete) {
8024
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.paramSpecArgsMissing().format({ type: printType(type.details.paramSpec) }), errorNode);
8016
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.paramSpecArgsMissing().format({ type: printType(type.details.paramSpec) }), errorNode);
8025
8017
  }
8026
8018
  argumentErrors = true;
8027
8019
  argumentMatchScore += 1;
@@ -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
  });
@@ -8291,7 +8282,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8291
8282
  argumentErrors = true;
8292
8283
  }
8293
8284
  if (argumentErrors) {
8294
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.paramSpecArgsMissing().format({
8285
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.paramSpecArgsMissing().format({
8295
8286
  type: printType(functionType.details.paramSpec),
8296
8287
  }), argErrorNode !== null && argErrorNode !== void 0 ? argErrorNode : errorNode);
8297
8288
  }
@@ -8356,8 +8347,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8356
8347
  ? 512 /* EvaluatorFlags.AllowMissingTypeArgs */ |
8357
8348
  8 /* EvaluatorFlags.EvaluateStringLiteralAsType */ |
8358
8349
  32 /* EvaluatorFlags.DisallowParamSpec */ |
8359
- 64 /* EvaluatorFlags.DisallowTypeVarTuple */
8360
- : 2 /* EvaluatorFlags.DoNotSpecialize */;
8350
+ 64 /* EvaluatorFlags.DisallowTypeVarTuple */ |
8351
+ 16 /* EvaluatorFlags.DisallowFinal */
8352
+ : 2 /* EvaluatorFlags.DoNotSpecialize */ | 16 /* EvaluatorFlags.DisallowFinal */;
8361
8353
  const exprTypeResult = getTypeOfExpression(argParam.argument.valueExpression, flags, (0, typeUtils_1.makeInferenceContext)(expectedType, !!(typeResult === null || typeResult === void 0 ? void 0 : typeResult.isIncomplete), signatureTracker));
8362
8354
  argType = exprTypeResult.type;
8363
8355
  // If the type includes multiple instances of a generic function
@@ -8484,7 +8476,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8484
8476
  // Mismatching parameter types are common in untyped code; don't bother spending time
8485
8477
  // printing types if the diagnostic is disabled.
8486
8478
  const fileInfo = AnalyzerNodeInfo.getFileInfo(argParam.errorNode);
8487
- if (fileInfo.diagnosticRuleSet.reportGeneralTypeIssues !== 'none' &&
8479
+ if (fileInfo.diagnosticRuleSet.reportArgumentType !== 'none' &&
8488
8480
  !isDiagnosticSuppressedForNode(argParam.errorNode) &&
8489
8481
  !isTypeIncomplete) {
8490
8482
  const argTypeText = printType(argType);
@@ -8528,7 +8520,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8528
8520
  if (expectedTypeDiag) {
8529
8521
  diag = expectedTypeDiag;
8530
8522
  }
8531
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, message + diag.getString(), argParam.errorNode, (_a = diag.getEffectiveTextRange()) !== null && _a !== void 0 ? _a : argParam.errorNode);
8523
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportArgumentType, message + diag.getString(), argParam.errorNode, (_a = diag.getEffectiveTextRange()) !== null && _a !== void 0 ? _a : argParam.errorNode);
8532
8524
  }
8533
8525
  return { isCompatible: false, argType, isTypeIncomplete, skippedBareTypeVarExpectedType, condition };
8534
8526
  }
@@ -8912,7 +8904,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8912
8904
  typeParamsExpr.expressions.map((expr) => {
8913
8905
  let entryType = getTypeOfExpression(expr, 128 /* EvaluatorFlags.ExpectingInstantiableType */ | 4096 /* EvaluatorFlags.AllowTypeVarsWithoutScopeId */).type;
8914
8906
  if ((0, types_1.isTypeVar)(entryType)) {
8915
- if (entryType.scopeId) {
8907
+ if (entryType.scopeId || entryType.isVariadicUnpacked) {
8916
8908
  isTypeParamListValid = false;
8917
8909
  }
8918
8910
  else {
@@ -8966,7 +8958,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8966
8958
  const fileInfo = AnalyzerNodeInfo.getFileInfo(errorNode);
8967
8959
  let className = '';
8968
8960
  if (argList.length !== 2) {
8969
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.newTypeParamCount(), errorNode);
8961
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.newTypeParamCount(), errorNode);
8970
8962
  return undefined;
8971
8963
  }
8972
8964
  const nameArg = argList[0];
@@ -8976,7 +8968,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
8976
8968
  className = nameArg.valueExpression.strings.map((s) => s.value).join('');
8977
8969
  }
8978
8970
  if (!className) {
8979
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.newTypeBadName(), (_a = argList[0].node) !== null && _a !== void 0 ? _a : errorNode);
8971
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportArgumentType, localize_1.LocMessage.newTypeBadName(), (_a = argList[0].node) !== null && _a !== void 0 ? _a : errorNode);
8980
8972
  return undefined;
8981
8973
  }
8982
8974
  if (((_b = errorNode.parent) === null || _b === void 0 ? void 0 : _b.nodeType) === 3 /* ParseNodeType.Assignment */ &&
@@ -9166,7 +9158,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
9166
9158
  ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) !== 1 /* ParseNodeType.Argument */) {
9167
9159
  const diag = new diagnostic_1.DiagnosticAddendum();
9168
9160
  diag.addMessage(localize_1.LocAddendum.useDictInstead());
9169
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.dictInAnnotation() + diag.getString(), node);
9161
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.dictInAnnotation() + diag.getString(), node);
9170
9162
  }
9171
9163
  // If the expected type is a union, analyze for each of the subtypes
9172
9164
  // to find one that matches.
@@ -9489,7 +9481,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
9489
9481
  ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) !== 1 /* ParseNodeType.Argument */) {
9490
9482
  const diag = new diagnostic_1.DiagnosticAddendum();
9491
9483
  diag.addMessage(localize_1.LocAddendum.useListInstead());
9492
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.listInAnnotation() + diag.getString(), node);
9484
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.listInAnnotation() + diag.getString(), node);
9493
9485
  }
9494
9486
  // If the expected type is a union, recursively call for each of the subtypes
9495
9487
  // to find one that matches.
@@ -10047,7 +10039,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10047
10039
  if (!expectedValueOrElementType || !(0, typeUtils_1.containsLiteralType)(expectedValueOrElementType)) {
10048
10040
  valueType = stripLiteralValue(valueType);
10049
10041
  }
10050
- type = makeTupleObject([keyType, valueType]);
10042
+ type = makeTupleObject([
10043
+ { type: keyType, isUnbounded: false },
10044
+ { type: valueType, isUnbounded: false },
10045
+ ]);
10051
10046
  }
10052
10047
  else if (node.expression.nodeType === 16 /* ParseNodeType.DictionaryExpandEntry */) {
10053
10048
  // The parser should have reported an error in this case because it's not allowed.
@@ -10159,6 +10154,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10159
10154
  sawUnpacked = true;
10160
10155
  };
10161
10156
  typeList.forEach((entry, index) => {
10157
+ var _a;
10162
10158
  let entryType = entry.type;
10163
10159
  let paramCategory = 0 /* ParameterCategory.Simple */;
10164
10160
  const paramName = `__p${index.toString()}`;
@@ -10170,7 +10166,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10170
10166
  else if (validateTypeArg(entry, { allowUnpackedTuples: true })) {
10171
10167
  if ((0, types_1.isUnpackedClass)(entryType)) {
10172
10168
  paramCategory = 1 /* ParameterCategory.ArgsList */;
10173
- noteSawUnpacked(entry);
10169
+ if ((_a = entryType.tupleTypeArguments) === null || _a === void 0 ? void 0 : _a.some((typeArg) => (0, types_1.isVariadicTypeVar)(typeArg.type) || typeArg.isUnbounded)) {
10170
+ noteSawUnpacked(entry);
10171
+ }
10174
10172
  }
10175
10173
  }
10176
10174
  else {
@@ -10273,7 +10271,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10273
10271
  }
10274
10272
  let optionalType = (0, types_1.combineTypes)([typeArg0Type, noneClassType !== null && noneClassType !== void 0 ? noneClassType : types_1.UnknownType.create()]);
10275
10273
  if (unionClassType && (0, types_1.isInstantiableClass)(unionClassType)) {
10276
- optionalType = types_1.TypeBase.cloneAsSpecialForm(optionalType, unionClassType);
10274
+ optionalType = types_1.TypeBase.cloneAsSpecialForm(optionalType, types_1.ClassType.cloneAsInstance(unionClassType));
10277
10275
  }
10278
10276
  return optionalType;
10279
10277
  }
@@ -10434,7 +10432,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10434
10432
  var _a;
10435
10433
  // Self doesn't support any type arguments.
10436
10434
  if (typeArgs) {
10437
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeArgsExpectingNone().format({
10435
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeArgsExpectingNone().format({
10438
10436
  name: classType.details.name,
10439
10437
  }), (_a = typeArgs[0].node) !== null && _a !== void 0 ? _a : errorNode);
10440
10438
  }
@@ -10582,7 +10580,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10582
10580
  function createFinalType(classType, errorNode, typeArgs, flags) {
10583
10581
  if (flags & 16 /* EvaluatorFlags.DisallowFinal */) {
10584
10582
  addError(localize_1.LocMessage.finalContext(), errorNode);
10585
- return types_1.AnyType.create();
10583
+ return classType;
10586
10584
  }
10587
10585
  if (!typeArgs || typeArgs.length === 0) {
10588
10586
  return classType;
@@ -10590,7 +10588,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10590
10588
  if (typeArgs.length > 1) {
10591
10589
  addError(localize_1.LocMessage.finalTooManyArgs(), errorNode);
10592
10590
  }
10593
- return typeArgs[0].type;
10591
+ return types_1.TypeBase.cloneAsSpecialForm(typeArgs[0].type, classType);
10594
10592
  }
10595
10593
  function createConcatenateType(classType, errorNode, typeArgs, flags) {
10596
10594
  if ((flags & 134217728 /* EvaluatorFlags.AllowConcatenate */) === 0) {
@@ -10662,6 +10660,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10662
10660
  let reportedUnpackedError = false;
10663
10661
  // Verify that we didn't receive any inappropriate types.
10664
10662
  typeArgs.forEach((typeArg, index) => {
10663
+ var _a;
10665
10664
  (0, debug_1.assert)(typeArgs !== undefined);
10666
10665
  if ((0, typeUtils_1.isEllipsisType)(typeArg.type)) {
10667
10666
  if (!isTupleTypeParam) {
@@ -10673,12 +10672,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10673
10672
  addError(localize_1.LocMessage.ellipsisSecondArg(), typeArg.node);
10674
10673
  }
10675
10674
  else {
10676
- if ((0, types_1.isTypeVar)(typeArgs[0].type) &&
10677
- (0, types_1.isVariadicTypeVar)(typeArgs[0].type) &&
10678
- !typeArgs[0].type.isVariadicInUnion) {
10675
+ if ((0, types_1.isVariadicTypeVar)(typeArgs[0].type) && !typeArgs[0].type.isVariadicInUnion) {
10679
10676
  addError(localize_1.LocMessage.typeVarTupleContext(), typeArgs[0].node);
10680
10677
  }
10681
- else if (sawUnpacked) {
10678
+ else if ((0, types_1.isUnpackedClass)(typeArgs[0].type)) {
10682
10679
  addError(localize_1.LocMessage.ellipsisAfterUnpacked(), typeArg.node);
10683
10680
  }
10684
10681
  }
@@ -10686,14 +10683,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10686
10683
  else if ((0, types_1.isParamSpec)(typeArg.type) && allowParamSpec) {
10687
10684
  // Nothing to do - this is allowed.
10688
10685
  }
10689
- else if ((0, types_1.isVariadicTypeVar)(typeArg.type) && paramLimit === undefined) {
10686
+ else if (paramLimit === undefined && (0, types_1.isVariadicTypeVar)(typeArg.type)) {
10690
10687
  if (!typeArg.type.isVariadicInUnion) {
10691
10688
  noteSawUnpacked(typeArg);
10692
10689
  }
10693
10690
  validateVariadicTypeVarIsUnpacked(typeArg.type, typeArg.node);
10694
10691
  }
10695
- else if (paramLimit === undefined && (0, types_1.isUnpacked)(typeArg.type)) {
10696
- noteSawUnpacked(typeArg);
10692
+ else if (paramLimit === undefined && (0, types_1.isUnpackedClass)(typeArg.type)) {
10693
+ if ((_a = typeArg.type.tupleTypeArguments) === null || _a === void 0 ? void 0 : _a.some((typeArg) => (0, types_1.isVariadicTypeVar)(typeArg.type) || typeArg.isUnbounded)) {
10694
+ noteSawUnpacked(typeArg);
10695
+ }
10697
10696
  validateTypeArg(typeArg, { allowUnpackedTuples: true });
10698
10697
  }
10699
10698
  else {
@@ -10810,11 +10809,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10810
10809
  // is allowed if it's an unpacked variadic type var or tuple. None is also allowed
10811
10810
  // since it is used to define NoReturn in typeshed stubs).
10812
10811
  if (types.length === 1 && !allowSingleTypeArg && !(0, typeUtils_1.isNoneInstance)(types[0])) {
10813
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.unionTypeArgCount(), errorNode);
10812
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.unionTypeArgCount(), errorNode);
10814
10813
  }
10815
10814
  let unionType = (0, types_1.combineTypes)(types);
10816
10815
  if (unionClassType && (0, types_1.isInstantiableClass)(unionClassType)) {
10817
- unionType = types_1.TypeBase.cloneAsSpecialForm(unionType, unionClassType);
10816
+ unionType = types_1.TypeBase.cloneAsSpecialForm(unionType, types_1.ClassType.cloneAsInstance(unionClassType));
10818
10817
  }
10819
10818
  return unionType;
10820
10819
  }
@@ -10911,7 +10910,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
10911
10910
  if (isPep695Syntax || isPep695TypeVarType) {
10912
10911
  const typeAliasTypeClass = getTypingType(errorNode, 'TypeAliasType');
10913
10912
  if (typeAliasTypeClass && (0, types_1.isInstantiableClass)(typeAliasTypeClass)) {
10914
- typeAlias = types_1.TypeBase.cloneAsSpecialForm(typeAlias, typeAliasTypeClass);
10913
+ typeAlias = types_1.TypeBase.cloneAsSpecialForm(typeAlias, types_1.ClassType.cloneAsInstance(typeAliasTypeClass));
10915
10914
  }
10916
10915
  }
10917
10916
  return typeAlias;
@@ -11114,7 +11113,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
11114
11113
  if (isDeclaredTypeAlias(node.leftExpression)) {
11115
11114
  typeAliasNameNode = node.leftExpression.valueExpression;
11116
11115
  if (!isLegalTypeAliasExpressionForm(node.rightExpression)) {
11117
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAliasIllegalExpressionForm(), node.rightExpression);
11116
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeAliasIllegalExpressionForm(), node.rightExpression);
11118
11117
  }
11119
11118
  }
11120
11119
  else if (node.leftExpression.nodeType === 38 /* ParseNodeType.Name */) {
@@ -11163,9 +11162,19 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
11163
11162
  }
11164
11163
  // If this is an enum, transform the type as required.
11165
11164
  rightHandType = srcType;
11166
- 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) {
11167
11174
  rightHandType =
11168
- (_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;
11169
11178
  }
11170
11179
  if (typeAliasNameNode) {
11171
11180
  // If this was a speculative type alias, it becomes a real type alias
@@ -12234,7 +12243,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
12234
12243
  }
12235
12244
  // In case this is an enum class and a method wrapped in an enum.member.
12236
12245
  decoratedType =
12237
- (_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;
12238
12249
  // See if there are any overloads provided by previous function declarations.
12239
12250
  if ((0, types_1.isFunction)(decoratedType)) {
12240
12251
  decoratedType.details.deprecatedMessage = functionType.details.deprecatedMessage;
@@ -12435,7 +12446,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
12435
12446
  }
12436
12447
  }
12437
12448
  if (!assignType(annotatedType, defaultValueType, diagAddendum, typeVarContext)) {
12438
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.paramAssignmentMismatch().format({
12449
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportArgumentType, localize_1.LocMessage.paramAssignmentMismatch().format({
12439
12450
  sourceType: printType(defaultValueType),
12440
12451
  paramType: printType(annotatedType),
12441
12452
  }) + diagAddendum.getString(), param.defaultValue);
@@ -12745,11 +12756,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
12745
12756
  if ((0, types_1.isUnpackedClass)(type)) {
12746
12757
  return types_1.ClassType.cloneForUnpacked(type, /* isUnpackedTuple */ false);
12747
12758
  }
12748
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
12749
- return types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type, isUnbounded: !(0, types_1.isVariadicTypeVar)(type) }],
12750
- /* isTypeArgumentExplicit */ true));
12751
- }
12752
- return types_1.UnknownType.create();
12759
+ return makeTupleObject([{ type, isUnbounded: !(0, types_1.isVariadicTypeVar)(type) }]);
12753
12760
  }
12754
12761
  case 2 /* ParameterCategory.KwargsDict */: {
12755
12762
  // Leave a ParamSpec alone.
@@ -13225,7 +13232,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
13225
13232
  reportError = true;
13226
13233
  }
13227
13234
  if (reportError) {
13228
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.importSymbolUnknown().format({ name: node.name.value }), node.name);
13235
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAttributeAccessIssue, localize_1.LocMessage.importSymbolUnknown().format({ name: node.name.value }), node.name);
13229
13236
  }
13230
13237
  }
13231
13238
  if (!symbolType) {
@@ -13306,7 +13313,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
13306
13313
  }
13307
13314
  const diagAddendum = new diagnostic_1.DiagnosticAddendum();
13308
13315
  if (!assignType(declaredType, importedSymbolType, diagAddendum)) {
13309
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAssignmentMismatchWildcard().format({
13316
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssignmentType, localize_1.LocMessage.typeAssignmentMismatchWildcard().format({
13310
13317
  ...printSrcDestTypes(importedSymbolType, declaredType),
13311
13318
  name,
13312
13319
  }) + diagAddendum.getString(), node, (_b = node.wildcardToken) !== null && _b !== void 0 ? _b : node);
@@ -14008,7 +14015,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14008
14015
  if (typeArgs.length >= 1) {
14009
14016
  // Treat type[function] as illegal.
14010
14017
  if ((0, types_1.isFunction)(typeArgs[0].type) || (0, types_1.isOverloadedFunction)(typeArgs[0].type)) {
14011
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeAnnotationWithCallable(), typeArgs[0].node);
14018
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeAnnotationWithCallable(), typeArgs[0].node);
14012
14019
  return { type: types_1.UnknownType.create() };
14013
14020
  }
14014
14021
  }
@@ -14051,7 +14058,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14051
14058
  // Classes that accept inlined type dict type args allow only one.
14052
14059
  if (typeArgs[0].inlinedTypeDict) {
14053
14060
  if (typeArgs.length > 1) {
14054
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeArgsTooMany().format({
14061
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeArgsTooMany().format({
14055
14062
  name: classType.aliasName || classType.details.name,
14056
14063
  expected: 1,
14057
14064
  received: typeArgCount,
@@ -14062,12 +14069,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14062
14069
  else if (typeArgCount > typeParameters.length) {
14063
14070
  if (!types_1.ClassType.isPartiallyEvaluated(classType) && !types_1.ClassType.isTupleClass(classType)) {
14064
14071
  if (typeParameters.length === 0) {
14065
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeArgsExpectingNone().format({
14072
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeArgsExpectingNone().format({
14066
14073
  name: classType.aliasName || classType.details.name,
14067
14074
  }), typeArgs[typeParameters.length].node);
14068
14075
  }
14069
14076
  else if (typeParameters.length !== 1 || !(0, types_1.isParamSpec)(typeParameters[0])) {
14070
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeArgsTooMany().format({
14077
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeArgsTooMany().format({
14071
14078
  name: classType.aliasName || classType.details.name,
14072
14079
  expected: typeParameters.length,
14073
14080
  received: typeArgCount,
@@ -14077,7 +14084,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14077
14084
  }
14078
14085
  }
14079
14086
  else if (typeArgCount < minTypeArgCount) {
14080
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeArgsTooFew().format({
14087
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeArgsTooFew().format({
14081
14088
  name: classType.aliasName || classType.details.name,
14082
14089
  expected: minTypeArgCount,
14083
14090
  received: typeArgCount,
@@ -14232,7 +14239,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14232
14239
  // Avoid emitting this error for a partially-constructed class.
14233
14240
  if (!(0, types_1.isClassInstance)(typeArgType) || !types_1.ClassType.isPartiallyEvaluated(typeArgType)) {
14234
14241
  (0, debug_1.assert)(typeArgs !== undefined);
14235
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typeVarAssignmentMismatch().format({
14242
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeArguments, localize_1.LocMessage.typeVarAssignmentMismatch().format({
14236
14243
  type: printType(typeArgType),
14237
14244
  name: types_1.TypeVarType.getReadableName(typeParameters[index]),
14238
14245
  }) + diag.getString(), typeArgs[index].node);
@@ -14821,7 +14828,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
14821
14828
  const variableNode = (_c = ParseTreeUtils.getParentNodeOfType(declaration.node, 3 /* ParseNodeType.Assignment */)) !== null && _c !== void 0 ? _c : ParseTreeUtils.getParentNodeOfType(declaration.node, 54 /* ParseNodeType.TypeAnnotation */);
14822
14829
  if (variableNode) {
14823
14830
  declaredType =
14824
- (_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;
14825
14834
  }
14826
14835
  }
14827
14836
  if ((0, types_1.isClassInstance)(declaredType) && types_1.ClassType.isBuiltIn(declaredType, 'TypeAlias')) {
@@ -15076,9 +15085,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
15076
15085
  var _a, _b;
15077
15086
  (0, debug_1.assert)(resolvedDecl.inferredTypeSource !== undefined);
15078
15087
  const inferredTypeSource = resolvedDecl.inferredTypeSource;
15079
- return ((_b = (_a = evaluateTypeForSubnode(inferredTypeSource, () => {
15080
- evaluateTypesForStatement(inferredTypeSource);
15081
- })) === 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
+ };
15082
15093
  });
15083
15094
  if (enumMemberType) {
15084
15095
  inferredType = enumMemberType;
@@ -16034,26 +16045,28 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16034
16045
  const destUnboundedOrVariadicIndex = destTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type));
16035
16046
  const srcUnboundedIndex = srcTypeArgs.findIndex((t) => t.isUnbounded);
16036
16047
  const srcVariadicIndex = srcTypeArgs.findIndex((t) => (0, types_1.isVariadicTypeVar)(t.type));
16037
- let isSrcVariadicAny = false;
16038
- // If the src contains an unbounded type but the dest does not, it's incompatible.
16039
- if (srcUnboundedIndex >= 0 && destUnboundedOrVariadicIndex < 0) {
16040
- // Unless the source contains an [Any, ...].
16048
+ if (srcUnboundedIndex >= 0) {
16041
16049
  if ((0, types_1.isAnyOrUnknown)(srcTypeArgs[srcUnboundedIndex].type)) {
16042
- 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
+ }
16043
16058
  }
16044
- else {
16059
+ else if (destUnboundedOrVariadicIndex < 0) {
16060
+ // If the source contains an unbounded type but the dest does not, it's incompatible.
16045
16061
  return false;
16046
16062
  }
16047
16063
  }
16048
- if (srcUnboundedIndex >= 0) {
16049
- // The source is unbounded, so expand the unbounded argument to try
16050
- // to make the source and dest arg counts match.
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 (isSrcVariadicAny && srcTypeArgs.length > destTypeArgs.length) {
16056
- 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]);
16057
16070
  }
16058
16071
  }
16059
16072
  // Remove any optional parameters from the end of the two lists until the lengths match.
@@ -16063,23 +16076,26 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16063
16076
  while (destTypeArgs.length > srcTypeArgs.length && destTypeArgs[destTypeArgs.length - 1].isOptional) {
16064
16077
  destTypeArgs.splice(destTypeArgs.length - 1, 1);
16065
16078
  }
16066
- 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) {
16067
16083
  const destArgsToCapture = destTypeArgs.length - srcTypeArgs.length + 1;
16068
- // If we're doing reverse type mappings and the source contains a variadic
16069
- // TypeVar, we need to adjust the dest so the reverse type mapping assignment
16070
- // can be performed.
16071
- if (destArgsToCapture >= 0 && (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0) {
16084
+ if (srcVariadicIndex >= 0 && destArgsToCapture >= 0) {
16072
16085
  // If the only removed arg from the dest type args is itself a variadic,
16073
16086
  // don't bother adjusting it.
16074
16087
  const skipAdjustment = destArgsToCapture === 1 && (0, types_1.isVariadicTypeVar)(destTypeArgs[srcVariadicIndex].type);
16075
16088
  if (!skipAdjustment && tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
16076
16089
  const removedArgs = destTypeArgs.splice(srcVariadicIndex, destArgsToCapture);
16077
16090
  // Package up the remaining type arguments into a tuple object.
16078
- const variadicTuple = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, removedArgs.map((typeArg) => {
16079
- 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
+ };
16080
16097
  }),
16081
- /* isTypeArgumentExplicit */ true,
16082
- /* isUnpackedTuple */ true));
16098
+ /* isUnpackedTuple */ true);
16083
16099
  destTypeArgs.splice(srcVariadicIndex, 0, {
16084
16100
  type: variadicTuple,
16085
16101
  isUnbounded: false,
@@ -16096,11 +16112,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16096
16112
  if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
16097
16113
  const removedArgs = srcTypeArgs.splice(destUnboundedOrVariadicIndex, srcArgsToCapture);
16098
16114
  // Package up the remaining type arguments into a tuple object.
16099
- const variadicTuple = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, removedArgs.map((typeArg) => {
16100
- 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
+ };
16101
16121
  }),
16102
- /* isTypeArgumentExplicit */ true,
16103
- /* isUnpackedTuple */ true));
16122
+ /* isUnpackedTuple */ true);
16104
16123
  srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
16105
16124
  type: variadicTuple,
16106
16125
  isUnbounded: false,
@@ -16108,18 +16127,27 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16108
16127
  }
16109
16128
  }
16110
16129
  else {
16111
- const removedArgTypes = srcTypeArgs
16112
- .splice(destUnboundedOrVariadicIndex, srcArgsToCapture)
16113
- .map((t) => {
16114
- if ((0, types_1.isTypeVar)(t.type) && (0, types_1.isUnpackedVariadicTypeVar)(t.type) && !t.type.isVariadicInUnion) {
16115
- return types_1.TypeVarType.cloneForUnpacked(t.type, /* isInUnion */ true);
16116
- }
16117
- return t.type;
16118
- });
16119
- srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
16120
- type: removedArgTypes.length > 0 ? (0, types_1.combineTypes)(removedArgTypes) : types_1.AnyType.create(),
16121
- isUnbounded: false,
16122
- });
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
+ }
16123
16151
  }
16124
16152
  }
16125
16153
  }
@@ -16143,16 +16171,32 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16143
16171
  }
16144
16172
  }
16145
16173
  else {
16146
- if (srcTypeArgs.find((t) => t.isUnbounded)) {
16147
- diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeIndeterminate().format({
16148
- expected: destTypeArgs.length,
16149
- }));
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
+ }
16150
16186
  }
16151
16187
  else {
16152
- diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeMismatch().format({
16153
- expected: destTypeArgs.length,
16154
- received: srcTypeArgs.length,
16155
- }));
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
+ }
16156
16200
  }
16157
16201
  return false;
16158
16202
  }
@@ -16243,6 +16287,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
16243
16287
  const typeParam = destType.details.typeParameters[i];
16244
16288
  const variance = types_1.TypeVarType.getVariance(typeParam);
16245
16289
  (0, constraintSolver_1.updateTypeVarType)(evaluatorInterface, destTypeVarContext, typeParam, variance !== 4 /* Variance.Contravariant */ ? typeArgType : undefined, variance !== 3 /* Variance.Covariant */ ? typeArgType : undefined,
16290
+ /* tupleTypes */ curSrcType.tupleTypeArguments,
16246
16291
  /* forceRetainLiterals */ true);
16247
16292
  }
16248
16293
  }
@@ -17005,7 +17050,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17005
17050
  return false;
17006
17051
  });
17007
17052
  if (destTypeIndex >= 0) {
17008
- 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)) {
17009
17055
  // Note that we have matched at least one subtype indicating
17010
17056
  // there is at least some overlap.
17011
17057
  matchedSomeSubtypes = true;
@@ -17454,15 +17500,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17454
17500
  }
17455
17501
  });
17456
17502
  if (srcTupleTypes.length !== 1 || !(0, types_1.isVariadicTypeVar)(srcTupleTypes[0].type)) {
17457
- let srcPositionalsType;
17458
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
17459
- srcPositionalsType = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, srcTupleTypes,
17460
- /* isTypeArgumentExplicit */ true,
17461
- /* isUnpackedTuple */ true));
17462
- }
17463
- else {
17464
- srcPositionalsType = types_1.UnknownType.create();
17465
- }
17503
+ const srcPositionalsType = makeTupleObject(srcTupleTypes, /* isUnpackedTuple */ true);
17466
17504
  // Snip out the portion of the source positionals that map to the variadic
17467
17505
  // dest parameter and replace it with a single parameter that is typed as a
17468
17506
  // tuple containing the individual types of the replaced parameters.
@@ -17670,15 +17708,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
17670
17708
  !types_1.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(destType)) {
17671
17709
  let destArgsType = destParamDetails.params[destParamDetails.argsIndex].type;
17672
17710
  let srcArgsType = srcParamDetails.params[srcParamDetails.argsIndex].type;
17673
- if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
17674
- if (!(0, types_1.isUnpacked)(destArgsType)) {
17675
- destArgsType = types_1.ClassType.cloneForUnpacked(types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: destArgsType, isUnbounded: true }],
17676
- /* isTypeArgumentExplicit */ true)));
17677
- }
17678
- if (!(0, types_1.isUnpacked)(srcArgsType)) {
17679
- srcArgsType = types_1.ClassType.cloneForUnpacked(types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: srcArgsType, isUnbounded: true }],
17680
- /* isTypeArgumentExplicit */ true)));
17681
- }
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);
17682
17716
  }
17683
17717
  if (!assignFunctionParameter(destArgsType, srcArgsType, destParamDetails.params[destParamDetails.argsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
17684
17718
  canAssign = false;
@@ -18007,6 +18041,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
18007
18041
  // we may be able to narrow the type based on the assignment.
18008
18042
  function narrowTypeBasedOnAssignment(node, declaredType, assignedType) {
18009
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
+ }
18010
18052
  const narrowedSubtype = (0, typeUtils_1.mapSubtypes)(declaredType, (declaredSubtype) => {
18011
18053
  // We can't narrow "Any".
18012
18054
  if ((0, types_1.isAnyOrUnknown)(declaredSubtype)) {