@zzzen/pyright-internal 1.2.0-dev.20240804 → 1.2.0-dev.20240811

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 (732) hide show
  1. package/dist/analyzer/analysis.js +2 -2
  2. package/dist/analyzer/analysis.js.map +1 -1
  3. package/dist/analyzer/analyzerFileInfo.js +1 -2
  4. package/dist/analyzer/analyzerFileInfo.js.map +1 -1
  5. package/dist/analyzer/analyzerNodeInfo.js +20 -21
  6. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  7. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  8. package/dist/analyzer/binder.js +1 -1
  9. package/dist/analyzer/binder.js.map +1 -1
  10. package/dist/analyzer/cacheManager.d.ts +0 -1
  11. package/dist/analyzer/cacheManager.js.map +1 -1
  12. package/dist/analyzer/checker.d.ts +2 -0
  13. package/dist/analyzer/checker.js +268 -203
  14. package/dist/analyzer/checker.js.map +1 -1
  15. package/dist/analyzer/circularDependency.js.map +1 -1
  16. package/dist/analyzer/codeFlowEngine.js +6 -6
  17. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  18. package/dist/analyzer/codeFlowTypes.d.ts +17 -17
  19. package/dist/analyzer/codeFlowTypes.js +5 -5
  20. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  21. package/dist/analyzer/codeFlowUtils.js +1 -2
  22. package/dist/analyzer/codeFlowUtils.js.map +1 -1
  23. package/dist/analyzer/commentUtils.js +1 -2
  24. package/dist/analyzer/commentUtils.js.map +1 -1
  25. package/dist/analyzer/constraintSolution.d.ts +2 -1
  26. package/dist/analyzer/constraintSolution.js +7 -1
  27. package/dist/analyzer/constraintSolution.js.map +1 -1
  28. package/dist/analyzer/constraintSolver.d.ts +1 -2
  29. package/dist/analyzer/constraintSolver.js +137 -161
  30. package/dist/analyzer/constraintSolver.js.map +1 -1
  31. package/dist/analyzer/constraintTracker.d.ts +5 -4
  32. package/dist/analyzer/constraintTracker.js +14 -9
  33. package/dist/analyzer/constraintTracker.js.map +1 -1
  34. package/dist/analyzer/constructorTransform.js +8 -8
  35. package/dist/analyzer/constructorTransform.js.map +1 -1
  36. package/dist/analyzer/constructors.js +15 -16
  37. package/dist/analyzer/constructors.js.map +1 -1
  38. package/dist/analyzer/dataClasses.js +37 -26
  39. package/dist/analyzer/dataClasses.js.map +1 -1
  40. package/dist/analyzer/declaration.js +11 -11
  41. package/dist/analyzer/declaration.js.map +1 -1
  42. package/dist/analyzer/declarationUtils.js +8 -9
  43. package/dist/analyzer/declarationUtils.js.map +1 -1
  44. package/dist/analyzer/decorators.d.ts +1 -1
  45. package/dist/analyzer/decorators.js +33 -29
  46. package/dist/analyzer/decorators.js.map +1 -1
  47. package/dist/analyzer/docStringConversion.js +2 -3
  48. package/dist/analyzer/docStringConversion.js.map +1 -1
  49. package/dist/analyzer/docStringUtils.js +2 -3
  50. package/dist/analyzer/docStringUtils.js.map +1 -1
  51. package/dist/analyzer/enums.js +17 -14
  52. package/dist/analyzer/enums.js.map +1 -1
  53. package/dist/analyzer/functionTransform.d.ts +2 -2
  54. package/dist/analyzer/functionTransform.js +1 -2
  55. package/dist/analyzer/functionTransform.js.map +1 -1
  56. package/dist/analyzer/importResolver.d.ts +0 -1
  57. package/dist/analyzer/importResolver.js +5 -5
  58. package/dist/analyzer/importResolver.js.map +1 -1
  59. package/dist/analyzer/importStatementUtils.js +15 -15
  60. package/dist/analyzer/importStatementUtils.js.map +1 -1
  61. package/dist/analyzer/namedTuples.js +2 -3
  62. package/dist/analyzer/namedTuples.js.map +1 -1
  63. package/dist/analyzer/operations.js +6 -7
  64. package/dist/analyzer/operations.js.map +1 -1
  65. package/dist/analyzer/packageTypeReport.d.ts +3 -3
  66. package/dist/analyzer/packageTypeReport.js +2 -2
  67. package/dist/analyzer/packageTypeReport.js.map +1 -1
  68. package/dist/analyzer/packageTypeVerifier.js +9 -9
  69. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  70. package/dist/analyzer/parameterUtils.js +5 -5
  71. package/dist/analyzer/parameterUtils.js.map +1 -1
  72. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  73. package/dist/analyzer/parseTreeUtils.js +94 -92
  74. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  75. package/dist/analyzer/parseTreeWalker.js +2 -2
  76. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  77. package/dist/analyzer/patternMatching.js +18 -22
  78. package/dist/analyzer/patternMatching.js.map +1 -1
  79. package/dist/analyzer/program.js +5 -1
  80. package/dist/analyzer/program.js.map +1 -1
  81. package/dist/analyzer/properties.js +7 -9
  82. package/dist/analyzer/properties.js.map +1 -1
  83. package/dist/analyzer/protocols.d.ts +2 -2
  84. package/dist/analyzer/protocols.js +26 -30
  85. package/dist/analyzer/protocols.js.map +1 -1
  86. package/dist/analyzer/pyTypedUtils.js +2 -3
  87. package/dist/analyzer/pyTypedUtils.js.map +1 -1
  88. package/dist/analyzer/pythonPathUtils.js +6 -6
  89. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  90. package/dist/analyzer/scope.js.map +1 -1
  91. package/dist/analyzer/scopeUtils.js +5 -6
  92. package/dist/analyzer/scopeUtils.js.map +1 -1
  93. package/dist/analyzer/service.d.ts +3 -0
  94. package/dist/analyzer/service.js +173 -103
  95. package/dist/analyzer/service.js.map +1 -1
  96. package/dist/analyzer/serviceUtils.js +5 -5
  97. package/dist/analyzer/serviceUtils.js.map +1 -1
  98. package/dist/analyzer/sourceFile.js.map +1 -1
  99. package/dist/analyzer/sourceFileInfo.js.map +1 -1
  100. package/dist/analyzer/sourceFileInfoUtils.js +4 -5
  101. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  102. package/dist/analyzer/sourceMapper.js +5 -4
  103. package/dist/analyzer/sourceMapper.js.map +1 -1
  104. package/dist/analyzer/sourceMapperUtils.js +1 -2
  105. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  106. package/dist/analyzer/staticExpressions.js +2 -3
  107. package/dist/analyzer/staticExpressions.js.map +1 -1
  108. package/dist/analyzer/symbol.js.map +1 -1
  109. package/dist/analyzer/symbolNameUtils.js +8 -9
  110. package/dist/analyzer/symbolNameUtils.js.map +1 -1
  111. package/dist/analyzer/symbolUtils.js +4 -5
  112. package/dist/analyzer/symbolUtils.js.map +1 -1
  113. package/dist/analyzer/testWalker.js.map +1 -1
  114. package/dist/analyzer/tracePrinter.js +5 -4
  115. package/dist/analyzer/tracePrinter.js.map +1 -1
  116. package/dist/analyzer/tuples.d.ts +1 -1
  117. package/dist/analyzer/tuples.js +6 -7
  118. package/dist/analyzer/tuples.js.map +1 -1
  119. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  120. package/dist/analyzer/typeComplexity.js +2 -3
  121. package/dist/analyzer/typeComplexity.js.map +1 -1
  122. package/dist/analyzer/typeDocStringUtils.d.ts +2 -2
  123. package/dist/analyzer/typeDocStringUtils.js +34 -25
  124. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  125. package/dist/analyzer/typeEvaluator.js +419 -419
  126. package/dist/analyzer/typeEvaluator.js.map +1 -1
  127. package/dist/analyzer/typeEvaluatorTypes.d.ts +8 -10
  128. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  129. package/dist/analyzer/typeEvaluatorWithTracker.js +1 -2
  130. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  131. package/dist/analyzer/typeGuards.js +31 -30
  132. package/dist/analyzer/typeGuards.js.map +1 -1
  133. package/dist/analyzer/typePrinter.js +11 -11
  134. package/dist/analyzer/typePrinter.js.map +1 -1
  135. package/dist/analyzer/typeStubWriter.js.map +1 -1
  136. package/dist/analyzer/typeUtils.d.ts +10 -14
  137. package/dist/analyzer/typeUtils.js +166 -215
  138. package/dist/analyzer/typeUtils.js.map +1 -1
  139. package/dist/analyzer/typeWalker.d.ts +2 -2
  140. package/dist/analyzer/typeWalker.js +9 -4
  141. package/dist/analyzer/typeWalker.js.map +1 -1
  142. package/dist/analyzer/typedDicts.js +41 -41
  143. package/dist/analyzer/typedDicts.js.map +1 -1
  144. package/dist/analyzer/types.d.ts +18 -16
  145. package/dist/analyzer/types.js +71 -74
  146. package/dist/analyzer/types.js.map +1 -1
  147. package/dist/backgroundAnalysisBase.d.ts +0 -1
  148. package/dist/backgroundAnalysisBase.js.map +1 -1
  149. package/dist/backgroundThreadBase.d.ts +0 -1
  150. package/dist/backgroundThreadBase.js +7 -7
  151. package/dist/backgroundThreadBase.js.map +1 -1
  152. package/dist/commands/commandController.js.map +1 -1
  153. package/dist/commands/createTypeStub.js.map +1 -1
  154. package/dist/commands/dumpFileDebugInfoCommand.js +2 -2
  155. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  156. package/dist/commands/quickActionCommand.js.map +1 -1
  157. package/dist/common/cancellationUtils.js +9 -9
  158. package/dist/common/cancellationUtils.js.map +1 -1
  159. package/dist/common/chokidarFileWatcherProvider.js +3 -3
  160. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  161. package/dist/common/collectionUtils.js +23 -23
  162. package/dist/common/collectionUtils.js.map +1 -1
  163. package/dist/common/commandLineOptions.d.ts +19 -12
  164. package/dist/common/commandLineOptions.js +26 -9
  165. package/dist/common/commandLineOptions.js.map +1 -1
  166. package/dist/common/commandUtils.js +1 -2
  167. package/dist/common/commandUtils.js.map +1 -1
  168. package/dist/common/configOptions.d.ts +2 -2
  169. package/dist/common/configOptions.js +30 -40
  170. package/dist/common/configOptions.js.map +1 -1
  171. package/dist/common/console.js +4 -4
  172. package/dist/common/console.js.map +1 -1
  173. package/dist/common/core.js +21 -21
  174. package/dist/common/core.js.map +1 -1
  175. package/dist/common/crypto.js +1 -2
  176. package/dist/common/crypto.js.map +1 -1
  177. package/dist/common/debug.js +9 -10
  178. package/dist/common/debug.js.map +1 -1
  179. package/dist/common/deferred.js +3 -4
  180. package/dist/common/deferred.js.map +1 -1
  181. package/dist/common/diagnostic.js +3 -3
  182. package/dist/common/diagnostic.js.map +1 -1
  183. package/dist/common/diagnosticSink.js.map +1 -1
  184. package/dist/common/envVarUtils.js +2 -3
  185. package/dist/common/envVarUtils.js.map +1 -1
  186. package/dist/common/fileBasedCancellationUtils.js +4 -4
  187. package/dist/common/fileBasedCancellationUtils.js.map +1 -1
  188. package/dist/common/fileSystem.d.ts +0 -2
  189. package/dist/common/fileWatcher.js +2 -2
  190. package/dist/common/fileWatcher.js.map +1 -1
  191. package/dist/common/fullAccessHost.js.map +1 -1
  192. package/dist/common/logTracker.js +2 -2
  193. package/dist/common/logTracker.js.map +1 -1
  194. package/dist/common/lspUtils.d.ts +1 -1
  195. package/dist/common/lspUtils.js +3 -4
  196. package/dist/common/lspUtils.js.map +1 -1
  197. package/dist/common/memUtils.js +2 -2
  198. package/dist/common/memUtils.js.map +1 -1
  199. package/dist/common/pathUtils.js +32 -32
  200. package/dist/common/pathUtils.js.map +1 -1
  201. package/dist/common/positionUtils.js +7 -8
  202. package/dist/common/positionUtils.js.map +1 -1
  203. package/dist/common/progressReporter.js.map +1 -1
  204. package/dist/common/pythonVersion.js.map +1 -1
  205. package/dist/common/realFileSystem.d.ts +0 -2
  206. package/dist/common/realFileSystem.js +2 -2
  207. package/dist/common/realFileSystem.js.map +1 -1
  208. package/dist/common/serviceProvider.js.map +1 -1
  209. package/dist/common/serviceProviderExtensions.js +1 -2
  210. package/dist/common/serviceProviderExtensions.js.map +1 -1
  211. package/dist/common/stringUtils.js +12 -13
  212. package/dist/common/stringUtils.js.map +1 -1
  213. package/dist/common/textEditTracker.js.map +1 -1
  214. package/dist/common/textRange.js +13 -13
  215. package/dist/common/textRange.js.map +1 -1
  216. package/dist/common/textRangeCollection.js +2 -2
  217. package/dist/common/textRangeCollection.js.map +1 -1
  218. package/dist/common/timing.js.map +1 -1
  219. package/dist/common/uri/baseUri.js.map +1 -1
  220. package/dist/common/uri/fileUri.js.map +1 -1
  221. package/dist/common/uri/memoization.js +3 -4
  222. package/dist/common/uri/memoization.js.map +1 -1
  223. package/dist/common/uri/uri.js.map +1 -1
  224. package/dist/common/uri/uriUtils.d.ts +0 -1
  225. package/dist/common/uri/uriUtils.js +20 -20
  226. package/dist/common/uri/uriUtils.js.map +1 -1
  227. package/dist/common/uri/webUri.js.map +1 -1
  228. package/dist/common/workspaceEditUtils.js +8 -9
  229. package/dist/common/workspaceEditUtils.js.map +1 -1
  230. package/dist/languageServerBase.js.map +1 -1
  231. package/dist/languageService/analyzerServiceExecutor.js +30 -29
  232. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  233. package/dist/languageService/autoImporter.js +4 -4
  234. package/dist/languageService/autoImporter.js.map +1 -1
  235. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  236. package/dist/languageService/codeActionProvider.js.map +1 -1
  237. package/dist/languageService/completionProvider.js +2 -2
  238. package/dist/languageService/completionProvider.js.map +1 -1
  239. package/dist/languageService/completionProviderUtils.js +4 -5
  240. package/dist/languageService/completionProviderUtils.js.map +1 -1
  241. package/dist/languageService/definitionProvider.js +5 -5
  242. package/dist/languageService/definitionProvider.js.map +1 -1
  243. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  244. package/dist/languageService/documentSymbolCollector.js +3 -3
  245. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  246. package/dist/languageService/documentSymbolProvider.js +2 -2
  247. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  248. package/dist/languageService/dynamicFeature.js.map +1 -1
  249. package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -1
  250. package/dist/languageService/hoverProvider.js +6 -6
  251. package/dist/languageService/hoverProvider.js.map +1 -1
  252. package/dist/languageService/importSorter.js.map +1 -1
  253. package/dist/languageService/navigationUtils.js +3 -4
  254. package/dist/languageService/navigationUtils.js.map +1 -1
  255. package/dist/languageService/quickActions.js +1 -2
  256. package/dist/languageService/quickActions.js.map +1 -1
  257. package/dist/languageService/referencesProvider.js.map +1 -1
  258. package/dist/languageService/renameProvider.js.map +1 -1
  259. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  260. package/dist/languageService/symbolIndexer.js.map +1 -1
  261. package/dist/languageService/tooltipUtils.d.ts +5 -5
  262. package/dist/languageService/tooltipUtils.js +31 -31
  263. package/dist/languageService/tooltipUtils.js.map +1 -1
  264. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  265. package/dist/localization/localize.d.ts +3 -0
  266. package/dist/localization/localize.js +7 -6
  267. package/dist/localization/localize.js.map +1 -1
  268. package/dist/localization/package.nls.en-us.json +2 -1
  269. package/dist/nodeMain.js +1 -2
  270. package/dist/nodeMain.js.map +1 -1
  271. package/dist/nodeServer.js +2 -3
  272. package/dist/nodeServer.js.map +1 -1
  273. package/dist/parser/characterStream.js.map +1 -1
  274. package/dist/parser/characters.js +10 -11
  275. package/dist/parser/characters.js.map +1 -1
  276. package/dist/parser/parseNodes.d.ts +8 -8
  277. package/dist/parser/parseNodes.js +5 -5
  278. package/dist/parser/parseNodes.js.map +1 -1
  279. package/dist/parser/parser.js.map +1 -1
  280. package/dist/parser/stringTokenUtils.js +2 -2
  281. package/dist/parser/stringTokenUtils.js.map +1 -1
  282. package/dist/parser/tokenizer.js.map +1 -1
  283. package/dist/parser/unicode.js +468 -468
  284. package/dist/parser/unicode.js.map +1 -1
  285. package/dist/pprof/profiler.js +2 -3
  286. package/dist/pprof/profiler.js.map +1 -1
  287. package/dist/pyright.js +22 -23
  288. package/dist/pyright.js.map +1 -1
  289. package/dist/pyrightFileSystem.d.ts +0 -2
  290. package/dist/pyrightFileSystem.js.map +1 -1
  291. package/dist/readonlyAugmentedFileSystem.d.ts +0 -2
  292. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  293. package/dist/server.js.map +1 -1
  294. package/dist/tests/cacheManager.test.js.map +1 -1
  295. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  296. package/dist/tests/checker.test.js +3 -3
  297. package/dist/tests/checker.test.js.map +1 -1
  298. package/dist/tests/classDeclaration.test.js.map +1 -1
  299. package/dist/tests/config.test.js +160 -24
  300. package/dist/tests/config.test.js.map +1 -1
  301. package/dist/tests/debug.test.js.map +1 -1
  302. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  303. package/dist/tests/docStringConversion.test.js +1 -2
  304. package/dist/tests/docStringConversion.test.js.map +1 -1
  305. package/dist/tests/documentSymbolCollector.test.js.map +1 -1
  306. package/dist/tests/filesystem.test.js.map +1 -1
  307. package/dist/tests/fourSlashParser.test.js.map +1 -1
  308. package/dist/tests/fourSlashRunner.test.js.map +1 -1
  309. package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.d.ts +0 -1
  310. package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -1
  311. package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.d.ts +0 -1
  312. package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -1
  313. package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.d.ts +0 -1
  314. package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.d.ts +0 -1
  315. package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.d.ts +0 -1
  316. package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -1
  317. package/dist/tests/fourslash/completions.autoimport.fourslash.d.ts +0 -1
  318. package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -1
  319. package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.d.ts +0 -1
  320. package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -1
  321. package/dist/tests/fourslash/completions.autoimport.lib.alias.fourslash.d.ts +0 -1
  322. package/dist/tests/fourslash/completions.autoimport.lib.alias.fourslash.js.map +1 -1
  323. package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.d.ts +0 -1
  324. package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -1
  325. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.d.ts +0 -1
  326. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  327. package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.d.ts +0 -1
  328. package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -1
  329. package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.d.ts +0 -1
  330. package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -1
  331. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.d.ts +0 -1
  332. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  333. package/dist/tests/fourslash/completions.builtinOverride.fourslash.d.ts +0 -1
  334. package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.d.ts +0 -1
  335. package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -1
  336. package/dist/tests/fourslash/completions.call.typedDict.fourslash.d.ts +0 -1
  337. package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
  338. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.d.ts +0 -1
  339. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
  340. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.d.ts +0 -1
  341. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
  342. package/dist/tests/fourslash/completions.classVariable.fourslash.d.ts +0 -1
  343. package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
  344. package/dist/tests/fourslash/completions.comment.fourslash.d.ts +0 -1
  345. package/dist/tests/fourslash/completions.declNames.class.fourslash.d.ts +0 -1
  346. package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -1
  347. package/dist/tests/fourslash/completions.declNames.exception.fourslash.d.ts +0 -1
  348. package/dist/tests/fourslash/completions.declNames.for.fourslash.d.ts +0 -1
  349. package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -1
  350. package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.d.ts +0 -1
  351. package/dist/tests/fourslash/completions.declNames.lambda.fourslash.d.ts +0 -1
  352. package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -1
  353. package/dist/tests/fourslash/completions.declNames.method.fourslash.d.ts +0 -1
  354. package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -1
  355. package/dist/tests/fourslash/completions.declNames.overload.fourslash.d.ts +0 -1
  356. package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -1
  357. package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.d.ts +0 -1
  358. package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -1
  359. package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.d.ts +0 -1
  360. package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -1
  361. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.d.ts +0 -1
  362. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
  363. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.d.ts +0 -1
  364. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
  365. package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.d.ts +0 -1
  366. package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -1
  367. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.d.ts +0 -1
  368. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
  369. package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.d.ts +0 -1
  370. package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -1
  371. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.d.ts +0 -1
  372. package/dist/tests/fourslash/completions.dunderNew.fourslash.d.ts +0 -1
  373. package/dist/tests/fourslash/completions.enums.members.fourslash.d.ts +0 -1
  374. package/dist/tests/fourslash/completions.errorNodes.fourslash.d.ts +0 -1
  375. package/dist/tests/fourslash/completions.excluded.fourslash.d.ts +0 -1
  376. package/dist/tests/fourslash/completions.fourslash.d.ts +0 -1
  377. package/dist/tests/fourslash/completions.fstring.fourslash.d.ts +0 -1
  378. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.d.ts +0 -1
  379. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
  380. package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.d.ts +0 -1
  381. package/dist/tests/fourslash/completions.import.dunderNames.fourslash.d.ts +0 -1
  382. package/dist/tests/fourslash/completions.import.exactMatch.fourslash.d.ts +0 -1
  383. package/dist/tests/fourslash/completions.import.excludeAlreadyImported.fourslash.d.ts +0 -1
  384. package/dist/tests/fourslash/completions.import.interimFile.fourslash.disabled.d.ts +0 -1
  385. package/dist/tests/fourslash/completions.import.interimFile.fourslash.disabled.js.map +1 -1
  386. package/dist/tests/fourslash/completions.import.submodule.fourslash.d.ts +0 -1
  387. package/dist/tests/fourslash/completions.inList.fourslash.d.ts +0 -1
  388. package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -1
  389. package/dist/tests/fourslash/completions.included.fourslash.d.ts +0 -1
  390. package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.d.ts +0 -1
  391. package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -1
  392. package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.d.ts +0 -1
  393. package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.d.ts +0 -1
  394. package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.d.ts +0 -1
  395. package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.d.ts +0 -1
  396. package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.d.ts +0 -1
  397. package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.d.ts +0 -1
  398. package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -1
  399. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.d.ts +0 -1
  400. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.d.ts +0 -1
  401. package/dist/tests/fourslash/completions.libStub.fourslash.d.ts +0 -1
  402. package/dist/tests/fourslash/completions.literals.fourslash.d.ts +0 -1
  403. package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -1
  404. package/dist/tests/fourslash/completions.localCode.fourslash.d.ts +0 -1
  405. package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.d.ts +0 -1
  406. package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.d.ts +0 -1
  407. package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.d.ts +0 -1
  408. package/dist/tests/fourslash/completions.overloads.fourslash.d.ts +0 -1
  409. package/dist/tests/fourslash/completions.override.default.fourslash.d.ts +0 -1
  410. package/dist/tests/fourslash/completions.override.default.importStub.d.ts +0 -1
  411. package/dist/tests/fourslash/completions.override.default.imported.fourslash.d.ts +0 -1
  412. package/dist/tests/fourslash/completions.override.default.stub.fourslash.d.ts +0 -1
  413. package/dist/tests/fourslash/completions.override.fourslash.d.ts +0 -1
  414. package/dist/tests/fourslash/completions.override.property.fourslash.d.ts +0 -1
  415. package/dist/tests/fourslash/completions.override.property.stub.fourslash.d.ts +0 -1
  416. package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.d.ts +0 -1
  417. package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -1
  418. package/dist/tests/fourslash/completions.override.stub.fourslash.d.ts +0 -1
  419. package/dist/tests/fourslash/completions.override2.fourslash.d.ts +0 -1
  420. package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
  421. package/dist/tests/fourslash/completions.parameters.fourslash.d.ts +0 -1
  422. package/dist/tests/fourslash/completions.params.fourslash.d.ts +0 -1
  423. package/dist/tests/fourslash/completions.parentFolder.fourslash.d.ts +0 -1
  424. package/dist/tests/fourslash/completions.parentFolders.fourslash.d.ts +0 -1
  425. package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -1
  426. package/dist/tests/fourslash/completions.plainText.fourslash.d.ts +0 -1
  427. package/dist/tests/fourslash/completions.private.fourslash.d.ts +0 -1
  428. package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -1
  429. package/dist/tests/fourslash/completions.property.fourslash.d.ts +0 -1
  430. package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.d.ts +0 -1
  431. package/dist/tests/fourslash/completions.self.fourslash.d.ts +0 -1
  432. package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.d.ts +0 -1
  433. package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -1
  434. package/dist/tests/fourslash/completions.stringLiteral.fourslash.d.ts +0 -1
  435. package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
  436. package/dist/tests/fourslash/completions.triggers.fourslash.d.ts +0 -1
  437. package/dist/tests/fourslash/completions.triggers.fourslash.js.map +1 -1
  438. package/dist/tests/fourslash/completions.typeAlias.fourslash.d.ts +0 -1
  439. package/dist/tests/fourslash/completions.typeshed.fourslash.d.ts +0 -1
  440. package/dist/tests/fourslash/completions.vardecls.fourslash.d.ts +0 -1
  441. package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -1
  442. package/dist/tests/fourslash/completions.variableDocStrings.fourslash.d.ts +0 -1
  443. package/dist/tests/fourslash/completions.wildcardimports.fourslash.d.ts +0 -1
  444. package/dist/tests/fourslash/completions.with.fourslash.d.ts +0 -1
  445. package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.d.ts +0 -1
  446. package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -1
  447. package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.d.ts +0 -1
  448. package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -1
  449. package/dist/tests/fourslash/findDefinitions.classes.fourslash.d.ts +0 -1
  450. package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -1
  451. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.d.ts +0 -1
  452. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -1
  453. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.d.ts +0 -1
  454. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -1
  455. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.d.ts +0 -1
  456. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -1
  457. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.d.ts +0 -1
  458. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -1
  459. package/dist/tests/fourslash/findDefinitions.fields.fourslash.d.ts +0 -1
  460. package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -1
  461. package/dist/tests/fourslash/findDefinitions.functions.fourslash.d.ts +0 -1
  462. package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -1
  463. package/dist/tests/fourslash/findDefinitions.methods.fourslash.d.ts +0 -1
  464. package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -1
  465. package/dist/tests/fourslash/findDefinitions.modules.fourslash.d.ts +0 -1
  466. package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -1
  467. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.d.ts +0 -1
  468. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  469. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.d.ts +0 -1
  470. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -1
  471. package/dist/tests/fourslash/findDefinitions.overloads.fourslash.d.ts +0 -1
  472. package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -1
  473. package/dist/tests/fourslash/findDefinitions.parameters.fourslash.d.ts +0 -1
  474. package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -1
  475. package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.d.ts +0 -1
  476. package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -1
  477. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.d.ts +0 -1
  478. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -1
  479. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.d.ts +0 -1
  480. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -1
  481. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.d.ts +0 -1
  482. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -1
  483. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.d.ts +0 -1
  484. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -1
  485. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.d.ts +0 -1
  486. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -1
  487. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.d.ts +0 -1
  488. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -1
  489. package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.d.ts +0 -1
  490. package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -1
  491. package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.d.ts +0 -1
  492. package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -1
  493. package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.d.ts +0 -1
  494. package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -1
  495. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.d.ts +0 -1
  496. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -1
  497. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.d.ts +0 -1
  498. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -1
  499. package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.d.ts +0 -1
  500. package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -1
  501. package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.d.ts +0 -1
  502. package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -1
  503. package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.d.ts +0 -1
  504. package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -1
  505. package/dist/tests/fourslash/findDefinitions.variables.fourslash.d.ts +0 -1
  506. package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -1
  507. package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.d.ts +0 -1
  508. package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -1
  509. package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.d.ts +0 -1
  510. package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -1
  511. package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.d.ts +0 -1
  512. package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -1
  513. package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.d.ts +0 -1
  514. package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -1
  515. package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.d.ts +0 -1
  516. package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -1
  517. package/dist/tests/fourslash/findallreferences.fourslash.d.ts +0 -1
  518. package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -1
  519. package/dist/tests/fourslash/findallreferences.importalias.fourslash.d.ts +0 -1
  520. package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -1
  521. package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.d.ts +0 -1
  522. package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -1
  523. package/dist/tests/fourslash/findallreferences.module.nested.fourslash.d.ts +0 -1
  524. package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -1
  525. package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.d.ts +0 -1
  526. package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -1
  527. package/dist/tests/fourslash/findallreferences.modules.fourslash.d.ts +0 -1
  528. package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -1
  529. package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.d.ts +0 -1
  530. package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -1
  531. package/dist/tests/fourslash/findallreferences.openFiles.fourslash.d.ts +0 -1
  532. package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -1
  533. package/dist/tests/fourslash/findallreferences.parameter.fourslash.d.ts +0 -1
  534. package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -1
  535. package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.d.ts +0 -1
  536. package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -1
  537. package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.d.ts +0 -1
  538. package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -1
  539. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.d.ts +0 -1
  540. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -1
  541. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.d.ts +0 -1
  542. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -1
  543. package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.d.ts +0 -1
  544. package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -1
  545. package/dist/tests/fourslash/findallreferences.variable.fourslash.d.ts +0 -1
  546. package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -1
  547. package/dist/tests/fourslash/highlightreferences.attributes.fourslash.d.ts +0 -1
  548. package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -1
  549. package/dist/tests/fourslash/hover.async.fourslash.d.ts +0 -1
  550. package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByBuiltin.fourslash.d.ts +0 -1
  551. package/dist/tests/fourslash/hover.builtinDocstrings.builtinInheritedByUserCode.fourslash.d.ts +0 -1
  552. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.d.ts +0 -1
  553. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  554. package/dist/tests/fourslash/hover.class.docString.fourslash.d.ts +0 -1
  555. package/dist/tests/fourslash/hover.classNoInit.fourslash.d.ts +0 -1
  556. package/dist/tests/fourslash/hover.docFromSrc.fourslash.d.ts +0 -1
  557. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.d.ts +0 -1
  558. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.d.ts +0 -1
  559. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.d.ts +0 -1
  560. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.d.ts +0 -1
  561. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.d.ts +0 -1
  562. package/dist/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.d.ts +0 -1
  563. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.d.ts +0 -1
  564. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.d.ts +0 -1
  565. package/dist/tests/fourslash/hover.docstring.alias.fourslash.d.ts +0 -1
  566. package/dist/tests/fourslash/hover.docstring.links.fourslash.d.ts +0 -1
  567. package/dist/tests/fourslash/hover.docstring.overloads.fourslash.d.ts +0 -1
  568. package/dist/tests/fourslash/hover.docstring.parameter.fourslash.d.ts +0 -1
  569. package/dist/tests/fourslash/hover.docstring.split.fourslash.d.ts +0 -1
  570. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.d.ts +0 -1
  571. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.d.ts +0 -1
  572. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.d.ts +0 -1
  573. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.d.ts +0 -1
  574. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.d.ts +0 -1
  575. package/dist/tests/fourslash/hover.formatted.fourslash.d.ts +0 -1
  576. package/dist/tests/fourslash/hover.fourslash.d.ts +0 -1
  577. package/dist/tests/fourslash/hover.import.django.view.fourslash.d.ts +0 -1
  578. package/dist/tests/fourslash/hover.import.fourslash.d.ts +0 -1
  579. package/dist/tests/fourslash/hover.inferred.fourslash.d.ts +0 -1
  580. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.d.ts +0 -1
  581. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.d.ts +0 -1
  582. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.d.ts +0 -1
  583. package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.d.ts +0 -1
  584. package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.d.ts +0 -1
  585. package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.d.ts +0 -1
  586. package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.d.ts +0 -1
  587. package/dist/tests/fourslash/hover.init.fourslash.d.ts +0 -1
  588. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.d.ts +0 -1
  589. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.d.ts +0 -1
  590. package/dist/tests/fourslash/hover.libStub.fourslash.d.ts +0 -1
  591. package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.d.ts +0 -1
  592. package/dist/tests/fourslash/hover.overloadedFunction.fourslash.d.ts +0 -1
  593. package/dist/tests/fourslash/hover.plainText.fourslash.d.ts +0 -1
  594. package/dist/tests/fourslash/hover.slots.fourslash.d.ts +0 -1
  595. package/dist/tests/fourslash/hover.typedDict.key.fourslash.d.ts +0 -1
  596. package/dist/tests/fourslash/hover.unpackedTypedDict.key.fourslash.d.ts +0 -1
  597. package/dist/tests/fourslash/hover.variable.docString.fourslash.d.ts +0 -1
  598. package/dist/tests/fourslash/hover.wildcardimports.fourslash.d.ts +0 -1
  599. package/dist/tests/fourslash/import.multipart.fourslash.d.ts +0 -1
  600. package/dist/tests/fourslash/import.nameconflict.fourslash.d.ts +0 -1
  601. package/dist/tests/fourslash/import.publicSymbols.fourslash.d.ts +0 -1
  602. package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -1
  603. package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.d.ts +0 -1
  604. package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.d.ts +0 -1
  605. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.d.ts +0 -1
  606. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.d.ts +0 -1
  607. package/dist/tests/fourslash/import.wildcard.fourslash.d.ts +0 -1
  608. package/dist/tests/fourslash/importnotresolved.fourslash.d.ts +0 -1
  609. package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.d.ts +0 -1
  610. package/dist/tests/fourslash/missingModuleSource.fourslash.d.ts +0 -1
  611. package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.d.ts +0 -1
  612. package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.d.ts +0 -1
  613. package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.d.ts +0 -1
  614. package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.d.ts +0 -1
  615. package/dist/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.d.ts +0 -1
  616. package/dist/tests/fourslash/missingTypeStub.fourslash.d.ts +0 -1
  617. package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.d.ts +0 -1
  618. package/dist/tests/fourslash/noerrors.fourslash.d.ts +0 -1
  619. package/dist/tests/fourslash/orderImports1.command.fourslash.d.ts +0 -1
  620. package/dist/tests/fourslash/orderImports2.command.fourslash.d.ts +0 -1
  621. package/dist/tests/fourslash/rename.args.fourslash.d.ts +0 -1
  622. package/dist/tests/fourslash/rename.args.fourslash.js.map +1 -1
  623. package/dist/tests/fourslash/rename.externallyHidden.fourslash.d.ts +0 -1
  624. package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.d.ts +0 -1
  625. package/dist/tests/fourslash/rename.fourslash.d.ts +0 -1
  626. package/dist/tests/fourslash/rename.fourslash.js.map +1 -1
  627. package/dist/tests/fourslash/rename.function.untitledFile.fourslash.d.ts +0 -1
  628. package/dist/tests/fourslash/rename.function.untitledFile.fourslash.js.map +1 -1
  629. package/dist/tests/fourslash/rename.init.fourslash.d.ts +0 -1
  630. package/dist/tests/fourslash/rename.init.fourslash.js.map +1 -1
  631. package/dist/tests/fourslash/rename.library.fourslash.d.ts +0 -1
  632. package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.d.ts +0 -1
  633. package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +0 -1
  634. package/dist/tests/fourslash/rename.parens.fourslash.d.ts +0 -1
  635. package/dist/tests/fourslash/rename.parens.fourslash.js.map +1 -1
  636. package/dist/tests/fourslash/rename.sourceAndStub.fourslash.d.ts +0 -1
  637. package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -1
  638. package/dist/tests/fourslash/rename.string.excluded.fourslash.d.ts +0 -1
  639. package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -1
  640. package/dist/tests/fourslash/rename.string.fourslash.d.ts +0 -1
  641. package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -1
  642. package/dist/tests/fourslash/shadowedImports.fourslash.d.ts +0 -1
  643. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.d.ts +0 -1
  644. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.js.map +1 -1
  645. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.d.ts +0 -1
  646. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.js.map +1 -1
  647. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.d.ts +0 -1
  648. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.js.map +1 -1
  649. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.d.ts +0 -1
  650. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.js.map +1 -1
  651. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.d.ts +0 -1
  652. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.js.map +1 -1
  653. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.d.ts +0 -1
  654. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.js.map +1 -1
  655. package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.d.ts +0 -1
  656. package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -1
  657. package/dist/tests/fourslash/signature.complicated.fourslash.d.ts +0 -1
  658. package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
  659. package/dist/tests/fourslash/signature.cornercases.fourslash.d.ts +0 -1
  660. package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -1
  661. package/dist/tests/fourslash/signature.docstrings.fourslash.d.ts +0 -1
  662. package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -1
  663. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.d.ts +0 -1
  664. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
  665. package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.d.ts +0 -1
  666. package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -1
  667. package/dist/tests/fourslash/signature.dunderNew.fourslash.d.ts +0 -1
  668. package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -1
  669. package/dist/tests/fourslash/signature.overload.fourslash.d.ts +0 -1
  670. package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -1
  671. package/dist/tests/fourslash/signature.simple.fourslash.d.ts +0 -1
  672. package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -1
  673. package/dist/tests/fourslash/typeVerifier.fourslash.d.ts +0 -1
  674. package/dist/tests/fourslash/typeVerifier.fourslash.js.map +1 -1
  675. package/dist/tests/harness/fourslash/fourSlashParser.js +1 -2
  676. package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
  677. package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
  678. package/dist/tests/harness/fourslash/runner.d.ts +0 -1
  679. package/dist/tests/harness/fourslash/runner.js +2 -3
  680. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  681. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  682. package/dist/tests/harness/fourslash/testState.js +7 -7
  683. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  684. package/dist/tests/harness/fourslash/testStateUtils.js +4 -5
  685. package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
  686. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +7 -8
  687. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  688. package/dist/tests/harness/testHost.js.map +1 -1
  689. package/dist/tests/harness/utils.d.ts +0 -2
  690. package/dist/tests/harness/utils.js +7 -7
  691. package/dist/tests/harness/utils.js.map +1 -1
  692. package/dist/tests/harness/vfs/factory.js +3 -3
  693. package/dist/tests/harness/vfs/factory.js.map +1 -1
  694. package/dist/tests/harness/vfs/filesystem.d.ts +0 -2
  695. package/dist/tests/harness/vfs/filesystem.js +2 -2
  696. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  697. package/dist/tests/harness/vfs/pathValidation.js +2 -2
  698. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  699. package/dist/tests/importResolver.test.js.map +1 -1
  700. package/dist/tests/importStatementUtils.test.js.map +1 -1
  701. package/dist/tests/ipythonMode.test.js.map +1 -1
  702. package/dist/tests/languageServer.test.js.map +1 -1
  703. package/dist/tests/localizer.test.js.map +1 -1
  704. package/dist/tests/lsp/languageServer.js +1 -2
  705. package/dist/tests/lsp/languageServer.js.map +1 -1
  706. package/dist/tests/lsp/languageServerTestUtils.js +14 -14
  707. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -1
  708. package/dist/tests/lsp/webpack.testserver.config.d.ts +2 -2
  709. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  710. package/dist/tests/pathUtils.test.js.map +1 -1
  711. package/dist/tests/pyrightFileSystem.test.js.map +1 -1
  712. package/dist/tests/serialization.test.js +1 -2
  713. package/dist/tests/serialization.test.js.map +1 -1
  714. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  715. package/dist/tests/testStateUtils.js +5 -6
  716. package/dist/tests/testStateUtils.js.map +1 -1
  717. package/dist/tests/testUtils.js +8 -9
  718. package/dist/tests/testUtils.js.map +1 -1
  719. package/dist/tests/textEditUtil.test.js.map +1 -1
  720. package/dist/tests/tokenizer.test.js.map +1 -1
  721. package/dist/tests/typeEvaluator1.test.js +6 -6
  722. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  723. package/dist/tests/typeEvaluator2.test.js +8 -0
  724. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  725. package/dist/tests/typeEvaluator3.test.js +2 -2
  726. package/dist/tests/typeEvaluator4.test.js +2 -2
  727. package/dist/tests/typeEvaluator6.test.js +17 -9
  728. package/dist/tests/typeEvaluator6.test.js.map +1 -1
  729. package/dist/tests/uri.test.js.map +1 -1
  730. package/dist/workspaceFactory.js +3 -3
  731. package/dist/workspaceFactory.js.map +1 -1
  732. package/package.json +2 -2
@@ -38,7 +38,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
38
38
  return result;
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.createTypeEvaluator = exports.maxCodeComplexity = void 0;
41
+ exports.maxCodeComplexity = void 0;
42
+ exports.createTypeEvaluator = createTypeEvaluator;
42
43
  const cancellationUtils_1 = require("../common/cancellationUtils");
43
44
  const collectionUtils_1 = require("../common/collectionUtils");
44
45
  const debug_1 = require("../common/debug");
@@ -571,8 +572,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
571
572
  const diag = new diagnostic_1.DiagnosticAddendum();
572
573
  // Make sure the resulting type is assignable to the expected type.
573
574
  if (!assignType(inferenceContext.expectedType, typeResult.type, diag,
574
- /* destConstraints */ undefined,
575
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
575
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
576
576
  typeResult.typeErrors = true;
577
577
  typeResult.expectedTypeDiagAddendum = diag;
578
578
  diag.addTextRange(node);
@@ -1123,7 +1123,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1123
1123
  return (0, types_1.findSubtype)(type, (subtype) => canBeFalsy(subtype, recursionCount)) !== undefined;
1124
1124
  }
1125
1125
  case 4 /* TypeCategory.Function */:
1126
- case 5 /* TypeCategory.OverloadedFunction */:
1126
+ case 5 /* TypeCategory.Overloaded */:
1127
1127
  case 7 /* TypeCategory.Module */:
1128
1128
  case 9 /* TypeCategory.TypeVar */: {
1129
1129
  return false;
@@ -1142,9 +1142,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1142
1142
  return (0, typeUtils_1.isUnboundedTupleClass)(tupleBaseClass) || tupleBaseClass.priv.tupleTypeArgs.length === 0;
1143
1143
  }
1144
1144
  // Check for bool, int, str and bytes literals that are never falsy.
1145
- if (type.priv.literalValue !== undefined &&
1146
- types_1.ClassType.isBuiltIn(type, ['bool', 'int', 'str', 'bytes'])) {
1147
- return !type.priv.literalValue || type.priv.literalValue === BigInt(0);
1145
+ if (type.priv.literalValue !== undefined) {
1146
+ if (types_1.ClassType.isBuiltIn(type, ['bool', 'int', 'str', 'bytes'])) {
1147
+ return !type.priv.literalValue || type.priv.literalValue === BigInt(0);
1148
+ }
1149
+ if (type.priv.literalValue instanceof types_1.EnumLiteral) {
1150
+ // Does the Enum class forward the truthiness check to the
1151
+ // underlying member type?
1152
+ if (type.priv.literalValue.isReprEnum) {
1153
+ return canBeFalsy(type.priv.literalValue.itemType, recursionCount);
1154
+ }
1155
+ }
1148
1156
  }
1149
1157
  // If this is a protocol class, don't make any assumptions about the absence
1150
1158
  // of specific methods. These could be provided by a class that conforms
@@ -1189,7 +1197,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1189
1197
  switch (type.category) {
1190
1198
  case 1 /* TypeCategory.Unknown */:
1191
1199
  case 4 /* TypeCategory.Function */:
1192
- case 5 /* TypeCategory.OverloadedFunction */:
1200
+ case 5 /* TypeCategory.Overloaded */:
1193
1201
  case 7 /* TypeCategory.Module */:
1194
1202
  case 9 /* TypeCategory.TypeVar */:
1195
1203
  case 3 /* TypeCategory.Never */:
@@ -1214,9 +1222,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1214
1222
  return false;
1215
1223
  }
1216
1224
  // Check for bool, int, str and bytes literals that are never falsy.
1217
- if (type.priv.literalValue !== undefined &&
1218
- types_1.ClassType.isBuiltIn(type, ['bool', 'int', 'str', 'bytes'])) {
1219
- return !!type.priv.literalValue && type.priv.literalValue !== BigInt(0);
1225
+ if (type.priv.literalValue !== undefined) {
1226
+ if (types_1.ClassType.isBuiltIn(type, ['bool', 'int', 'str', 'bytes'])) {
1227
+ return !!type.priv.literalValue && type.priv.literalValue !== BigInt(0);
1228
+ }
1229
+ if (type.priv.literalValue instanceof types_1.EnumLiteral) {
1230
+ // Does the Enum class forward the truthiness check to the
1231
+ // underlying member type?
1232
+ if (type.priv.literalValue.isReprEnum) {
1233
+ return canBeTruthy(type.priv.literalValue.itemType, recursionCount);
1234
+ }
1235
+ }
1220
1236
  }
1221
1237
  // If this is a protocol class, don't make any assumptions about the absence
1222
1238
  // of specific methods. These could be provided by a class that conforms
@@ -1344,9 +1360,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1344
1360
  });
1345
1361
  }
1346
1362
  function solveAndApplyConstraints(type, constraints, applyOptions, solveOptions) {
1347
- if (solveOptions === null || solveOptions === void 0 ? void 0 : solveOptions.applyUnificationVars) {
1348
- (0, constraintSolver_1.applyUnificationVars)(evaluatorInterface, constraints);
1349
- }
1350
1363
  const solution = (0, constraintSolver_1.solveConstraints)(evaluatorInterface, constraints, solveOptions);
1351
1364
  return (0, typeUtils_1.applySolvedTypeVars)(type, solution, applyOptions);
1352
1365
  }
@@ -1484,7 +1497,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1484
1497
  if (!boundMethodResult || boundMethodResult.typeErrors) {
1485
1498
  return undefined;
1486
1499
  }
1487
- if ((0, types_1.isFunction)(boundMethodResult.type) || (0, types_1.isOverloadedFunction)(boundMethodResult.type)) {
1500
+ if ((0, types_1.isFunction)(boundMethodResult.type) || (0, types_1.isOverloaded)(boundMethodResult.type)) {
1488
1501
  return boundMethodResult.type;
1489
1502
  }
1490
1503
  if ((0, types_1.isClassInstance)(boundMethodResult.type)) {
@@ -1557,7 +1570,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1557
1570
  addOneFunctionToSignature(type);
1558
1571
  }
1559
1572
  else {
1560
- types_1.OverloadedFunctionType.getOverloads(type).forEach((func) => {
1573
+ types_1.OverloadedType.getOverloads(type).forEach((func) => {
1561
1574
  addOneFunctionToSignature(func);
1562
1575
  });
1563
1576
  }
@@ -1565,7 +1578,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1565
1578
  (0, typeUtils_1.doForEachSubtype)(callType, (subtype) => {
1566
1579
  switch (subtype.category) {
1567
1580
  case 4 /* TypeCategory.Function */:
1568
- case 5 /* TypeCategory.OverloadedFunction */: {
1581
+ case 5 /* TypeCategory.Overloaded */: {
1569
1582
  addFunctionToSignature(subtype);
1570
1583
  break;
1571
1584
  }
@@ -1574,7 +1587,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1574
1587
  const constructorType = (0, constructors_1.createFunctionFromConstructor)(evaluatorInterface, subtype);
1575
1588
  if (constructorType) {
1576
1589
  (0, typeUtils_1.doForEachSubtype)(constructorType, (subtype) => {
1577
- if ((0, types_1.isFunction)(subtype) || (0, types_1.isOverloadedFunction)(subtype)) {
1590
+ if ((0, types_1.isFunction)(subtype) || (0, types_1.isOverloaded)(subtype)) {
1578
1591
  addFunctionToSignature(subtype);
1579
1592
  }
1580
1593
  });
@@ -1629,7 +1642,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1629
1642
  }
1630
1643
  const kwSeparatorIndex = functionType.shared.parameters.findIndex((param) => param.category === 1 /* ParamCategory.ArgsList */);
1631
1644
  // Add a keyword separator if necessary.
1632
- if (kwSeparatorIndex < 0) {
1645
+ if (kwSeparatorIndex < 0 && tdEntries.size > 0) {
1633
1646
  types_1.FunctionType.addKeywordOnlyParamSeparator(newFunction);
1634
1647
  }
1635
1648
  tdEntries.forEach((tdEntry, name) => {
@@ -1747,7 +1760,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
1747
1760
  if (memberAccessClass && (0, types_1.isInstantiableClass)(memberAccessClass)) {
1748
1761
  declaredType = (0, typeUtils_1.partiallySpecializeType)(declaredType, memberAccessClass, getTypeClassType());
1749
1762
  }
1750
- if ((0, types_1.isFunction)(declaredType) || (0, types_1.isOverloadedFunction)(declaredType)) {
1763
+ if ((0, types_1.isFunction)(declaredType) || (0, types_1.isOverloaded)(declaredType)) {
1751
1764
  if (bindFunction) {
1752
1765
  declaredType = bindFunctionToClassOrObject(classOrObjectBase, declaredType);
1753
1766
  }
@@ -2726,6 +2739,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
2726
2739
  if (variance !== 3 /* Variance.Covariant */) {
2727
2740
  return typeArg;
2728
2741
  }
2742
+ // Don't expand recursive type aliases because they can
2743
+ // cause infinite recursion.
2744
+ if ((0, types_1.isTypeVar)(typeArg) && typeArg.shared.recursiveAlias) {
2745
+ return typeArg;
2746
+ }
2729
2747
  const filteredTypeArg = mapSubtypesExpandTypeVars(typeArg, { conditionFilter }, (expandedSubtype) => {
2730
2748
  return expandedSubtype;
2731
2749
  }, recursionCount);
@@ -3776,7 +3794,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
3776
3794
  if (isModuleGetAttrSupported) {
3777
3795
  const getAttrTypeResult = getEffectiveTypeOfSymbolForUsage(getAttrSymbol);
3778
3796
  if ((0, types_1.isFunction)(getAttrTypeResult.type)) {
3779
- type = getFunctionEffectiveReturnType(getAttrTypeResult.type);
3797
+ type = getEffectiveReturnType(getAttrTypeResult.type);
3780
3798
  if (getAttrTypeResult.isIncomplete) {
3781
3799
  isIncomplete = true;
3782
3800
  }
@@ -3841,12 +3859,22 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
3841
3859
  break;
3842
3860
  }
3843
3861
  case 4 /* TypeCategory.Function */:
3844
- case 5 /* TypeCategory.OverloadedFunction */: {
3862
+ case 5 /* TypeCategory.Overloaded */: {
3845
3863
  if (memberName === '__self__') {
3846
3864
  // The "__self__" member is not currently defined in the "function"
3847
3865
  // class, so we'll special-case it here.
3848
- const functionType = (0, types_1.isFunction)(baseType) ? baseType : baseType.priv.overloads[0];
3849
- if (functionType.priv.preBoundFlags !== undefined &&
3866
+ let functionType;
3867
+ if ((0, types_1.isFunction)(baseType)) {
3868
+ functionType = baseType;
3869
+ }
3870
+ else {
3871
+ const overloads = types_1.OverloadedType.getOverloads(baseType);
3872
+ if (overloads.length > 0) {
3873
+ functionType = overloads[0];
3874
+ }
3875
+ }
3876
+ if (functionType &&
3877
+ functionType.priv.preBoundFlags !== undefined &&
3850
3878
  (functionType.priv.preBoundFlags & 4 /* FunctionTypeFlags.StaticMethod */) === 0) {
3851
3879
  type = functionType.priv.boundToType;
3852
3880
  }
@@ -3863,7 +3891,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
3863
3891
  // member could not be accessed.
3864
3892
  if (!type) {
3865
3893
  const isFunctionRule = (0, types_1.isFunction)(baseType) ||
3866
- (0, types_1.isOverloadedFunction)(baseType) ||
3894
+ (0, types_1.isOverloaded)(baseType) ||
3867
3895
  ((0, types_1.isClassInstance)(baseType) && types_1.ClassType.isBuiltIn(baseType, 'function'));
3868
3896
  if (!baseTypeResult.isIncomplete) {
3869
3897
  let diagMessage = localize_1.LocMessage.memberAccess();
@@ -4058,7 +4086,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
4058
4086
  }
4059
4087
  resultType = descResult.type;
4060
4088
  }
4061
- else if ((0, types_1.isFunction)(concreteSubtype) || (0, types_1.isOverloadedFunction)(concreteSubtype)) {
4089
+ else if ((0, types_1.isFunction)(concreteSubtype) || (0, types_1.isOverloaded)(concreteSubtype)) {
4062
4090
  const typeResult = bindMethodForMemberAccess(subtype, concreteSubtype, memberInfo, classType, selfType, flags, memberName, usage, diag, recursionCount);
4063
4091
  resultType = typeResult.type;
4064
4092
  if (typeResult.typeErrors) {
@@ -4184,7 +4212,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
4184
4212
  if (methodTypeResult.typeErrors || !methodClassType) {
4185
4213
  return { type: types_1.UnknownType.create(), typeErrors: true };
4186
4214
  }
4187
- if (!(0, types_1.isFunction)(methodType) && !(0, types_1.isOverloadedFunction)(methodType)) {
4215
+ if (!(0, types_1.isFunction)(methodType) && !(0, types_1.isOverloaded)(methodType)) {
4188
4216
  if ((0, types_1.isAnyOrUnknown)(methodType)) {
4189
4217
  return { type: methodType };
4190
4218
  }
@@ -4228,7 +4256,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
4228
4256
  /* diag */ undefined, constraints);
4229
4257
  accessMethodClass = solveAndApplyConstraints(accessMethodClass, constraints);
4230
4258
  const specializedType = (0, typeUtils_1.partiallySpecializeType)(methodType, accessMethodClass, getTypeClassType(), selfType ? (0, typeUtils_1.convertToInstantiable)(selfType) : classType);
4231
- if ((0, types_1.isFunction)(specializedType) || (0, types_1.isOverloadedFunction)(specializedType)) {
4259
+ if ((0, types_1.isFunction)(specializedType) || (0, types_1.isOverloaded)(specializedType)) {
4232
4260
  methodType = specializedType;
4233
4261
  }
4234
4262
  }
@@ -4342,10 +4370,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
4342
4370
  function bindMethodForMemberAccess(type, concreteType, memberInfo, classType, selfType, flags, memberName, usage, diag, recursionCount = 0) {
4343
4371
  // Check for an attempt to overwrite a final method.
4344
4372
  if (usage.method === 'set') {
4345
- const impl = (0, types_1.isFunction)(concreteType)
4346
- ? concreteType
4347
- : types_1.OverloadedFunctionType.getImplementation(concreteType);
4348
- if (impl && types_1.FunctionType.isFinal(impl) && memberInfo && (0, types_1.isClass)(memberInfo.classType)) {
4373
+ const impl = (0, types_1.isFunction)(concreteType) ? concreteType : types_1.OverloadedType.getImplementation(concreteType);
4374
+ if (impl && (0, types_1.isFunction)(impl) && types_1.FunctionType.isFinal(impl) && memberInfo && (0, types_1.isClass)(memberInfo.classType)) {
4349
4375
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocMessage.finalMethodOverride().format({
4350
4376
  name: memberName,
4351
4377
  className: memberInfo.classType.shared.name,
@@ -4474,7 +4500,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
4474
4500
  },
4475
4501
  });
4476
4502
  }
4477
- if (!(0, types_1.isFunction)(accessMemberType) && !(0, types_1.isOverloadedFunction)(accessMemberType)) {
4503
+ if (!(0, types_1.isFunction)(accessMemberType) && !(0, types_1.isOverloaded)(accessMemberType)) {
4478
4504
  if ((0, types_1.isAnyOrUnknown)(accessMemberType)) {
4479
4505
  return { type: accessMemberType };
4480
4506
  }
@@ -4717,7 +4743,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
4717
4743
  typeArgs = [
4718
4744
  {
4719
4745
  type: types_1.UnknownType.create(),
4720
- node: typeArgs[0].node,
4746
+ node: typeArgs.length > 0 ? typeArgs[0].node : node,
4721
4747
  typeList: typeArgs,
4722
4748
  },
4723
4749
  ];
@@ -5288,23 +5314,28 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
5288
5314
  function getTypeArgs(node, flags, options) {
5289
5315
  const typeArgs = [];
5290
5316
  let adjFlags = flags | 33554432 /* EvalFlags.NoConvertSpecialForm */;
5291
- if (options === null || options === void 0 ? void 0 : options.isFinalAnnotation) {
5292
- adjFlags |= 131072 /* EvalFlags.NoClassVar */ | 16 /* EvalFlags.NoFinal */;
5293
- }
5294
- else if (options === null || options === void 0 ? void 0 : options.isClassVarAnnotation) {
5295
- adjFlags |= 131072 /* EvalFlags.NoClassVar */;
5317
+ const allowFinalClassVar = () => {
5296
5318
  // If the annotation is a variable within the body of a dataclass, a
5297
- // Final is allowed within the ClassVar annotation. In all other cases,
5319
+ // Final is allowed with a ClassVar annotation. In all other cases,
5298
5320
  // it's disallowed.
5299
- let disallowFinal = true;
5300
5321
  const enclosingClassNode = ParseTreeUtils.getEnclosingClass(node, /* stopeAtFunction */ true);
5301
5322
  if (enclosingClassNode) {
5302
5323
  const classTypeInfo = getTypeOfClass(enclosingClassNode);
5303
5324
  if (classTypeInfo && types_1.ClassType.isDataClass(classTypeInfo.classType)) {
5304
- disallowFinal = false;
5325
+ return true;
5305
5326
  }
5306
5327
  }
5307
- if (disallowFinal) {
5328
+ return false;
5329
+ };
5330
+ if (options === null || options === void 0 ? void 0 : options.isFinalAnnotation) {
5331
+ adjFlags |= 16 /* EvalFlags.NoFinal */;
5332
+ if (!allowFinalClassVar()) {
5333
+ adjFlags |= 131072 /* EvalFlags.NoClassVar */;
5334
+ }
5335
+ }
5336
+ else if (options === null || options === void 0 ? void 0 : options.isClassVarAnnotation) {
5337
+ adjFlags |= 131072 /* EvalFlags.NoClassVar */;
5338
+ if (!allowFinalClassVar()) {
5308
5339
  adjFlags |= 16 /* EvalFlags.NoFinal */;
5309
5340
  }
5310
5341
  }
@@ -6334,7 +6365,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
6334
6365
  const speculativeNode = getSpeculativeNodeForCall(errorNode);
6335
6366
  useSignatureTracker(errorNode, () => {
6336
6367
  // Create a list of potential overload matches based on arguments.
6337
- types_1.OverloadedFunctionType.getOverloads(typeResult.type).forEach((overload) => {
6368
+ types_1.OverloadedType.getOverloads(typeResult.type).forEach((overload) => {
6338
6369
  useSpeculativeMode(speculativeNode, () => {
6339
6370
  const matchResults = matchArgsToParams(errorNode, argList, { type: overload, isIncomplete: typeResult.isIncomplete }, overloadIndex);
6340
6371
  if (!matchResults.argumentErrors) {
@@ -6381,7 +6412,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
6381
6412
  // cache or record any diagnostics at this stage.
6382
6413
  useSpeculativeMode(speculativeNode, () => {
6383
6414
  let overloadIndex = 0;
6384
- types_1.OverloadedFunctionType.getOverloads(type).forEach((overload) => {
6415
+ types_1.OverloadedType.getOverloads(type).forEach((overload) => {
6385
6416
  // Consider only the functions that have the @overload decorator,
6386
6417
  // not the final function that omits the overload. This is the
6387
6418
  // intended behavior according to PEP 484.
@@ -6399,7 +6430,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
6399
6430
  // Skip the error message if we're in speculative mode because it's very
6400
6431
  // expensive, and we're going to suppress the diagnostic anyway.
6401
6432
  if (!canSkipDiagnosticForNode(errorNode)) {
6402
- const functionName = type.priv.overloads[0].shared.name || '<anonymous function>';
6433
+ const overloads = types_1.OverloadedType.getOverloads(type);
6434
+ const functionName = overloads.length > 0 && overloads[0].shared.name
6435
+ ? overloads[0].shared.name
6436
+ : '<anonymous function>';
6403
6437
  const diagAddendum = new diagnostic_1.DiagnosticAddendum();
6404
6438
  const argTypes = argList.map((t) => {
6405
6439
  const typeString = printType(getTypeOfArg(t, /* inferenceContext */ undefined).type);
@@ -6620,8 +6654,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
6620
6654
  case 4 /* TypeCategory.Function */: {
6621
6655
  return validateCallForFunction(errorNode, argList, expandedCallType, isCallTypeIncomplete, constraints, skipUnknownArgCheck, inferenceContext);
6622
6656
  }
6623
- case 5 /* TypeCategory.OverloadedFunction */: {
6624
- return validateCallForOverloadedFunction(errorNode, argList, expandedCallType, isCallTypeIncomplete, constraints, skipUnknownArgCheck, inferenceContext);
6657
+ case 5 /* TypeCategory.Overloaded */: {
6658
+ return validateCallForOverloaded(errorNode, argList, expandedCallType, isCallTypeIncomplete, constraints, skipUnknownArgCheck, inferenceContext);
6625
6659
  }
6626
6660
  case 6 /* TypeCategory.Class */: {
6627
6661
  if ((0, typeUtils_1.isNoneInstance)(expandedCallType)) {
@@ -6776,10 +6810,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
6776
6810
  }
6777
6811
  return { symbol, symbolName, classType, hasImplementation };
6778
6812
  }
6779
- function validateCallForOverloadedFunction(errorNode, argList, expandedCallType, isCallTypeIncomplete, constraints, skipUnknownArgCheck, inferenceContext) {
6813
+ function validateCallForOverloaded(errorNode, argList, expandedCallType, isCallTypeIncomplete, constraints, skipUnknownArgCheck, inferenceContext) {
6780
6814
  var _a, _b;
6815
+ const overloads = types_1.OverloadedType.getOverloads(expandedCallType);
6781
6816
  // Handle the 'cast' call as a special case.
6782
- if (types_1.FunctionType.isBuiltIn(expandedCallType.priv.overloads[0], 'cast') && argList.length === 2) {
6817
+ if (overloads.length > 0 &&
6818
+ types_1.FunctionType.isBuiltIn(overloads[0], ['typing.cast', 'typing_extensions.cast']) &&
6819
+ argList.length === 2) {
6783
6820
  return { returnType: evaluateCastCall(argList, errorNode) };
6784
6821
  }
6785
6822
  const callResult = validateOverloadedArgTypes(errorNode, argList, { type: expandedCallType, isIncomplete: isCallTypeIncomplete }, constraints, skipUnknownArgCheck, inferenceContext);
@@ -6890,7 +6927,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
6890
6927
  };
6891
6928
  const initTypeResult = (0, constructors_1.getBoundInitMethod)(evaluatorInterface, errorNode, types_1.ClassType.cloneAsInstance(expandedCallType),
6892
6929
  /* diag */ undefined, 0 /* MemberAccessFlags.Default */);
6893
- if (initTypeResult && (0, types_1.isOverloadedFunction)(initTypeResult.type)) {
6930
+ if (initTypeResult && (0, types_1.isOverloaded)(initTypeResult.type)) {
6894
6931
  validateOverloadedArgTypes(errorNode, argList, { type: initTypeResult.type },
6895
6932
  /* constraints */ undefined, skipUnknownArgCheck,
6896
6933
  /* inferenceContext */ undefined);
@@ -7240,6 +7277,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7240
7277
  argType.priv.tupleTypeArgs.length > 0) {
7241
7278
  tooManyPositionals = true;
7242
7279
  }
7280
+ else {
7281
+ matchedUnpackedListOfUnknownLength = true;
7282
+ }
7243
7283
  }
7244
7284
  else {
7245
7285
  tooManyPositionals = true;
@@ -7495,7 +7535,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7495
7535
  }
7496
7536
  }
7497
7537
  if (!reportedArgError) {
7498
- let unpackedDictionaryArgType;
7538
+ let unpackedDictKeyNames;
7539
+ let unpackedDictArgType;
7499
7540
  // Now consume any keyword arguments.
7500
7541
  while (argIndex < argList.length) {
7501
7542
  if (argList[argIndex].argCategory === 2 /* ArgCategory.UnpackedDictionary */) {
@@ -7506,7 +7547,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7506
7547
  isTypeIncomplete = true;
7507
7548
  }
7508
7549
  if ((0, types_1.isAnyOrUnknown)(argType)) {
7509
- unpackedDictionaryArgType = argType;
7550
+ unpackedDictArgType = argType;
7510
7551
  }
7511
7552
  else if ((0, types_1.isClassInstance)(argType) && types_1.ClassType.isTypedDictClass(argType)) {
7512
7553
  // Handle the special case where it is a TypedDict and we know which
@@ -7575,7 +7616,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7575
7616
  }
7576
7617
  }
7577
7618
  else if (paramSpec && (0, parameterUtils_1.isParamSpecKwargs)(paramSpec, argType)) {
7578
- unpackedDictionaryArgType = types_1.AnyType.create();
7619
+ unpackedDictArgType = types_1.AnyType.create();
7579
7620
  if (!paramSpecArgList) {
7580
7621
  validateArgTypeParams.push({
7581
7622
  paramCategory: 2 /* ParamCategory.KwargsDict */,
@@ -7608,20 +7649,29 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7608
7649
  if (assignType(strObjType, typeArgs[0])) {
7609
7650
  isValidMappingType = true;
7610
7651
  }
7611
- unpackedDictionaryArgType = typeArgs[1];
7652
+ unpackedDictKeyNames = [];
7653
+ (0, typeUtils_1.doForEachSubtype)(typeArgs[0], (keyType) => {
7654
+ if ((0, types_1.isClassInstance)(keyType) && typeof keyType.priv.literalValue === 'string') {
7655
+ unpackedDictKeyNames === null || unpackedDictKeyNames === void 0 ? void 0 : unpackedDictKeyNames.push(keyType.priv.literalValue);
7656
+ }
7657
+ else {
7658
+ unpackedDictKeyNames = undefined;
7659
+ }
7660
+ });
7661
+ unpackedDictArgType = typeArgs[1];
7612
7662
  }
7613
7663
  else {
7614
7664
  isValidMappingType = true;
7615
- unpackedDictionaryArgType = types_1.UnknownType.create();
7665
+ unpackedDictArgType = types_1.UnknownType.create();
7616
7666
  }
7617
7667
  }
7618
- if (paramDetails.kwargsIndex !== undefined && unpackedDictionaryArgType) {
7668
+ if (paramDetails.kwargsIndex !== undefined && unpackedDictArgType) {
7619
7669
  const paramType = paramDetails.params[paramDetails.kwargsIndex].type;
7620
7670
  validateArgTypeParams.push({
7621
7671
  paramCategory: 0 /* ParamCategory.Simple */,
7622
7672
  paramType,
7623
7673
  requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
7624
- argType: unpackedDictionaryArgType,
7674
+ argType: unpackedDictArgType,
7625
7675
  argument: argList[argIndex],
7626
7676
  errorNode: argList[argIndex].valueExpression || errorNode,
7627
7677
  paramName: paramDetails.params[paramDetails.kwargsIndex].param.name,
@@ -7748,7 +7798,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7748
7798
  }
7749
7799
  // If there are keyword-only parameters that haven't been matched but we
7750
7800
  // have an unpacked dictionary arg, assume that it applies to them.
7751
- if (unpackedDictionaryArgType && (!foundUnpackedListArg || paramDetails.argsIndex !== undefined)) {
7801
+ if (unpackedDictArgType && (!foundUnpackedListArg || paramDetails.argsIndex !== undefined)) {
7752
7802
  // Don't consider any position-only parameters, since they cannot be matched to
7753
7803
  // **kwargs arguments. Consider parameters that are either positional or keyword
7754
7804
  // if there is no *args argument.
@@ -7761,19 +7811,21 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7761
7811
  paramMap.has(param.name) &&
7762
7812
  paramMap.get(param.name).argsReceived === 0) {
7763
7813
  const paramType = paramDetails.params[paramIndex].type;
7764
- validateArgTypeParams.push({
7765
- paramCategory: 0 /* ParamCategory.Simple */,
7766
- paramType,
7767
- requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
7768
- argument: {
7769
- argCategory: 0 /* ArgCategory.Simple */,
7770
- typeResult: { type: unpackedDictionaryArgType },
7771
- },
7772
- errorNode: (_b = (_a = argList.find((arg) => arg.argCategory === 2 /* ArgCategory.UnpackedDictionary */)) === null || _a === void 0 ? void 0 : _a.valueExpression) !== null && _b !== void 0 ? _b : errorNode,
7773
- paramName: param.name,
7774
- isParamNameSynthesized: types_1.FunctionParam.isNameSynthesized(param),
7775
- });
7776
- paramMap.get(param.name).argsReceived = 1;
7814
+ if (!unpackedDictKeyNames || unpackedDictKeyNames.includes(param.name)) {
7815
+ validateArgTypeParams.push({
7816
+ paramCategory: 0 /* ParamCategory.Simple */,
7817
+ paramType,
7818
+ requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
7819
+ argument: {
7820
+ argCategory: 0 /* ArgCategory.Simple */,
7821
+ typeResult: { type: unpackedDictArgType },
7822
+ },
7823
+ errorNode: (_b = (_a = argList.find((arg) => arg.argCategory === 2 /* ArgCategory.UnpackedDictionary */)) === null || _a === void 0 ? void 0 : _a.valueExpression) !== null && _b !== void 0 ? _b : errorNode,
7824
+ paramName: param.name,
7825
+ isParamNameSynthesized: types_1.FunctionParam.isNameSynthesized(param),
7826
+ });
7827
+ paramMap.get(param.name).argsReceived = 1;
7828
+ }
7777
7829
  }
7778
7830
  });
7779
7831
  }
@@ -7781,7 +7833,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7781
7833
  // but have not yet received them. If we received a dictionary argument
7782
7834
  // (i.e. an arg starting with a "**"), we will assume that all parameters
7783
7835
  // are matched.
7784
- if (!unpackedDictionaryArgType && !types_1.FunctionType.isDefaultParamCheckDisabled(overload)) {
7836
+ if (!unpackedDictArgType && !types_1.FunctionType.isDefaultParamCheckDisabled(overload)) {
7785
7837
  const unassignedParams = Array.from(paramMap.keys()).filter((name) => {
7786
7838
  const entry = paramMap.get(name);
7787
7839
  return !entry || entry.argsReceived < entry.argsNeeded;
@@ -7933,7 +7985,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7933
7985
  let expectedType = inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.expectedType;
7934
7986
  // Can we safely ignore the inference context, either because it's not provided
7935
7987
  // or will have no effect? If so, avoid the extra work.
7936
- const returnType = (_a = inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnTypeOverride) !== null && _a !== void 0 ? _a : getFunctionEffectiveReturnType(type);
7988
+ const returnType = (_a = inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnTypeOverride) !== null && _a !== void 0 ? _a : getEffectiveReturnType(type);
7937
7989
  if (!returnType || !(0, typeUtils_1.requiresSpecialization)(returnType)) {
7938
7990
  expectedType = undefined;
7939
7991
  }
@@ -7950,8 +8002,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
7950
8002
  : callResult.returnType;
7951
8003
  if (assignType(expectedSubtype, returnType,
7952
8004
  /* diag */ undefined,
7953
- /* destConstraints */ undefined,
7954
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
8005
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
7955
8006
  const anyOrUnknown = (0, typeUtils_1.containsAnyOrUnknown)(callResult.returnType, /* recurse */ true);
7956
8007
  // Prefer return types that have no unknown or Any.
7957
8008
  if (!anyOrUnknown) {
@@ -8003,7 +8054,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8003
8054
  }
8004
8055
  function validateArgTypesWithExpectedType(errorNode, matchResults, constraints, skipUnknownArgCheck = false, expectedType, returnType) {
8005
8056
  const liveTypeVarScopes = ParseTreeUtils.getTypeVarScopesForNode(errorNode);
8006
- let assignFlags = 2048 /* AssignTypeFlags.PopulatingExpectedType */;
8057
+ let assignFlags = 2048 /* AssignTypeFlags.PopulateExpectedType */;
8007
8058
  if ((0, typeUtils_1.containsLiteralType)(expectedType, /* includeTypeArgs */ true)) {
8008
8059
  assignFlags |= 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */;
8009
8060
  }
@@ -8026,9 +8077,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8026
8077
  }
8027
8078
  }
8028
8079
  expectedType = (0, typeUtils_1.transformExpectedType)(expectedType, liveTypeVarScopes, errorNode.start);
8029
- assignType(returnType, expectedType,
8030
- /* diag */ undefined, constraints,
8031
- /* srcConstraints */ undefined, assignFlags);
8080
+ assignType(returnType, expectedType, /* diag */ undefined, constraints, assignFlags);
8032
8081
  return validateArgTypes(errorNode, matchResults, constraints, skipUnknownArgCheck);
8033
8082
  }
8034
8083
  function validateArgTypes(errorNode, matchResults, constraints, skipUnknownArgCheck) {
@@ -8072,38 +8121,28 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8072
8121
  }
8073
8122
  // Special-case a few built-in calls that are often used for
8074
8123
  // casting or checking for unknown types.
8075
- if (types_1.FunctionType.isBuiltIn(type, ['cast', 'isinstance', 'issubclass'])) {
8124
+ if (types_1.FunctionType.isBuiltIn(type, [
8125
+ 'typing.cast',
8126
+ 'typing_extensions.cast',
8127
+ 'builtins.isinstance',
8128
+ 'builtins.issubclass',
8129
+ ])) {
8076
8130
  skipUnknownArgCheck = true;
8077
8131
  }
8078
8132
  // Run through all args and validate them against their matched parameter.
8079
- // We'll do two passes. The first one will match any type arguments. The second
8080
- // will perform the actual validation. We can skip the first pass if there
8081
- // are no type vars to match.
8082
- const typeVarMatchingCount = matchResults.argParams.filter((arg) => arg.requiresTypeVarMatching).length;
8083
- if (typeVarMatchingCount > 0) {
8084
- // In theory, we may need to do up to n passes where n is the number of
8085
- // arguments that need type var matching. That's because later matches
8086
- // can provide bidirectional type hints for earlier matches. The best
8087
- // example of this is the built-in "map" method whose first parameter is
8088
- // a lambda and second parameter indicates what type the lambda should accept.
8089
- // In practice, we will limit the number of passes to 2 because it can get
8090
- // very expensive to go beyond this, and we don't generally see cases
8091
- // where more than two passes are needed.
8092
- let passCount = Math.min(typeVarMatchingCount, 2);
8133
+ // We'll do two phases. The first one establishes constraints for type
8134
+ // variables. The second perform type validation using the solved
8135
+ // types. We can skip the first pass if there are no type vars to solve.
8136
+ const typeVarCount = matchResults.argParams.filter((arg) => arg.requiresTypeVarMatching).length;
8137
+ if (typeVarCount > 0) {
8138
+ // Do up to two passes.
8139
+ let passCount = Math.min(typeVarCount, 2);
8093
8140
  for (let i = 0; i < passCount; i++) {
8094
8141
  useSpeculativeMode(speculativeNode, () => {
8095
8142
  matchResults.argParams.forEach((argParam) => {
8096
8143
  if (!argParam.requiresTypeVarMatching) {
8097
8144
  return;
8098
8145
  }
8099
- // Populate the constraints for the argument. If the argument
8100
- // is an overload function, skip it during the first pass
8101
- // because the selection of the proper overload may depend
8102
- // on type arguments supplied by other function arguments.
8103
- // If the param type is a "bare" TypeVar, don't use it as an
8104
- // expected type during the first pass. This causes problems for
8105
- // cases where the the call expression result can influence the
8106
- // type of the TypeVar, such as in the expression "min(1, max(2, 0.5))".
8107
8146
  const argResult = validateArgType(argParam, constraints, { type, isIncomplete: matchResults.isTypeIncomplete }, {
8108
8147
  skipUnknownArgCheck,
8109
8148
  isArgFirstPass: passCount > 1 && i === 0,
@@ -8113,9 +8152,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8113
8152
  if (argResult.isTypeIncomplete) {
8114
8153
  isTypeIncomplete = true;
8115
8154
  }
8116
- // If we skipped an overload arg or a bare type var during the first pass,
8117
- // add another pass to ensure that we handle all of the type variables.
8118
- if (i === 0 && (argResult.skippedOverloadArg || argResult.skippedBareTypeVarExpectedType)) {
8155
+ // If we skipped a bare type var during the first pass, add
8156
+ // another pass to ensure that we handle all of the type variables.
8157
+ if (i === 0 && passCount < 2 && argResult.skippedBareTypeVarExpectedType) {
8119
8158
  passCount++;
8120
8159
  }
8121
8160
  });
@@ -8187,7 +8226,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8187
8226
  }
8188
8227
  }
8189
8228
  // Calculate the return type.
8190
- let returnType = getFunctionEffectiveReturnType(type, { args: matchResults.argParams, errorNode });
8229
+ let returnType = getEffectiveReturnType(type, {
8230
+ callSiteInfo: { args: matchResults.argParams, errorNode },
8231
+ });
8191
8232
  if (condition.length > 0) {
8192
8233
  returnType = types_1.TypeBase.cloneForCondition(returnType, condition);
8193
8234
  }
@@ -8195,7 +8236,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8195
8236
  // If the function is returning a callable, don't eliminate unsolved
8196
8237
  // type vars within a union. There are legit uses for unsolved type vars
8197
8238
  // within a callable.
8198
- if ((0, types_1.isFunction)(returnType) || (0, types_1.isOverloadedFunction)(returnType)) {
8239
+ if ((0, types_1.isFunction)(returnType) || (0, types_1.isOverloaded)(returnType)) {
8199
8240
  eliminateUnsolvedInUnions = false;
8200
8241
  }
8201
8242
  let specializedReturnType = solveAndApplyConstraints(returnType, constraints, {
@@ -8205,7 +8246,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8205
8246
  tupleClassType: getTupleClassType(),
8206
8247
  eliminateUnsolvedInUnions,
8207
8248
  },
8208
- }, { applyUnificationVars: true });
8249
+ });
8209
8250
  specializedReturnType = (0, typeUtils_1.addConditionToType)(specializedReturnType, typeCondition);
8210
8251
  // If the function includes a ParamSpec and the captured signature(s) includes
8211
8252
  // generic types, we may need to apply those solved TypeVars.
@@ -8216,7 +8257,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8216
8257
  // It's possible that one or more of the TypeVars or ParamSpecs
8217
8258
  // in the constraints refer to TypeVars that were solved in
8218
8259
  // the paramSpecConstraints. Apply these solved TypeVars accordingly.
8219
- (0, typeUtils_1.applySourceContextTypeVars)(constraints, (0, constraintSolver_1.solveConstraints)(evaluatorInterface, paramSpecConstraints));
8260
+ (0, constraintSolver_1.applySourceSolutionToConstraints)(constraints, (0, constraintSolver_1.solveConstraints)(evaluatorInterface, paramSpecConstraints));
8220
8261
  }
8221
8262
  });
8222
8263
  }
@@ -8274,18 +8315,19 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8274
8315
  // need to make this more sophisticated in the future.
8275
8316
  function adjustCallableReturnType(callableType, returnType, liveTypeVarScopes) {
8276
8317
  var _a, _b;
8277
- if ((0, types_1.isFunction)(returnType) && !returnType.shared.name && callableType.shared.typeVarScopeId) {
8278
- // What type variables are referenced in the callable return type? Do not include any live type variables.
8279
- const newTypeParams = (0, typeUtils_1.getTypeVarArgsRecursive)(returnType).filter((t) => !liveTypeVarScopes.some((scopeId) => t.priv.scopeId === scopeId));
8280
- // If there are no unsolved type variables, we're done. If there are
8281
- // unsolved type variables, treat them as though they are rescoped
8282
- // to the callable.
8283
- if (newTypeParams.length > 0) {
8284
- const newScopeId = (_b = (_a = newTypeParams[0].priv.freeTypeVar) === null || _a === void 0 ? void 0 : _a.priv.scopeId) !== null && _b !== void 0 ? _b : newTypeParams[0].priv.scopeId;
8285
- return types_1.FunctionType.cloneWithNewTypeVarScopeId(returnType, newScopeId, callableType.priv.constructorTypeVarScopeId, newTypeParams);
8286
- }
8318
+ if (!(0, types_1.isFunction)(returnType) || returnType.shared.name || !callableType.shared.typeVarScopeId) {
8319
+ return returnType;
8287
8320
  }
8288
- return returnType;
8321
+ // What type variables are referenced in the callable return type? Do not include any live type variables.
8322
+ const newTypeParams = (0, typeUtils_1.getTypeVarArgsRecursive)(returnType).filter((t) => !liveTypeVarScopes.some((scopeId) => t.priv.scopeId === scopeId));
8323
+ // If there are no unsolved type variables, we're done. If there are
8324
+ // unsolved type variables, treat them as though they are rescoped
8325
+ // to the callable.
8326
+ if (newTypeParams.length === 0) {
8327
+ return returnType;
8328
+ }
8329
+ const newScopeId = (_b = (_a = newTypeParams[0].priv.freeTypeVar) === null || _a === void 0 ? void 0 : _a.priv.scopeId) !== null && _b !== void 0 ? _b : newTypeParams[0].priv.scopeId;
8330
+ return types_1.FunctionType.cloneWithNewTypeVarScopeId(returnType, newScopeId, callableType.priv.constructorTypeVarScopeId, newTypeParams);
8289
8331
  }
8290
8332
  // Tries to assign the call arguments to the function parameter
8291
8333
  // list and reports any mismatches in types or counts. Returns the
@@ -8344,7 +8386,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8344
8386
  paramSpecType = (0, typeUtils_1.convertTypeToParamSpecValue)(paramSpecType !== null && paramSpecType !== void 0 ? paramSpecType : paramSpec);
8345
8387
  const matchResults = matchArgsToParams(errorNode, argList, { type: paramSpecType }, 0);
8346
8388
  const functionType = matchResults.overload;
8347
- const srcConstraints = new constraintTracker_1.ConstraintTracker();
8389
+ const constraints = new constraintTracker_1.ConstraintTracker();
8348
8390
  if (matchResults.argumentErrors) {
8349
8391
  // Evaluate types of all args. This will ensure that referenced symbols are
8350
8392
  // not reported as unaccessed.
@@ -8353,7 +8395,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8353
8395
  getTypeOfExpression(arg.valueExpression);
8354
8396
  }
8355
8397
  });
8356
- return { argumentErrors: true, constraintTrackers: [srcConstraints] };
8398
+ return { argumentErrors: true, constraintTrackers: [constraints] };
8357
8399
  }
8358
8400
  const functionParamSpec = types_1.FunctionType.getParamSpecFromArgsKwargs(functionType);
8359
8401
  const functionWithoutParamSpec = types_1.FunctionType.cloneRemoveParamSpecArgsKwargs(functionType);
@@ -8393,10 +8435,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8393
8435
  type: printType(functionParamSpec),
8394
8436
  }), argErrorNode !== null && argErrorNode !== void 0 ? argErrorNode : errorNode);
8395
8437
  }
8396
- return { argumentErrors, constraintTrackers: [srcConstraints] };
8438
+ return { argumentErrors, constraintTrackers: [constraints] };
8397
8439
  }
8398
- const result = validateArgTypes(errorNode, matchResults, srcConstraints, /* skipUnknownArgCheck */ undefined);
8399
- return { argumentErrors: !!result.argumentErrors, constraintTrackers: [srcConstraints] };
8440
+ const result = validateArgTypes(errorNode, matchResults, constraints, /* skipUnknownArgCheck */ undefined);
8441
+ return { argumentErrors: !!result.argumentErrors, constraintTrackers: [constraints] };
8400
8442
  }
8401
8443
  function validateArgType(argParam, constraints, typeResult, options) {
8402
8444
  var _a, _b;
@@ -8458,8 +8500,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8458
8500
  // values to any unification variables.
8459
8501
  const clonedConstraints = constraints.clone();
8460
8502
  if (assignType(expectedType, argType,
8461
- /* diag */ undefined, clonedConstraints,
8462
- /* srcConstraints */ undefined, (options === null || options === void 0 ? void 0 : options.isArgFirstPass) ? 8 /* AssignTypeFlags.ArgAssignmentFirstPass */ : 0 /* AssignTypeFlags.Default */)) {
8503
+ /* diag */ undefined, clonedConstraints, (options === null || options === void 0 ? void 0 : options.isArgFirstPass) ? 8 /* AssignTypeFlags.ArgAssignmentFirstPass */ : 0 /* AssignTypeFlags.Default */)) {
8463
8504
  constraints.copyFromClone(clonedConstraints);
8464
8505
  }
8465
8506
  else {
@@ -8525,8 +8566,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8525
8566
  if (options === null || options === void 0 ? void 0 : options.isArgFirstPass) {
8526
8567
  assignTypeFlags |= 8 /* AssignTypeFlags.ArgAssignmentFirstPass */;
8527
8568
  }
8528
- if (!assignType(argParam.paramType, argType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints,
8529
- /* srcConstraints */ undefined, assignTypeFlags)) {
8569
+ if (!assignType(argParam.paramType, argType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, assignTypeFlags)) {
8530
8570
  if (!(options === null || options === void 0 ? void 0 : options.skipReportError)) {
8531
8571
  // Mismatching parameter types are common in untyped code; don't bother spending time
8532
8572
  // printing types if the diagnostic is disabled.
@@ -9583,8 +9623,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
9583
9623
  const mappingConstraints = new constraintTracker_1.ConstraintTracker();
9584
9624
  supportsKeysAndGetItemClass = (0, typeUtils_1.selfSpecializeClass)(supportsKeysAndGetItemClass);
9585
9625
  if (assignType(types_1.ClassType.cloneAsInstance(supportsKeysAndGetItemClass), unexpandedType,
9586
- /* diag */ undefined, mappingConstraints,
9587
- /* srcConstraints */ undefined, 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */)) {
9626
+ /* diag */ undefined, mappingConstraints, 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */)) {
9588
9627
  const specializedMapping = solveAndApplyConstraints(supportsKeysAndGetItemClass, mappingConstraints);
9589
9628
  const typeArgs = specializedMapping.priv.typeArgs;
9590
9629
  if (typeArgs && typeArgs.length >= 2) {
@@ -9851,7 +9890,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
9851
9890
  scopeIds: [],
9852
9891
  tupleClassType: getTupleClassType(),
9853
9892
  },
9854
- }, { applyUnificationVars: true }), (subtype) => {
9893
+ }), (subtype) => {
9855
9894
  if (entryTypes.length !== 1) {
9856
9895
  return subtype;
9857
9896
  }
@@ -9961,7 +10000,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
9961
10000
  const liveTypeVarScopes = ParseTreeUtils.getTypeVarScopesForNode(node);
9962
10001
  expectedType = (0, typeUtils_1.transformExpectedType)(expectedType, liveTypeVarScopes, node.start);
9963
10002
  expectedParamDetails = (0, parameterUtils_1.getParamListDetails)(expectedType);
9964
- expectedReturnType = getFunctionEffectiveReturnType(expectedType);
10003
+ expectedReturnType = getEffectiveReturnType(expectedType);
9965
10004
  }
9966
10005
  let functionType = types_1.FunctionType.createInstance('', '', '', 131072 /* FunctionTypeFlags.PartiallyEvaluated */);
9967
10006
  functionType.shared.typeVarScopeId = ParseTreeUtils.getScopeIdForNode(node);
@@ -10072,7 +10111,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
10072
10111
  scopeIds: [],
10073
10112
  tupleClassType: getTupleClassType(),
10074
10113
  },
10075
- }, { applyUnificationVars: true });
10114
+ });
10076
10115
  }
10077
10116
  }
10078
10117
  }
@@ -10510,7 +10549,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
10510
10549
  }
10511
10550
  }
10512
10551
  if (!type) {
10513
- const exprType = getTypeOfExpression(itemExpr, (flags & 4 /* EvalFlags.ForwardRefs */) | 33554432 /* EvalFlags.NoConvertSpecialForm */ | 256 /* EvalFlags.TypeExpression */);
10552
+ const exprType = getTypeOfExpression(itemExpr, (flags & (4 /* EvalFlags.ForwardRefs */ | 256 /* EvalFlags.TypeExpression */)) | 33554432 /* EvalFlags.NoConvertSpecialForm */);
10514
10553
  // Is this an enum type?
10515
10554
  if ((0, types_1.isClassInstance)(exprType.type) &&
10516
10555
  types_1.ClassType.isEnumClass(exprType.type) &&
@@ -10533,8 +10572,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
10533
10572
  }
10534
10573
  }
10535
10574
  if (!type) {
10536
- addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.literalUnsupportedType(), item);
10537
- type = types_1.UnknownType.create();
10575
+ if ((flags & 256 /* EvalFlags.TypeExpression */) !== 0) {
10576
+ addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.literalUnsupportedType(), item);
10577
+ type = types_1.UnknownType.create();
10578
+ }
10579
+ else {
10580
+ return types_1.ClassType.cloneAsInstance(classType);
10581
+ }
10538
10582
  }
10539
10583
  literalTypes.push(type);
10540
10584
  }
@@ -11534,7 +11578,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
11534
11578
  function createSubclass(errorNode, type1, type2) {
11535
11579
  var _a, _b;
11536
11580
  (0, debug_1.assert)((0, types_1.isInstantiableClass)(type1) && (0, types_1.isInstantiableClass)(type2));
11537
- const className = `<subclass of ${type1.shared.name} and ${type2.shared.name}>`;
11581
+ const className = `<subclass of ${printType((0, typeUtils_1.convertToInstance)(type1), {
11582
+ omitTypeArgsIfUnknown: true,
11583
+ })} and ${printType((0, typeUtils_1.convertToInstance)(type2), { omitTypeArgsIfUnknown: true })}>`;
11538
11584
  const fileInfo = AnalyzerNodeInfo.getFileInfo(errorNode);
11539
11585
  // The effective metaclass of the intersection is the narrower of the two metaclasses.
11540
11586
  let effectiveMetaclass = type1.shared.effectiveMetaclass;
@@ -11613,6 +11659,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
11613
11659
  classType.shared.flags |= 8192 /* ClassTypeFlags.PartiallyEvaluated */;
11614
11660
  classType.shared.declaration = classDecl;
11615
11661
  return (0, cancellationUtils_1.invalidateTypeCacheIfCanceled)(() => {
11662
+ var _a;
11616
11663
  writeTypeCache(node, { type: classType }, /* flags */ undefined);
11617
11664
  writeTypeCache(node.d.name, { type: classType }, /* flags */ undefined);
11618
11665
  // Keep a list of unique type parameters that are used in the
@@ -12001,7 +12048,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
12001
12048
  let foundUnknown = false;
12002
12049
  for (let i = node.d.decorators.length - 1; i >= 0; i--) {
12003
12050
  const decorator = node.d.decorators[i];
12004
- const newDecoratedType = (0, decorators_1.applyClassDecorator)(evaluatorInterface, decoratedType, classType, decorator);
12051
+ const newDecoratedType = useSignatureTracker((_a = node.parent) !== null && _a !== void 0 ? _a : node, () => (0, decorators_1.applyClassDecorator)(evaluatorInterface, decoratedType, classType, decorator));
12005
12052
  const unknownOrAny = (0, typeUtils_1.containsAnyOrUnknown)(newDecoratedType, /* recurse */ false);
12006
12053
  if (unknownOrAny && (0, types_1.isUnknown)(unknownOrAny)) {
12007
12054
  // Report this error only on the first unknown type.
@@ -12448,8 +12495,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
12448
12495
  /* skipUnknownArgCheck */ false, (0, typeUtils_1.makeInferenceContext)(getNoneType()));
12449
12496
  if (callResult.argumentErrors) {
12450
12497
  const diag = addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.initSubclassCallFailed(), node.d.name);
12451
- const initSubclassFunction = (0, types_1.isOverloadedFunction)(initSubclassMethodType)
12452
- ? types_1.OverloadedFunctionType.getOverloads(initSubclassMethodType)[0]
12498
+ const initSubclassFunction = (0, types_1.isOverloaded)(initSubclassMethodType)
12499
+ ? types_1.OverloadedType.getOverloads(initSubclassMethodType)[0]
12453
12500
  : initSubclassMethodType;
12454
12501
  const initSubclassDecl = (0, types_1.isFunction)(initSubclassFunction)
12455
12502
  ? initSubclassFunction.shared.declaration
@@ -12471,6 +12518,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
12471
12518
  });
12472
12519
  }
12473
12520
  function getTypeOfFunction(node) {
12521
+ var _a;
12474
12522
  initializePrefetchedTypes(node);
12475
12523
  // Is this predecorated function type cached?
12476
12524
  let functionType = readTypeCache(node.d.name, 0 /* EvalFlags.None */);
@@ -12504,7 +12552,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
12504
12552
  let foundUnknown = false;
12505
12553
  for (let i = node.d.decorators.length - 1; i >= 0; i--) {
12506
12554
  const decorator = node.d.decorators[i];
12507
- const newDecoratedType = (0, decorators_1.applyFunctionDecorator)(evaluatorInterface, decoratedType, functionType, decorator, node);
12555
+ const newDecoratedType = useSignatureTracker((_a = node.parent) !== null && _a !== void 0 ? _a : node, () => {
12556
+ (0, debug_1.assert)(decoratedType !== undefined);
12557
+ return (0, decorators_1.applyFunctionDecorator)(evaluatorInterface, decoratedType, functionType, decorator, node);
12558
+ });
12508
12559
  const unknownOrAny = (0, typeUtils_1.containsAnyOrUnknown)(newDecoratedType, /* recurse */ false);
12509
12560
  if (unknownOrAny && (0, types_1.isUnknown)(unknownOrAny)) {
12510
12561
  // Report this error only on the first unknown type.
@@ -12527,8 +12578,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
12527
12578
  markParamAccessed(param);
12528
12579
  });
12529
12580
  }
12530
- decoratedType = (0, decorators_1.addOverloadsToFunctionType)(evaluatorInterface, node, decoratedType);
12531
12581
  }
12582
+ decoratedType = (0, decorators_1.addOverloadsToFunctionType)(evaluatorInterface, node, decoratedType);
12532
12583
  writeTypeCache(node, { type: decoratedType }, 0 /* EvalFlags.None */);
12533
12584
  return { functionType, decoratedType };
12534
12585
  }
@@ -12976,7 +13027,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
12976
13027
  }
12977
13028
  else {
12978
13029
  let skipInference = false;
12979
- if ((0, types_1.isFunction)(defaultValueType) || (0, types_1.isOverloadedFunction)(defaultValueType)) {
13030
+ if ((0, types_1.isFunction)(defaultValueType) || (0, types_1.isOverloaded)(defaultValueType)) {
12980
13031
  // Do not infer parameter types that use a lambda or another function as a
12981
13032
  // default value. We're likely to generate false positives in this case.
12982
13033
  // It's not clear whether parameters should be positional-only or not.
@@ -13486,7 +13537,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
13486
13537
  if (getAttrSymbol) {
13487
13538
  const getAttrType = getEffectiveTypeOfSymbol(getAttrSymbol);
13488
13539
  if ((0, types_1.isFunction)(getAttrType)) {
13489
- symbolType = getFunctionEffectiveReturnType(getAttrType);
13540
+ symbolType = getEffectiveReturnType(getAttrType);
13490
13541
  reportError = false;
13491
13542
  }
13492
13543
  }
@@ -13927,7 +13978,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
13927
13978
  if (parent.d.expr) {
13928
13979
  const enclosingFunctionNode = ParseTreeUtils.getEnclosingFunction(node);
13929
13980
  let declaredReturnType = enclosingFunctionNode
13930
- ? getFunctionDeclaredReturnType(enclosingFunctionNode)
13981
+ ? getDeclaredReturnType(enclosingFunctionNode)
13931
13982
  : undefined;
13932
13983
  if (declaredReturnType) {
13933
13984
  const liveScopeIds = ParseTreeUtils.getTypeVarScopesForNode(node);
@@ -14317,7 +14368,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
14317
14368
  if (types_1.ClassType.isBuiltIn(classType, 'type') && typeArgs) {
14318
14369
  if (typeArgs.length >= 1) {
14319
14370
  // Treat type[function] as illegal.
14320
- if ((0, types_1.isFunction)(typeArgs[0].type) || (0, types_1.isOverloadedFunction)(typeArgs[0].type)) {
14371
+ if ((0, types_1.isFunction)(typeArgs[0].type) || (0, types_1.isOverloaded)(typeArgs[0].type)) {
14321
14372
  addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.typeAnnotationWithCallable(), typeArgs[0].node);
14322
14373
  return { type: types_1.UnknownType.create() };
14323
14374
  }
@@ -14801,7 +14852,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
14801
14852
  if (!tracker) {
14802
14853
  return type;
14803
14854
  }
14804
- if ((0, types_1.isFunction)(type) || (0, types_1.isOverloadedFunction)(type)) {
14855
+ if ((0, types_1.isFunction)(type) || (0, types_1.isOverloaded)(type)) {
14805
14856
  return (0, typeUtils_1.ensureSignaturesAreUnique)(type, tracker, node.start);
14806
14857
  }
14807
14858
  return type;
@@ -15020,8 +15071,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
15020
15071
  declarations.push(paramDecl);
15021
15072
  }
15022
15073
  }
15023
- else if ((0, types_1.isOverloadedFunction)(baseType)) {
15024
- baseType.priv.overloads.forEach((f) => {
15074
+ else if ((0, types_1.isOverloaded)(baseType)) {
15075
+ types_1.OverloadedType.getOverloads(baseType).forEach((f) => {
15025
15076
  const paramDecl = getDeclarationFromKeywordParam(f, paramName);
15026
15077
  if (paramDecl) {
15027
15078
  declarations.push(paramDecl);
@@ -15905,32 +15956,33 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
15905
15956
  }
15906
15957
  function inferReturnTypeIfNecessary(type) {
15907
15958
  if ((0, types_1.isFunction)(type)) {
15908
- getFunctionEffectiveReturnType(type);
15959
+ getEffectiveReturnType(type);
15909
15960
  }
15910
- else if ((0, types_1.isOverloadedFunction)(type)) {
15911
- type.priv.overloads.forEach((overload) => {
15912
- getFunctionEffectiveReturnType(overload);
15961
+ else if ((0, types_1.isOverloaded)(type)) {
15962
+ types_1.OverloadedType.getOverloads(type).forEach((overload) => {
15963
+ getEffectiveReturnType(overload);
15913
15964
  });
15965
+ const impl = types_1.OverloadedType.getImplementation(type);
15966
+ if (impl && (0, types_1.isFunction)(impl)) {
15967
+ getEffectiveReturnType(impl);
15968
+ }
15914
15969
  }
15915
15970
  }
15916
15971
  // Returns the return type of the function. If the type is explicitly provided in
15917
15972
  // a type annotation, that type is returned. If not, an attempt is made to infer
15918
15973
  // the return type. If a list of args is provided, the inference logic may take
15919
15974
  // into account argument types to infer the return type.
15920
- function getFunctionEffectiveReturnType(type, callSiteInfo, inferTypeIfNeeded = true) {
15975
+ function getEffectiveReturnType(type, options) {
15921
15976
  const specializedReturnType = types_1.FunctionType.getEffectiveReturnType(type, /* includeInferred */ false);
15922
15977
  if (specializedReturnType && !(0, types_1.isUnknown)(specializedReturnType)) {
15923
- const liveTypeVarScopes = (callSiteInfo === null || callSiteInfo === void 0 ? void 0 : callSiteInfo.errorNode)
15924
- ? ParseTreeUtils.getTypeVarScopesForNode(callSiteInfo === null || callSiteInfo === void 0 ? void 0 : callSiteInfo.errorNode)
15925
- : [];
15926
- return adjustCallableReturnType(type, specializedReturnType, liveTypeVarScopes);
15978
+ return specializedReturnType;
15927
15979
  }
15928
- if (inferTypeIfNeeded) {
15929
- return getFunctionInferredReturnType(type, callSiteInfo);
15980
+ if (!(options === null || options === void 0 ? void 0 : options.skipInferReturnType)) {
15981
+ return getFunctionInferredReturnType(type, options === null || options === void 0 ? void 0 : options.callSiteInfo);
15930
15982
  }
15931
15983
  return types_1.UnknownType.create();
15932
15984
  }
15933
- function _getFunctionInferredReturnType(type, callSiteInfo) {
15985
+ function _getInferredReturnType(type, callSiteInfo) {
15934
15986
  var _a, _b, _c;
15935
15987
  let returnType;
15936
15988
  let isIncomplete = false;
@@ -16026,7 +16078,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16026
16078
  // We can't use this technique if decorators or async are used because they
16027
16079
  // would need to be applied to the inferred return type.
16028
16080
  if (!hasDecorators && !isAsync) {
16029
- const contextualReturnType = getFunctionInferredReturnTypeUsingArgs(type, callSiteInfo);
16081
+ const contextualReturnType = inferReturnTypeForCallSite(type, callSiteInfo);
16030
16082
  if (contextualReturnType) {
16031
16083
  returnType = contextualReturnType;
16032
16084
  if ((_c = type.shared.declaration) === null || _c === void 0 ? void 0 : _c.node) {
@@ -16039,7 +16091,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16039
16091
  }
16040
16092
  return returnType;
16041
16093
  }
16042
- function getFunctionInferredReturnTypeUsingArgs(type, callSiteInfo) {
16094
+ function inferReturnTypeForCallSite(type, callSiteInfo) {
16043
16095
  const args = callSiteInfo.args;
16044
16096
  let contextualReturnType;
16045
16097
  if (!type.shared.declaration) {
@@ -16180,7 +16232,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16180
16232
  // If the function has an explicitly-declared return type, it is returned
16181
16233
  // unaltered unless the function is a generator, in which case it is
16182
16234
  // modified to return only the return type for the generator.
16183
- function getFunctionDeclaredReturnType(node) {
16235
+ function getDeclaredReturnType(node) {
16184
16236
  const functionTypeInfo = getTypeOfFunction(node);
16185
16237
  const returnType = functionTypeInfo === null || functionTypeInfo === void 0 ? void 0 : functionTypeInfo.functionType.shared.declaredReturnType;
16186
16238
  if (!returnType) {
@@ -16230,7 +16282,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16230
16282
  (0, typeUtils_1.requiresSpecialization)(typeResult.type, { ignoreSelf: true, ignoreImplicitTypeArgs: true })) {
16231
16283
  const specializedType = (0, typeUtils_1.partiallySpecializeType)(typeResult.type, member.unspecializedClassType, getTypeClassType(), (0, typeUtils_1.selfSpecializeClass)(selfClass, { overrideTypeArgs: true }));
16232
16284
  if ((0, types_1.findSubtype)(specializedType, (subtype) => !(0, types_1.isFunction)(subtype) &&
16233
- !(0, types_1.isOverloadedFunction)(subtype) &&
16285
+ !(0, types_1.isOverloaded)(subtype) &&
16234
16286
  (0, typeUtils_1.requiresSpecialization)(subtype, { ignoreSelf: true, ignoreImplicitTypeArgs: true }))) {
16235
16287
  addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.genericInstanceVariableAccess(), errorNode);
16236
16288
  }
@@ -16240,7 +16292,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16240
16292
  isIncomplete: !!typeResult.isIncomplete,
16241
16293
  };
16242
16294
  }
16243
- function assignClass(destType, srcType, diag, destConstraints, srcConstraints, flags, recursionCount, reportErrorsUsingObjType) {
16295
+ function assignClass(destType, srcType, diag, constraints, flags, recursionCount, reportErrorsUsingObjType) {
16244
16296
  // If the source or dest types are partially evaluated (i.e. they are in the
16245
16297
  // process of being constructed), assume they are assignable rather than risk
16246
16298
  // emitting false positives.
@@ -16251,7 +16303,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16251
16303
  // checking, as defined in PEP 589.
16252
16304
  if (types_1.ClassType.isTypedDictClass(srcType)) {
16253
16305
  if (types_1.ClassType.isTypedDictClass(destType) && !types_1.ClassType.isSameGenericClass(destType, srcType)) {
16254
- if (!(0, typedDicts_1.assignTypedDictToTypedDict)(evaluatorInterface, destType, srcType, diag, destConstraints, flags, recursionCount)) {
16306
+ if (!(0, typedDicts_1.assignTypedDictToTypedDict)(evaluatorInterface, destType, srcType, diag, constraints, flags, recursionCount)) {
16255
16307
  return false;
16256
16308
  }
16257
16309
  if (types_1.ClassType.isFinal(destType) !== types_1.ClassType.isFinal(srcType)) {
@@ -16262,7 +16314,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16262
16314
  return false;
16263
16315
  }
16264
16316
  // If invariance is being enforced, the two TypedDicts must be assignable to each other.
16265
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) !== 0) {
16317
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) !== 0) {
16266
16318
  return (0, typedDicts_1.assignTypedDictToTypedDict)(evaluatorInterface, srcType, destType,
16267
16319
  /* diag */ undefined,
16268
16320
  /* constraints */ undefined, flags, recursionCount);
@@ -16300,7 +16352,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16300
16352
  const promotionList = typePromotions.get(destType.shared.fullName);
16301
16353
  if (promotionList &&
16302
16354
  promotionList.some((srcName) => srcType.shared.mro.some((mroClass) => (0, types_1.isClass)(mroClass) && srcName === mroClass.shared.fullName))) {
16303
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0) {
16355
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) === 0) {
16304
16356
  return true;
16305
16357
  }
16306
16358
  }
@@ -16313,7 +16365,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16313
16365
  // derive from the source. We also need to use this path if we're
16314
16366
  // testing to see if the metaclass matches the protocol.
16315
16367
  if (types_1.ClassType.isProtocolClass(destType) && !isDerivedFrom) {
16316
- if (!(0, protocols_1.assignClassToProtocol)(evaluatorInterface, destType, types_1.ClassType.cloneAsInstance(srcType), diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
16368
+ if (!(0, protocols_1.assignClassToProtocol)(evaluatorInterface, destType, types_1.ClassType.cloneAsInstance(srcType), diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
16317
16369
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.protocolIncompatible().format({
16318
16370
  sourceType: printType((0, typeUtils_1.convertToInstance)(srcType)),
16319
16371
  destType: printType((0, typeUtils_1.convertToInstance)(destType)),
@@ -16326,20 +16378,20 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16326
16378
  // considered a subtype of `bool`.
16327
16379
  if ((0, types_1.isInstantiableClass)(srcType) && types_1.ClassType.isBuiltIn(srcType, ['TypeGuard', 'TypeIs'])) {
16328
16380
  if ((0, types_1.isInstantiableClass)(destType) && types_1.ClassType.isBuiltIn(destType, 'bool')) {
16329
- return (flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0;
16381
+ return (flags & 1 /* AssignTypeFlags.Invariant */) === 0;
16330
16382
  }
16331
16383
  }
16332
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0 || types_1.ClassType.isSameGenericClass(srcType, destType)) {
16384
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) === 0 || types_1.ClassType.isSameGenericClass(srcType, destType)) {
16333
16385
  if (isDerivedFrom) {
16334
16386
  (0, debug_1.assert)(inheritanceChain.length > 0);
16335
- if (assignClassWithTypeArgs(destType, srcType, inheritanceChain, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
16387
+ if (assignClassWithTypeArgs(destType, srcType, inheritanceChain, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
16336
16388
  return true;
16337
16389
  }
16338
16390
  }
16339
16391
  }
16340
16392
  // Everything is assignable to an object.
16341
16393
  if (types_1.ClassType.isBuiltIn(destType, 'object')) {
16342
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0) {
16394
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) === 0) {
16343
16395
  return true;
16344
16396
  }
16345
16397
  }
@@ -16421,13 +16473,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16421
16473
  // private or protected, since these are presumably
16422
16474
  // not modifiable outside of the class.
16423
16475
  if (!(0, symbolNameUtils_1.isPrivateOrProtectedName)(name)) {
16424
- flags |= 1 /* AssignTypeFlags.EnforceInvariance */;
16476
+ flags |= 1 /* AssignTypeFlags.Invariant */;
16425
16477
  }
16426
16478
  }
16427
16479
  if (!assignType(destMemberType, srcMemberType,
16428
16480
  /* diag */ undefined,
16429
- /* destConstraints */ undefined,
16430
- /* srcConstraints */ undefined, flags | 32768 /* AssignTypeFlags.SkipSelfClsParamCheck */, recursionCount)) {
16481
+ /* constraints */ undefined, flags | 32768 /* AssignTypeFlags.SkipSelfClsParamCheck */, recursionCount)) {
16431
16482
  isAssignable = false;
16432
16483
  }
16433
16484
  }
@@ -16482,12 +16533,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16482
16533
  }
16483
16534
  // Determines whether the specified type can be assigned to the
16484
16535
  // specified inheritance chain, taking into account its type arguments.
16485
- function assignClassWithTypeArgs(destType, srcType, inheritanceChain, diag, destConstraints, srcConstraints, flags, recursionCount) {
16536
+ function assignClassWithTypeArgs(destType, srcType, inheritanceChain, diag, constraints, flags, recursionCount) {
16486
16537
  let curSrcType = srcType;
16487
16538
  let prevSrcType;
16488
16539
  inferVarianceForClass(destType);
16489
16540
  // If we're enforcing invariance, literal types must match.
16490
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) !== 0) {
16541
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) !== 0) {
16491
16542
  const srcIsLiteral = srcType.priv.literalValue !== undefined;
16492
16543
  const destIsLiteral = destType.priv.literalValue !== undefined;
16493
16544
  if (srcIsLiteral !== destIsLiteral) {
@@ -16537,7 +16588,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16537
16588
  prevSrcType = curSrcType;
16538
16589
  }
16539
16590
  // If we're enforcing invariance, literal types must match as well.
16540
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) !== 0) {
16591
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) !== 0) {
16541
16592
  const srcIsLiteral = srcType.priv.literalValue !== undefined;
16542
16593
  const destIsLiteral = destType.priv.literalValue !== undefined;
16543
16594
  if (srcIsLiteral !== destIsLiteral) {
@@ -16546,7 +16597,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16546
16597
  }
16547
16598
  // Handle tuple, which supports a variable number of type arguments.
16548
16599
  if (destType.priv.tupleTypeArgs && curSrcType.priv.tupleTypeArgs) {
16549
- return (0, tuples_1.assignTupleTypeArgs)(evaluatorInterface, destType, curSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
16600
+ return (0, tuples_1.assignTupleTypeArgs)(evaluatorInterface, destType, curSrcType, diag, constraints, flags, recursionCount);
16550
16601
  }
16551
16602
  if (destType.priv.typeArgs) {
16552
16603
  // If the dest type is specialized, make sure the specialized source
@@ -16555,9 +16606,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16555
16606
  // Don't emit a diag addendum if we're in an invariant context. It's
16556
16607
  // sufficient to simply indicate that the types are not the same
16557
16608
  // in this case. Adding more information is unnecessary and confusing.
16558
- (flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0 ? diag : undefined, destConstraints, srcConstraints, flags, recursionCount);
16609
+ (flags & 1 /* AssignTypeFlags.Invariant */) === 0 ? diag : undefined, constraints, flags, recursionCount);
16559
16610
  }
16560
- if (destConstraints && curSrcType.priv.typeArgs && !destConstraints.isLocked()) {
16611
+ if (constraints && curSrcType.priv.typeArgs && !constraints.isLocked()) {
16561
16612
  // Populate the typeVar map with type arguments of the source.
16562
16613
  const srcTypeArgs = curSrcType.priv.typeArgs;
16563
16614
  for (let i = 0; i < destType.shared.typeParams.length; i++) {
@@ -16570,8 +16621,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16570
16621
  else {
16571
16622
  typeArgType = i < srcTypeArgs.length ? srcTypeArgs[i] : types_1.UnknownType.create();
16572
16623
  }
16573
- (0, constraintSolver_1.updateTypeVarType)(evaluatorInterface, destConstraints, typeParam, variance !== 4 /* Variance.Contravariant */ ? typeArgType : undefined, variance !== 3 /* Variance.Covariant */ ? typeArgType : undefined,
16574
- /* forceRetainLiterals */ true);
16624
+ constraints.setBounds(typeParam, variance !== 4 /* Variance.Contravariant */ ? typeArgType : undefined, variance !== 3 /* Variance.Covariant */ ? typeArgType : undefined,
16625
+ /* retainLiterals */ true);
16575
16626
  }
16576
16627
  }
16577
16628
  return true;
@@ -16581,12 +16632,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16581
16632
  return undefined;
16582
16633
  }
16583
16634
  if (propertyClass.priv.fgetInfo) {
16584
- return getFunctionEffectiveReturnType(propertyClass.priv.fgetInfo.methodType,
16585
- /* args */ undefined, inferTypeIfNeeded);
16635
+ return getEffectiveReturnType(propertyClass.priv.fgetInfo.methodType);
16586
16636
  }
16587
16637
  return undefined;
16588
16638
  }
16589
- function assignTypeArgs(destType, srcType, diag, destConstraints, srcConstraints, flags, recursionCount) {
16639
+ function assignTypeArgs(destType, srcType, diag, constraints, flags, recursionCount) {
16590
16640
  var _a, _b, _c;
16591
16641
  (0, debug_1.assert)(types_1.ClassType.isSameGenericClass(destType, srcType));
16592
16642
  inferVarianceForClass(destType);
@@ -16629,18 +16679,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16629
16679
  errorSource = localize_1.LocAddendum.typeVarIsCovariant;
16630
16680
  }
16631
16681
  else if (variance === 4 /* Variance.Contravariant */) {
16632
- effectiveFlags =
16633
- (flags ^ 2 /* AssignTypeFlags.ReverseTypeVarMatching */) | 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */;
16682
+ effectiveFlags = (flags ^ 2 /* AssignTypeFlags.Contravariant */) | 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */;
16634
16683
  errorSource = localize_1.LocAddendum.typeVarIsContravariant;
16635
16684
  }
16636
16685
  else {
16637
- effectiveFlags = flags | 1 /* AssignTypeFlags.EnforceInvariance */ | 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */;
16686
+ effectiveFlags = flags | 1 /* AssignTypeFlags.Invariant */ | 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */;
16638
16687
  errorSource = localize_1.LocAddendum.typeVarIsInvariant;
16639
16688
  // Omit the diagnostic addendum for the invariant case because it's obvious
16640
16689
  // why two types are not the same.
16641
16690
  includeDiagAddendum = false;
16642
16691
  }
16643
- if (!assignType(variance === 4 /* Variance.Contravariant */ ? srcTypeArg : destTypeArg, variance === 4 /* Variance.Contravariant */ ? destTypeArg : srcTypeArg, assignmentDiag, variance === 4 /* Variance.Contravariant */ ? srcConstraints : destConstraints, variance === 4 /* Variance.Contravariant */ ? destConstraints : srcConstraints, effectiveFlags, recursionCount)) {
16692
+ if (!assignType(variance === 4 /* Variance.Contravariant */ ? srcTypeArg : destTypeArg, variance === 4 /* Variance.Contravariant */ ? destTypeArg : srcTypeArg, assignmentDiag, constraints, effectiveFlags, recursionCount)) {
16644
16693
  // Don't report errors with type variables in "pseudo-random"
16645
16694
  // classes since these type variables are not real.
16646
16695
  if (!types_1.ClassType.isPseudoGenericClass(destType)) {
@@ -16682,7 +16731,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16682
16731
  // matched against existing type variables in the map. If a type variable
16683
16732
  // in the dest type is not in the type map already, it is assigned a type
16684
16733
  // and added to the map.
16685
- function assignType(destType, srcType, diag, destConstraints, srcConstraints, flags = 0 /* AssignTypeFlags.Default */, recursionCount = 0) {
16734
+ function assignType(destType, srcType, diag, constraints, flags = 0 /* AssignTypeFlags.Default */, recursionCount = 0) {
16686
16735
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16687
16736
  // Handle the case where the dest and src types are the same object.
16688
16737
  // We can normally shortcut this and say that they are compatible,
@@ -16727,7 +16776,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16727
16776
  const srcTypeArgs = srcAliasInfo.typeArgs;
16728
16777
  destAliasInfo.typeArgs.forEach((destTypeArg, index) => {
16729
16778
  const srcTypeArg = index < srcTypeArgs.length ? srcTypeArgs[index] : types_1.UnknownType.create();
16730
- if (!assignType(destTypeArg, srcTypeArg, diag, destConstraints, srcConstraints, flags, recursionCount)) {
16779
+ if (!assignType(destTypeArg, srcTypeArg, diag, constraints, flags, recursionCount)) {
16731
16780
  isAssignable = false;
16732
16781
  }
16733
16782
  });
@@ -16806,8 +16855,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16806
16855
  types_1.TypeVarType.hasBound(destType) &&
16807
16856
  types_1.TypeVarType.isBound(destType) === types_1.TypeVarType.isBound(srcType) &&
16808
16857
  types_1.TypeBase.isInstance(srcType) === types_1.TypeBase.isInstance(destType)) {
16809
- if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0 && destConstraints) {
16810
- (0, constraintSolver_1.assignTypeVar)(evaluatorInterface, destType, srcType, diag, destConstraints, flags, recursionCount);
16858
+ if ((flags & 2 /* AssignTypeFlags.Contravariant */) === 0 && constraints) {
16859
+ (0, constraintSolver_1.assignTypeVar)(evaluatorInterface, destType, srcType, diag, constraints, flags, recursionCount);
16811
16860
  }
16812
16861
  return true;
16813
16862
  }
@@ -16822,9 +16871,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16822
16871
  return true;
16823
16872
  }
16824
16873
  }
16825
- if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0 || !(0, types_1.isTypeVar)(srcType)) {
16826
- const targetConstraints = (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0 ? destConstraints : srcConstraints;
16827
- if (!(0, constraintSolver_1.assignTypeVar)(evaluatorInterface, destType, srcType, diag, targetConstraints, flags, recursionCount)) {
16874
+ if ((flags & 2 /* AssignTypeFlags.Contravariant */) === 0 || !(0, types_1.isTypeVar)(srcType)) {
16875
+ if (!(0, constraintSolver_1.assignTypeVar)(evaluatorInterface, destType, srcType, diag, constraints, flags, recursionCount)) {
16828
16876
  return false;
16829
16877
  }
16830
16878
  if ((0, types_1.isAnyOrUnknown)(srcType) && (flags & 16 /* AssignTypeFlags.OverloadOverlap */) !== 0) {
@@ -16834,29 +16882,26 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16834
16882
  }
16835
16883
  }
16836
16884
  if ((0, types_1.isTypeVar)(srcType)) {
16837
- if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0) {
16838
- // The caller has requested that we solve for source type variables
16839
- // rather than dest.
16885
+ if ((flags & 2 /* AssignTypeFlags.Contravariant */) !== 0) {
16840
16886
  if (types_1.TypeVarType.isBound(srcType)) {
16841
16887
  return assignType(makeTopLevelTypeVarsConcrete(destType), makeTopLevelTypeVarsConcrete(srcType), diag,
16842
- /* destConstraints */ undefined,
16843
- /* srcConstraints */ undefined, flags, recursionCount);
16888
+ /* constraints */ undefined, flags, recursionCount);
16844
16889
  }
16845
- if ((0, constraintSolver_1.assignTypeVar)(evaluatorInterface, srcType, destType, diag, srcConstraints, flags, recursionCount)) {
16890
+ if ((0, constraintSolver_1.assignTypeVar)(evaluatorInterface, srcType, destType, diag, constraints, flags, recursionCount)) {
16846
16891
  return true;
16847
16892
  }
16848
16893
  // If the dest type is a union, only one of the subtypes needs to match.
16849
16894
  let isAssignable = false;
16850
16895
  if ((0, types_1.isUnion)(destType)) {
16851
16896
  (0, typeUtils_1.doForEachSubtype)(destType, (destSubtype) => {
16852
- if ((0, constraintSolver_1.assignTypeVar)(evaluatorInterface, srcType, destSubtype, diag, srcConstraints, flags, recursionCount)) {
16897
+ if ((0, constraintSolver_1.assignTypeVar)(evaluatorInterface, srcType, destSubtype, diag, constraints, flags, recursionCount)) {
16853
16898
  isAssignable = true;
16854
16899
  }
16855
16900
  });
16856
16901
  }
16857
16902
  return isAssignable;
16858
16903
  }
16859
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) !== 0) {
16904
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) !== 0) {
16860
16905
  if ((0, types_1.isAnyOrUnknown)(destType)) {
16861
16906
  return true;
16862
16907
  }
@@ -16890,29 +16935,27 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16890
16935
  return true;
16891
16936
  }
16892
16937
  if ((0, types_1.isAnyOrUnknown)(srcType) && !((_e = srcType.props) === null || _e === void 0 ? void 0 : _e.specialForm)) {
16893
- const targetConstraints = (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0 ? destConstraints : srcConstraints;
16894
- if (targetConstraints) {
16938
+ if (constraints) {
16895
16939
  // If it's an ellipsis type, convert it to a regular "Any"
16896
16940
  // type. These are functionally equivalent, but "Any" looks
16897
16941
  // better in the text representation.
16898
16942
  const typeVarSubstitution = (0, typeUtils_1.isEllipsisType)(srcType) ? types_1.AnyType.create() : srcType;
16899
- (0, typeUtils_1.setTypeArgsRecursive)(destType, typeVarSubstitution, targetConstraints, recursionCount);
16943
+ setConstraintsForFreeTypeVars(destType, typeVarSubstitution, constraints);
16900
16944
  }
16901
16945
  if ((flags & 16 /* AssignTypeFlags.OverloadOverlap */) === 0) {
16902
16946
  return true;
16903
16947
  }
16904
16948
  }
16905
16949
  if ((0, types_1.isNever)(srcType)) {
16906
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) !== 0) {
16950
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) !== 0) {
16907
16951
  if ((0, types_1.isNever)(destType)) {
16908
16952
  return true;
16909
16953
  }
16910
16954
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.typeAssignmentMismatch().format(printSrcDestTypes(srcType, destType)));
16911
16955
  return false;
16912
16956
  }
16913
- const targetConstraints = (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0 ? destConstraints : srcConstraints;
16914
- if (targetConstraints) {
16915
- (0, typeUtils_1.setTypeArgsRecursive)(destType, types_1.UnknownType.create(), targetConstraints, recursionCount);
16957
+ if (constraints) {
16958
+ setConstraintsForFreeTypeVars(destType, types_1.UnknownType.create(), constraints);
16916
16959
  }
16917
16960
  return true;
16918
16961
  }
@@ -16920,28 +16963,22 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16920
16963
  // If both the source and dest are unions, use assignFromUnionType which has
16921
16964
  // special-case logic to handle this case.
16922
16965
  if ((0, types_1.isUnion)(srcType)) {
16923
- return assignFromUnionType(destType, srcType,
16924
- /* diag */ undefined, destConstraints, srcConstraints, flags, recursionCount);
16966
+ return assignFromUnionType(destType, srcType, /* diag */ undefined, constraints, flags, recursionCount);
16925
16967
  }
16926
- const clonedDestConstraints = destConstraints === null || destConstraints === void 0 ? void 0 : destConstraints.clone();
16927
- const clonedSrcConstraints = srcConstraints === null || srcConstraints === void 0 ? void 0 : srcConstraints.clone();
16928
- if (assignToUnionType(destType, srcType,
16929
- /* diag */ undefined, clonedDestConstraints, clonedSrcConstraints, flags, recursionCount)) {
16930
- if (destConstraints && clonedDestConstraints) {
16931
- destConstraints.copyFromClone(clonedDestConstraints);
16932
- }
16933
- if (srcConstraints && clonedSrcConstraints) {
16934
- srcConstraints.copyFromClone(clonedSrcConstraints);
16968
+ const clonedConstraints = constraints === null || constraints === void 0 ? void 0 : constraints.clone();
16969
+ if (assignToUnionType(destType, srcType, /* diag */ undefined, clonedConstraints, flags, recursionCount)) {
16970
+ if (constraints && clonedConstraints) {
16971
+ constraints.copyFromClone(clonedConstraints);
16935
16972
  }
16936
16973
  return true;
16937
16974
  }
16938
16975
  }
16939
16976
  const expandedSrcType = makeTopLevelTypeVarsConcrete(srcType);
16940
16977
  if ((0, types_1.isUnion)(expandedSrcType)) {
16941
- return assignFromUnionType(destType, expandedSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
16978
+ return assignFromUnionType(destType, expandedSrcType, diag, constraints, flags, recursionCount);
16942
16979
  }
16943
16980
  if ((0, types_1.isUnion)(destType)) {
16944
- return assignToUnionType(destType, srcType, diag, destConstraints, srcConstraints, flags, recursionCount);
16981
+ return assignToUnionType(destType, srcType, diag, constraints, flags, recursionCount);
16945
16982
  }
16946
16983
  // Is the src a specialized "type" object?
16947
16984
  if ((0, types_1.isClassInstance)(expandedSrcType) && types_1.ClassType.isBuiltIn(expandedSrcType, 'type')) {
@@ -16959,7 +16996,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16959
16996
  }
16960
16997
  }
16961
16998
  else if ((0, types_1.isClassInstance)(typeTypeArg) || (0, types_1.isTypeVar)(typeTypeArg)) {
16962
- if (assignType(destType, (0, typeUtils_1.convertToInstantiable)(typeTypeArg), diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
16999
+ if (assignType(destType, (0, typeUtils_1.convertToInstantiable)(typeTypeArg), diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
16963
17000
  return true;
16964
17001
  }
16965
17002
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.typeAssignmentMismatch().format(printSrcDestTypes(srcType, destType)));
@@ -16986,10 +17023,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
16986
17023
  }
16987
17024
  if (isSpecialFormClass(expandedSrcType, flags)) {
16988
17025
  if ((_h = destType.props) === null || _h === void 0 ? void 0 : _h.specialForm) {
16989
- return assignType(destType.props.specialForm, expandedSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
17026
+ return assignType(destType.props.specialForm, expandedSrcType, diag, constraints, flags, recursionCount);
16990
17027
  }
16991
17028
  }
16992
- else if (assignClass(destType, expandedSrcType, diag, destConstraints, srcConstraints, flags, recursionCount,
17029
+ else if (assignClass(destType, expandedSrcType, diag, constraints, flags, recursionCount,
16993
17030
  /* reportErrorsUsingObjType */ false)) {
16994
17031
  return true;
16995
17032
  }
@@ -17001,7 +17038,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17001
17038
  // the metaclass of the instantiable dest type.
17002
17039
  const destMetaclass = destType.shared.effectiveMetaclass;
17003
17040
  if (destMetaclass && (0, types_1.isInstantiableClass)(destMetaclass)) {
17004
- if (assignClass(types_1.ClassType.cloneAsInstance(destMetaclass), expandedSrcType, diag, destConstraints, srcConstraints, flags, recursionCount,
17041
+ if (assignClass(types_1.ClassType.cloneAsInstance(destMetaclass), expandedSrcType, diag, constraints, flags, recursionCount,
17005
17042
  /* reportErrorsUsingObjType */ false)) {
17006
17043
  return true;
17007
17044
  }
@@ -17021,7 +17058,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17021
17058
  const destTypeArgs = destType.priv.typeArgs;
17022
17059
  if (destTypeArgs && destTypeArgs.length >= 1) {
17023
17060
  if (types_1.TypeBase.isInstance(destTypeArgs[0]) && types_1.TypeBase.isInstantiable(srcType)) {
17024
- return assignType(destTypeArgs[0], (0, typeUtils_1.convertToInstance)(srcType), diag, destConstraints, srcConstraints, flags, recursionCount);
17061
+ return assignType(destTypeArgs[0], (0, typeUtils_1.convertToInstance)(srcType), diag, constraints, flags, recursionCount);
17025
17062
  }
17026
17063
  }
17027
17064
  // Is the dest a "type" object? Assume that all instantiable
@@ -17057,7 +17094,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17057
17094
  if (types_1.ClassType.isBuiltIn(destType, 'LiteralString')) {
17058
17095
  if (types_1.ClassType.isBuiltIn(concreteSrcType, 'str') &&
17059
17096
  concreteSrcType.priv.literalValue !== undefined) {
17060
- return (flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0;
17097
+ return (flags & 1 /* AssignTypeFlags.Invariant */) === 0;
17061
17098
  }
17062
17099
  else if (types_1.ClassType.isBuiltIn(concreteSrcType, 'LiteralString')) {
17063
17100
  return true;
@@ -17066,24 +17103,24 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17066
17103
  else if (types_1.ClassType.isBuiltIn(concreteSrcType, 'LiteralString') &&
17067
17104
  strClass &&
17068
17105
  (0, types_1.isInstantiableClass)(strClass) &&
17069
- (flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0) {
17106
+ (flags & 1 /* AssignTypeFlags.Invariant */) === 0) {
17070
17107
  concreteSrcType = types_1.ClassType.cloneAsInstance(strClass);
17071
17108
  }
17072
- if (!assignClass(types_1.ClassType.cloneAsInstantiable(destType), types_1.ClassType.cloneAsInstantiable(concreteSrcType), diag, destConstraints, srcConstraints, flags, recursionCount,
17109
+ if (!assignClass(types_1.ClassType.cloneAsInstantiable(destType), types_1.ClassType.cloneAsInstantiable(concreteSrcType), diag, constraints, flags, recursionCount,
17073
17110
  /* reportErrorsUsingObjType */ true)) {
17074
17111
  return false;
17075
17112
  }
17076
17113
  return true;
17077
17114
  }
17078
- else if ((0, types_1.isFunction)(concreteSrcType) || (0, types_1.isOverloadedFunction)(concreteSrcType)) {
17115
+ else if ((0, types_1.isFunction)(concreteSrcType) || (0, types_1.isOverloaded)(concreteSrcType)) {
17079
17116
  // Is the destination a callback protocol (defined in PEP 544)?
17080
17117
  const destCallbackType = getCallbackProtocolType(destType, recursionCount);
17081
17118
  if (destCallbackType) {
17082
- return assignType(destCallbackType, concreteSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
17119
+ return assignType(destCallbackType, concreteSrcType, diag, constraints, flags, recursionCount);
17083
17120
  }
17084
17121
  // All functions are considered instances of "builtins.function".
17085
17122
  if (functionClass) {
17086
- return assignType(destType, (0, typeUtils_1.convertToInstance)(functionClass), diag, destConstraints, srcConstraints, flags, recursionCount);
17123
+ return assignType(destType, (0, typeUtils_1.convertToInstance)(functionClass), diag, constraints, flags, recursionCount);
17087
17124
  }
17088
17125
  }
17089
17126
  else if ((0, types_1.isModule)(concreteSrcType)) {
@@ -17092,7 +17129,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17092
17129
  return true;
17093
17130
  }
17094
17131
  if (types_1.ClassType.isProtocolClass(destType)) {
17095
- return (0, protocols_1.assignModuleToProtocol)(evaluatorInterface, types_1.ClassType.cloneAsInstantiable(destType), concreteSrcType, diag, destConstraints, flags, recursionCount);
17132
+ return (0, protocols_1.assignModuleToProtocol)(evaluatorInterface, types_1.ClassType.cloneAsInstantiable(destType), concreteSrcType, diag, constraints, flags, recursionCount);
17096
17133
  }
17097
17134
  }
17098
17135
  else if ((0, types_1.isInstantiableClass)(concreteSrcType)) {
@@ -17100,12 +17137,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17100
17137
  // class that is effectively a function.
17101
17138
  const callbackType = getCallbackProtocolType(destType, recursionCount);
17102
17139
  if (callbackType) {
17103
- return assignType(callbackType, concreteSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
17140
+ return assignType(callbackType, concreteSrcType, diag, constraints, flags, recursionCount);
17104
17141
  }
17105
17142
  // If the destType is an instantiation of a Protocol,
17106
17143
  // see if the class type itself satisfies the protocol.
17107
17144
  if (types_1.ClassType.isProtocolClass(destType)) {
17108
- return (0, protocols_1.assignClassToProtocol)(evaluatorInterface, types_1.ClassType.cloneAsInstantiable(destType), concreteSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
17145
+ return (0, protocols_1.assignClassToProtocol)(evaluatorInterface, types_1.ClassType.cloneAsInstantiable(destType), concreteSrcType, diag, constraints, flags, recursionCount);
17109
17146
  }
17110
17147
  // Determine if the metaclass can be assigned to the object.
17111
17148
  const metaclass = concreteSrcType.shared.effectiveMetaclass;
@@ -17114,7 +17151,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17114
17151
  return true;
17115
17152
  }
17116
17153
  else {
17117
- return assignClass(types_1.ClassType.cloneAsInstantiable(destType), metaclass, diag, destConstraints, srcConstraints, flags, recursionCount,
17154
+ return assignClass(types_1.ClassType.cloneAsInstantiable(destType), metaclass, diag, constraints, flags, recursionCount,
17118
17155
  /* reportErrorsUsingObjType */ false);
17119
17156
  }
17120
17157
  }
@@ -17123,7 +17160,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17123
17160
  return (flags & 16 /* AssignTypeFlags.OverloadOverlap */) === 0;
17124
17161
  }
17125
17162
  else if ((0, types_1.isUnion)(concreteSrcType)) {
17126
- return assignType(destType, concreteSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
17163
+ return assignType(destType, concreteSrcType, diag, constraints, flags, recursionCount);
17127
17164
  }
17128
17165
  }
17129
17166
  if ((0, types_1.isFunction)(destType)) {
@@ -17144,14 +17181,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17144
17181
  // The constructor conversion may result in a union of the
17145
17182
  // __init__ and __new__ callables.
17146
17183
  if ((0, types_1.isUnion)(concreteSrcType)) {
17147
- return assignType(destType, concreteSrcType, diag, destConstraints, srcConstraints, flags, recursionCount);
17184
+ return assignType(destType, concreteSrcType, diag, constraints, flags, recursionCount);
17148
17185
  }
17149
17186
  }
17150
17187
  }
17151
17188
  if ((0, types_1.isAnyOrUnknown)(concreteSrcType)) {
17152
17189
  return (flags & 16 /* AssignTypeFlags.OverloadOverlap */) === 0;
17153
17190
  }
17154
- if ((0, types_1.isOverloadedFunction)(concreteSrcType)) {
17191
+ if ((0, types_1.isOverloaded)(concreteSrcType)) {
17155
17192
  // If this is the first pass of an argument assignment, skip
17156
17193
  // all attempts to assign an overloaded function to a function
17157
17194
  // because we probably don't have enough information to properly
@@ -17161,23 +17198,17 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17161
17198
  return true;
17162
17199
  }
17163
17200
  // Find all of the overloaded functions that match the parameters.
17164
- const overloads = types_1.OverloadedFunctionType.getOverloads(concreteSrcType);
17201
+ const overloads = types_1.OverloadedType.getOverloads(concreteSrcType);
17165
17202
  const filteredOverloads = [];
17166
- const destTypeVarSignatures = [];
17167
- const srcTypeVarSignatures = [];
17203
+ const typeVarSignatures = [];
17168
17204
  overloads.forEach((overload) => {
17169
17205
  var _a;
17170
17206
  const overloadScopeId = (_a = (0, typeUtils_1.getTypeVarScopeId)(overload)) !== null && _a !== void 0 ? _a : '';
17171
- const destConstraintsClone = destConstraints === null || destConstraints === void 0 ? void 0 : destConstraints.cloneWithSignature(overloadScopeId);
17172
- const srcConstraintsClone = srcConstraints === null || srcConstraints === void 0 ? void 0 : srcConstraints.cloneWithSignature(overloadScopeId);
17173
- if (assignType(destType, overload,
17174
- /* diag */ undefined, destConstraintsClone, srcConstraintsClone, flags, recursionCount)) {
17207
+ const constraintsClone = constraints === null || constraints === void 0 ? void 0 : constraints.cloneWithSignature(overloadScopeId);
17208
+ if (assignType(destType, overload, /* diag */ undefined, constraintsClone, flags, recursionCount)) {
17175
17209
  filteredOverloads.push(overload);
17176
- if (destConstraintsClone) {
17177
- (0, collectionUtils_1.appendArray)(destTypeVarSignatures, destConstraintsClone.getConstraintSets());
17178
- }
17179
- if (srcConstraintsClone) {
17180
- (0, collectionUtils_1.appendArray)(srcTypeVarSignatures, srcConstraintsClone.getConstraintSets());
17210
+ if (constraintsClone) {
17211
+ (0, collectionUtils_1.appendArray)(typeVarSignatures, constraintsClone.getConstraintSets());
17181
17212
  }
17182
17213
  }
17183
17214
  });
@@ -17186,48 +17217,46 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17186
17217
  return false;
17187
17218
  }
17188
17219
  if (filteredOverloads.length === 1 || (flags & 8 /* AssignTypeFlags.ArgAssignmentFirstPass */) === 0) {
17189
- if (destConstraints) {
17190
- destConstraints.addConstraintSets(destTypeVarSignatures);
17191
- }
17192
- if (srcConstraints) {
17193
- srcConstraints.addConstraintSets(srcTypeVarSignatures);
17220
+ if (constraints) {
17221
+ constraints.addConstraintSets(typeVarSignatures);
17194
17222
  }
17195
17223
  }
17196
17224
  return true;
17197
17225
  }
17198
17226
  if ((0, types_1.isFunction)(concreteSrcType)) {
17199
- if (assignFunction(destType, concreteSrcType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints !== null && destConstraints !== void 0 ? destConstraints : new constraintTracker_1.ConstraintTracker(), srcConstraints !== null && srcConstraints !== void 0 ? srcConstraints : new constraintTracker_1.ConstraintTracker(), flags, recursionCount)) {
17227
+ if (assignFunction(destType, concreteSrcType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints !== null && constraints !== void 0 ? constraints : new constraintTracker_1.ConstraintTracker(), flags, recursionCount)) {
17200
17228
  return true;
17201
17229
  }
17202
17230
  }
17203
17231
  }
17204
- if ((0, types_1.isOverloadedFunction)(destType)) {
17232
+ if ((0, types_1.isOverloaded)(destType)) {
17205
17233
  const overloadDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
17206
17234
  // All overloads in the dest must be assignable.
17207
- const destOverloads = types_1.OverloadedFunctionType.getOverloads(destType);
17235
+ const destOverloads = types_1.OverloadedType.getOverloads(destType);
17208
17236
  // If the source is also an overload with the same number of overloads,
17209
17237
  // there's a good chance that there's a one-to-one mapping. Try this
17210
17238
  // first before using an n^2 algorithm.
17211
- if ((0, types_1.isOverloadedFunction)(srcType)) {
17212
- const srcOverloads = types_1.OverloadedFunctionType.getOverloads(srcType);
17239
+ if ((0, types_1.isOverloaded)(srcType)) {
17240
+ const srcOverloads = types_1.OverloadedType.getOverloads(srcType);
17213
17241
  if (destOverloads.length === srcOverloads.length) {
17214
17242
  if (destOverloads.every((destOverload, index) => {
17215
17243
  const srcOverload = srcOverloads[index];
17216
17244
  return assignType(destOverload, srcOverload,
17217
- /* diag */ undefined, destConstraints, srcConstraints, flags, recursionCount);
17245
+ /* diag */ undefined, constraints, flags, recursionCount);
17218
17246
  })) {
17219
17247
  return true;
17220
17248
  }
17221
17249
  }
17222
17250
  }
17223
17251
  const isAssignable = destOverloads.every((destOverload) => {
17224
- const result = assignType(destOverload, srcType, overloadDiag === null || overloadDiag === void 0 ? void 0 : overloadDiag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount);
17252
+ const result = assignType(destOverload, srcType, overloadDiag === null || overloadDiag === void 0 ? void 0 : overloadDiag.createAddendum(), constraints, flags, recursionCount);
17225
17253
  return result;
17226
17254
  });
17227
17255
  if (!isAssignable) {
17228
- if (overloadDiag) {
17256
+ const overloads = types_1.OverloadedType.getOverloads(destType);
17257
+ if (overloadDiag && overloads.length > 0) {
17229
17258
  overloadDiag.addMessage(localize_1.LocAddendum.overloadNotAssignable().format({
17230
- name: destType.priv.overloads[0].shared.name,
17259
+ name: overloads[0].shared.name,
17231
17260
  }));
17232
17261
  }
17233
17262
  return false;
@@ -17236,8 +17265,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17236
17265
  }
17237
17266
  if ((0, types_1.isClass)(destType) && types_1.ClassType.isBuiltIn(destType, 'object')) {
17238
17267
  if (((0, types_1.isInstantiableClass)(destType) && types_1.TypeBase.isInstantiable(srcType)) || (0, types_1.isClassInstance)(destType)) {
17239
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) === 0) {
17240
- // All types (including None, Module, OverloadedFunction) derive from object.
17268
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) === 0) {
17269
+ // All types (including None, Module, Overloaded) derive from object.
17241
17270
  return true;
17242
17271
  }
17243
17272
  }
@@ -17245,7 +17274,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17245
17274
  // Are we trying to assign None to a protocol?
17246
17275
  if ((0, typeUtils_1.isNoneInstance)(srcType) && (0, types_1.isClassInstance)(destType) && types_1.ClassType.isProtocolClass(destType)) {
17247
17276
  if (noneTypeClass && (0, types_1.isInstantiableClass)(noneTypeClass)) {
17248
- return (0, protocols_1.assignClassToProtocol)(evaluatorInterface, types_1.ClassType.cloneAsInstantiable(destType), types_1.ClassType.cloneAsInstance(noneTypeClass), diag, destConstraints, srcConstraints, flags, recursionCount);
17277
+ return (0, protocols_1.assignClassToProtocol)(evaluatorInterface, types_1.ClassType.cloneAsInstantiable(destType), types_1.ClassType.cloneAsInstance(noneTypeClass), diag, constraints, flags, recursionCount);
17249
17278
  }
17250
17279
  }
17251
17280
  if ((0, typeUtils_1.isNoneInstance)(destType)) {
@@ -17255,7 +17284,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17255
17284
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.typeAssignmentMismatch().format(printSrcDestTypes(srcType, destType)));
17256
17285
  return false;
17257
17286
  }
17258
- function assignFromUnionType(destType, srcType, diag, destConstraints, srcConstraints, flags, recursionCount) {
17287
+ function assignFromUnionType(destType, srcType, diag, constraints, flags, recursionCount) {
17259
17288
  // Start by checking for an exact match. This is needed to handle unions
17260
17289
  // that contain recursive type aliases.
17261
17290
  if ((0, types_1.isTypeSame)(srcType, destType, {}, recursionCount)) {
@@ -17272,8 +17301,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17272
17301
  // the getattr function.
17273
17302
  const nonAnySubtypes = destType.priv.subtypes.filter((t) => !(0, types_1.isAnyOrUnknown)(t));
17274
17303
  if (nonAnySubtypes.length === 1 && (0, types_1.isTypeVar)(nonAnySubtypes[0])) {
17275
- assignType(nonAnySubtypes[0], srcType,
17276
- /* diag */ undefined, destConstraints, srcConstraints, flags, recursionCount);
17304
+ assignType(nonAnySubtypes[0], srcType, /* diag */ undefined, constraints, flags, recursionCount);
17277
17305
  // This always succeeds because the destination contains Any.
17278
17306
  return true;
17279
17307
  }
@@ -17314,14 +17342,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17314
17342
  if (types_1.ClassType.isTypedDictClass(srcSubtype) && types_1.ClassType.isTypedDictClass(destSubtype)) {
17315
17343
  if (assignType(srcSubtype, destSubtype,
17316
17344
  /* diag */ undefined,
17317
- /* destConstraints */ undefined,
17318
- /* srcConstraints */ undefined, flags, recursionCount)) {
17345
+ /* constraints */ undefined, flags, recursionCount)) {
17319
17346
  return true;
17320
17347
  }
17321
17348
  }
17322
17349
  }
17323
- if ((0, types_1.isFunction)(srcSubtype) || (0, types_1.isOverloadedFunction)(srcSubtype)) {
17324
- if ((0, types_1.isFunction)(destSubtype) || (0, types_1.isOverloadedFunction)(destSubtype)) {
17350
+ if ((0, types_1.isFunction)(srcSubtype) || (0, types_1.isOverloaded)(srcSubtype)) {
17351
+ if ((0, types_1.isFunction)(destSubtype) || (0, types_1.isOverloaded)(destSubtype)) {
17325
17352
  return true;
17326
17353
  }
17327
17354
  }
@@ -17329,7 +17356,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17329
17356
  });
17330
17357
  if (destTypeIndex >= 0) {
17331
17358
  if (assignType(remainingDestSubtypes[destTypeIndex], srcSubtype,
17332
- /* diag */ undefined, destConstraints, srcConstraints, flags, recursionCount)) {
17359
+ /* diag */ undefined, constraints, flags, recursionCount)) {
17333
17360
  // Note that we have matched at least one subtype indicating
17334
17361
  // there is at least some overlap.
17335
17362
  matchedSomeSubtypes = true;
@@ -17344,7 +17371,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17344
17371
  // If there is are remaining dest subtypes and they're all type variables,
17345
17372
  // attempt to assign the remaining source subtypes to them.
17346
17373
  if (canUseFastPath && (remainingDestSubtypes.length !== 0 || remainingSrcSubtypes.length !== 0)) {
17347
- if ((flags & 1 /* AssignTypeFlags.EnforceInvariance */) !== 0) {
17374
+ if ((flags & 1 /* AssignTypeFlags.Invariant */) !== 0) {
17348
17375
  // If we have no src subtypes remaining but not all dest types have been subsumed
17349
17376
  // by other dest types, then the types are not compatible if we're enforcing invariance.
17350
17377
  if (remainingSrcSubtypes.length === 0) {
@@ -17352,8 +17379,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17352
17379
  /* allowAnyToSubsume */ true, recursionCount));
17353
17380
  }
17354
17381
  }
17355
- const isReversed = (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0;
17356
- const effectiveDestSubtypes = isReversed ? remainingSrcSubtypes : remainingDestSubtypes;
17382
+ const isContra = (flags & 2 /* AssignTypeFlags.Contravariant */) !== 0;
17383
+ const effectiveDestSubtypes = isContra ? remainingSrcSubtypes : remainingDestSubtypes;
17357
17384
  if (effectiveDestSubtypes.length === 0 || effectiveDestSubtypes.some((t) => !(0, types_1.isTypeVar)(t))) {
17358
17385
  canUseFastPath = false;
17359
17386
  // We can avoid checking the source subtypes that have already been checked.
@@ -17366,7 +17393,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17366
17393
  for (let srcIndex = 0; srcIndex < remainingSrcSubtypes.length; srcIndex++) {
17367
17394
  let foundMatchForSrc = false;
17368
17395
  for (let destIndex = 0; destIndex < reorderedDestSubtypes.length; destIndex++) {
17369
- if (assignType(reorderedDestSubtypes[destIndex], remainingSrcSubtypes[srcIndex], diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17396
+ if (assignType(reorderedDestSubtypes[destIndex], remainingSrcSubtypes[srcIndex], diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17370
17397
  foundMatchForSrc = true;
17371
17398
  // Move the matched dest TypeVar to the end of the list so the other
17372
17399
  // dest TypeVars have a better chance of being assigned to.
@@ -17383,13 +17410,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17383
17410
  sortedSrcTypes = remainingSrcSubtypes;
17384
17411
  }
17385
17412
  else if (remainingSrcSubtypes.length === 0) {
17386
- if ((flags & 2048 /* AssignTypeFlags.PopulatingExpectedType */) !== 0) {
17413
+ if ((flags & 2048 /* AssignTypeFlags.PopulateExpectedType */) !== 0) {
17387
17414
  // If we're populating an expected type, try not to leave
17388
17415
  // any TypeVars unsolved. Assign the full type to the remaining
17389
17416
  // dest TypeVars.
17390
17417
  remainingDestSubtypes.forEach((destSubtype) => {
17391
- assignType(destSubtype, srcType,
17392
- /* diag */ undefined, destConstraints, srcConstraints, flags, recursionCount);
17418
+ assignType(destSubtype, srcType, /* diag */ undefined, constraints, flags, recursionCount);
17393
17419
  });
17394
17420
  }
17395
17421
  // If we've assigned all of the source subtypes but one or more dest
@@ -17398,7 +17424,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17398
17424
  else {
17399
17425
  // Try to assign a union of the remaining source types to
17400
17426
  // the first destination TypeVar.
17401
- if (!assignType(isReversed ? (0, types_1.combineTypes)(remainingDestSubtypes) : remainingDestSubtypes[0], isReversed ? remainingSrcSubtypes[0] : (0, types_1.combineTypes)(remainingSrcSubtypes), diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17427
+ if (!assignType(isContra ? (0, types_1.combineTypes)(remainingDestSubtypes) : remainingDestSubtypes[0], isContra ? remainingSrcSubtypes[0] : (0, types_1.combineTypes)(remainingSrcSubtypes), diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17402
17428
  canUseFastPath = false;
17403
17429
  }
17404
17430
  }
@@ -17417,15 +17443,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17417
17443
  if (isIncompatible) {
17418
17444
  return;
17419
17445
  }
17420
- if (!assignType(destType, subtype,
17421
- /* diag */ undefined, destConstraints, srcConstraints, flags, recursionCount)) {
17446
+ if (!assignType(destType, subtype, /* diag */ undefined, constraints, flags, recursionCount)) {
17422
17447
  // Determine if the current subtype is subsumed by another subtype
17423
17448
  // in the same union. If so, we can ignore this.
17424
17449
  const isSubtypeSubsumed = isTypeSubsumedByOtherType(subtype, srcType,
17425
17450
  /* allowAnyToSubsume */ false, recursionCount);
17426
17451
  // Try again with a concrete version of the subtype.
17427
17452
  if (!isSubtypeSubsumed &&
17428
- !assignType(destType, subtype, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17453
+ !assignType(destType, subtype, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17429
17454
  isIncompatible = true;
17430
17455
  }
17431
17456
  }
@@ -17450,6 +17475,22 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17450
17475
  }
17451
17476
  return types_1.ClassType.isSpecialFormClass(classType);
17452
17477
  }
17478
+ // Finds unsolved type variables in the destType and establishes constraints
17479
+ // in the constraint tracker for them based on the srcType.
17480
+ function setConstraintsForFreeTypeVars(destType, srcType, constraints) {
17481
+ if (constraints.isLocked()) {
17482
+ return;
17483
+ }
17484
+ const typeVars = (0, typeUtils_1.getTypeVarArgsRecursive)(destType);
17485
+ typeVars.forEach((typeVar) => {
17486
+ if (!types_1.TypeVarType.isBound(typeVar) && !constraints.getMainConstraintSet().getTypeVar(typeVar)) {
17487
+ // Don't set ParamSpecs or TypeVarTuples.
17488
+ if (!(0, types_1.isParamSpec)(srcType) && !(0, types_1.isTypeVarTuple)(srcType)) {
17489
+ constraints.setBounds(typeVar, srcType);
17490
+ }
17491
+ }
17492
+ });
17493
+ }
17453
17494
  // Determines whether a type is "subsumed by" (i.e. is a proper subtype of) another type.
17454
17495
  function isTypeSubsumedByOtherType(type, otherType, allowAnyToSubsume, recursionCount = 0) {
17455
17496
  const concreteType = makeTopLevelTypeVarsConcrete(type);
@@ -17492,22 +17533,20 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17492
17533
  }
17493
17534
  return (assignType(destType, srcType,
17494
17535
  /* diag */ undefined,
17495
- /* destConstraints */ undefined,
17496
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount) &&
17536
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount) &&
17497
17537
  !assignType(srcType, destType,
17498
17538
  /* diag */ undefined,
17499
- /* destConstraints */ undefined,
17500
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount));
17539
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount));
17501
17540
  }
17502
- function assignToUnionType(destType, srcType, diag, destConstraints, srcConstraints, flags, recursionCount) {
17541
+ function assignToUnionType(destType, srcType, diag, constraints, flags, recursionCount) {
17503
17542
  // If we need to enforce invariance, the source needs to be compatible
17504
17543
  // with all subtypes in the dest, unless those subtypes are subclasses
17505
17544
  // of other subtypes.
17506
- if (flags & 1 /* AssignTypeFlags.EnforceInvariance */) {
17545
+ if (flags & 1 /* AssignTypeFlags.Invariant */) {
17507
17546
  let isIncompatible = false;
17508
17547
  (0, typeUtils_1.doForEachSubtype)(destType, (subtype, index) => {
17509
17548
  if (!isIncompatible &&
17510
- !assignType(subtype, srcType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17549
+ !assignType(subtype, srcType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17511
17550
  // Determine whether this subtype is subsumed by some other
17512
17551
  // subtype in the union. If so, we can ignore the incompatibility.
17513
17552
  let skipSubtype = false;
@@ -17518,8 +17557,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17518
17557
  const adjOtherSubtype = (0, typeUtils_1.makeTypeVarsBound)(otherSubtype, /* scopeIds */ undefined);
17519
17558
  if (assignType(adjOtherSubtype, adjSubtype,
17520
17559
  /* diag */ undefined,
17521
- /* destConstraints */ undefined,
17522
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount)) {
17560
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount)) {
17523
17561
  skipSubtype = true;
17524
17562
  }
17525
17563
  }
@@ -17543,7 +17581,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17543
17581
  // If so, we need to use a slower path.
17544
17582
  if (!(0, typeUtils_1.requiresSpecialization)(destType)) {
17545
17583
  for (const subtype of destType.priv.subtypes) {
17546
- if (assignType(subtype, srcType, diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17584
+ if (assignType(subtype, srcType, diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum(), constraints, flags, recursionCount)) {
17547
17585
  foundMatch = true;
17548
17586
  break;
17549
17587
  }
@@ -17558,8 +17596,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17558
17596
  foundMatch = true;
17559
17597
  }
17560
17598
  else {
17561
- let bestDestConstraints;
17562
- let bestSrcConstraints;
17599
+ let bestConstraints;
17563
17600
  let bestConstraintsScore;
17564
17601
  let nakedTypeVarMatches = 0;
17565
17602
  // If the srcType is a literal, try to use the fast-path lookup
@@ -17572,16 +17609,15 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17572
17609
  (0, typeUtils_1.doForEachSubtype)(destType, (subtype) => {
17573
17610
  // Make a temporary clone of the constraints. We don't want to modify
17574
17611
  // the original constraints until we find the "optimal" typeVar mapping.
17575
- const destConstraintsClone = destConstraints === null || destConstraints === void 0 ? void 0 : destConstraints.clone();
17576
- const srcConstraintsClone = srcConstraints === null || srcConstraints === void 0 ? void 0 : srcConstraints.clone();
17577
- if (assignType(subtype, srcType, diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum(), destConstraintsClone, srcConstraintsClone, flags, recursionCount)) {
17612
+ const constraintsClone = constraints === null || constraints === void 0 ? void 0 : constraints.clone();
17613
+ if (assignType(subtype, srcType, diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum(), constraintsClone, flags, recursionCount)) {
17578
17614
  foundMatch = true;
17579
- if (destConstraintsClone) {
17615
+ if (constraintsClone) {
17580
17616
  // Ask the constraints to compute a "score" for the current
17581
17617
  // contents of the table.
17582
- let constraintsScore = destConstraintsClone.getScore();
17618
+ let constraintsScore = constraintsClone.getScore();
17583
17619
  if ((0, types_1.isTypeVar)(subtype)) {
17584
- if (!(destConstraints === null || destConstraints === void 0 ? void 0 : destConstraints.getMainConstraintSet().getTypeVar(subtype))) {
17620
+ if (!(constraints === null || constraints === void 0 ? void 0 : constraints.getMainConstraintSet().getTypeVar(subtype))) {
17585
17621
  nakedTypeVarMatches++;
17586
17622
  // Handicap the solution slightly so another type var with
17587
17623
  // existing constraints will be preferred.
@@ -17595,8 +17631,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17595
17631
  if (bestConstraintsScore === undefined || bestConstraintsScore <= constraintsScore) {
17596
17632
  // We found a typeVar mapping with a higher score than before.
17597
17633
  bestConstraintsScore = constraintsScore;
17598
- bestDestConstraints = destConstraintsClone;
17599
- bestSrcConstraints = srcConstraintsClone;
17634
+ bestConstraints = constraintsClone;
17600
17635
  }
17601
17636
  }
17602
17637
  }
@@ -17608,15 +17643,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17608
17643
  // Typically, they will receive some constraints via some
17609
17644
  // later argument assignment.
17610
17645
  if (nakedTypeVarMatches > 1 && (flags & 8 /* AssignTypeFlags.ArgAssignmentFirstPass */) !== 0) {
17611
- bestDestConstraints = undefined;
17612
- bestSrcConstraints = undefined;
17646
+ bestConstraints = undefined;
17613
17647
  }
17614
17648
  // If we found a winning type var mapping, copy it back to constraints.
17615
- if (destConstraints && bestDestConstraints) {
17616
- destConstraints.copyFromClone(bestDestConstraints);
17617
- }
17618
- if (srcConstraints && bestSrcConstraints) {
17619
- srcConstraints.copyFromClone(bestSrcConstraints);
17649
+ if (constraints && bestConstraints) {
17650
+ constraints.copyFromClone(bestConstraints);
17620
17651
  }
17621
17652
  }
17622
17653
  }
@@ -17624,7 +17655,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17624
17655
  // constraints to the union.
17625
17656
  if (!foundMatch) {
17626
17657
  if ((0, types_1.isTypeVar)(srcType) && types_1.TypeVarType.hasConstraints(srcType)) {
17627
- foundMatch = assignType(destType, makeTopLevelTypeVarsConcrete(srcType), diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum(), destConstraints, srcConstraints, flags, recursionCount);
17658
+ foundMatch = assignType(destType, makeTopLevelTypeVarsConcrete(srcType), diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum(), constraints, flags, recursionCount);
17628
17659
  }
17629
17660
  }
17630
17661
  if (!foundMatch) {
@@ -17660,15 +17691,13 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17660
17691
  (0, debug_1.assert)(condition.constraintIndex === 0, 'Expected constraint for bound TypeVar to have index of 0');
17661
17692
  return assignType(destType.shared.boundType, srcSubtype,
17662
17693
  /* diag */ undefined,
17663
- /* destConstraints */ undefined,
17664
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount);
17694
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount);
17665
17695
  }
17666
17696
  if (types_1.TypeVarType.hasConstraints(destType)) {
17667
17697
  (0, debug_1.assert)(condition.constraintIndex < destType.shared.constraints.length, 'Constraint for constrained TypeVar is out of bounds');
17668
17698
  return assignType(destType.shared.constraints[condition.constraintIndex], srcSubtype,
17669
17699
  /* diag */ undefined,
17670
- /* destConstraints */ undefined,
17671
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount);
17700
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */, recursionCount);
17672
17701
  }
17673
17702
  // This is a non-bound and non-constrained type variable with a matching condition.
17674
17703
  return true;
@@ -17706,7 +17735,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17706
17735
  }
17707
17736
  return getBoundMagicMethod(objType, '__call__', /* selfType */ undefined, /* diag */ undefined, recursionCount);
17708
17737
  }
17709
- function assignParam(destType, srcType, paramIndex, diag, destConstraints, srcConstraints, flags, recursionCount) {
17738
+ function assignParam(destType, srcType, paramIndex, diag, constraints, flags, recursionCount) {
17710
17739
  // Handle the special case where the dest type is a synthesized
17711
17740
  // "self" for a protocol class.
17712
17741
  if ((0, types_1.isTypeVar)(destType) &&
@@ -17724,19 +17753,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17724
17753
  let doSpecializationStep = false;
17725
17754
  if ((flags & 16 /* AssignTypeFlags.OverloadOverlap */) === 0) {
17726
17755
  const isFirstPass = (flags & 8 /* AssignTypeFlags.ArgAssignmentFirstPass */) !== 0;
17727
- if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0) {
17756
+ if ((flags & 2 /* AssignTypeFlags.Contravariant */) === 0) {
17728
17757
  if (!isFirstPass) {
17729
- specializedDestType = solveAndApplyConstraints(destType, destConstraints,
17730
- /* applyOptions */ undefined, {
17731
- useLowerBoundOnly: true,
17732
- });
17758
+ specializedDestType = solveAndApplyConstraints(destType, constraints,
17759
+ /* applyOptions */ undefined, { useLowerBoundOnly: true });
17733
17760
  }
17734
17761
  doSpecializationStep = (0, typeUtils_1.requiresSpecialization)(specializedDestType);
17735
17762
  }
17736
17763
  else {
17737
17764
  if (!isFirstPass) {
17738
- specializedSrcType = solveAndApplyConstraints(srcType, srcConstraints,
17739
- /* applyOptions */ undefined, {
17765
+ specializedSrcType = solveAndApplyConstraints(srcType, constraints, /* applyOptions */ undefined, {
17740
17766
  useLowerBoundOnly: true,
17741
17767
  });
17742
17768
  }
@@ -17746,16 +17772,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17746
17772
  // Is an additional specialization step required?
17747
17773
  if (doSpecializationStep) {
17748
17774
  if (assignType(specializedSrcType, specializedDestType,
17749
- /* diag */ undefined, srcConstraints, destConstraints, (flags ^ 2 /* AssignTypeFlags.ReverseTypeVarMatching */) | 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */, recursionCount)) {
17750
- if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) === 0) {
17751
- specializedDestType = solveAndApplyConstraints(destType, destConstraints);
17752
- }
17753
- else {
17754
- specializedSrcType = solveAndApplyConstraints(srcType, srcConstraints);
17755
- }
17775
+ /* diag */ undefined, constraints, (flags ^ 2 /* AssignTypeFlags.Contravariant */) | 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */, recursionCount)) {
17776
+ specializedDestType = solveAndApplyConstraints(destType, constraints);
17756
17777
  }
17757
17778
  }
17758
- if (!assignType(specializedSrcType, specializedDestType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), srcConstraints, destConstraints, flags, recursionCount)) {
17779
+ if (!assignType(specializedSrcType, specializedDestType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17759
17780
  if (diag && paramIndex !== undefined) {
17760
17781
  diag.addMessage(localize_1.LocAddendum.paramAssignment().format({
17761
17782
  index: paramIndex + 1,
@@ -17842,11 +17863,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17842
17863
  srcDetails.positionOnlyParamCount = Math.max(0, srcDetails.params.findIndex((p) => p.kind !== parameterUtils_1.ParamKind.Positional || p.param.category !== 0 /* ParamCategory.Simple */ || !!p.defaultType));
17843
17864
  }
17844
17865
  }
17845
- function assignFunction(destType, srcType, diag, destConstraints, srcConstraints, flags, recursionCount) {
17866
+ function assignFunction(destType, srcType, diag, constraints, flags, recursionCount) {
17846
17867
  var _a, _b, _c, _d, _e, _f, _g, _h;
17847
17868
  let canAssign = true;
17848
17869
  const checkReturnType = (flags & 64 /* AssignTypeFlags.SkipReturnTypeCheck */) === 0;
17849
- const reverseMatching = (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0;
17870
+ const isContra = (flags & 2 /* AssignTypeFlags.Contravariant */) !== 0;
17850
17871
  flags &= ~64 /* AssignTypeFlags.SkipReturnTypeCheck */;
17851
17872
  const destParamSpec = types_1.FunctionType.getParamSpecFromArgsKwargs(destType);
17852
17873
  if (destParamSpec) {
@@ -17858,8 +17879,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17858
17879
  }
17859
17880
  const destParamDetails = (0, parameterUtils_1.getParamListDetails)(destType);
17860
17881
  const srcParamDetails = (0, parameterUtils_1.getParamListDetails)(srcType);
17861
- adjustSourceParamDetailsForDestVariadic(reverseMatching ? destParamDetails : srcParamDetails, reverseMatching ? srcParamDetails : destParamDetails);
17862
- const targetIncludesParamSpec = reverseMatching ? !!srcParamSpec : !!destParamSpec;
17882
+ adjustSourceParamDetailsForDestVariadic(isContra ? destParamDetails : srcParamDetails, isContra ? srcParamDetails : destParamDetails);
17883
+ const targetIncludesParamSpec = isContra ? !!srcParamSpec : !!destParamSpec;
17863
17884
  const destPositionalCount = (_a = destParamDetails.firstKeywordOnlyIndex) !== null && _a !== void 0 ? _a : destParamDetails.params.length;
17864
17885
  const srcPositionalCount = (_b = srcParamDetails.firstKeywordOnlyIndex) !== null && _b !== void 0 ? _b : srcParamDetails.params.length;
17865
17886
  const positionalsToMatch = Math.min(destPositionalCount, srcPositionalCount);
@@ -17924,7 +17945,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17924
17945
  if ((0, types_1.isUnpacked)(srcParamType)) {
17925
17946
  canAssign = false;
17926
17947
  }
17927
- else if (!assignParam(destParamType, srcParamType, paramIndex, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17948
+ else if (!assignParam(destParamType, srcParamType, paramIndex, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17928
17949
  // Handle the special case where the source parameter is a synthesized
17929
17950
  // TypeVar for "self" or "cls".
17930
17951
  if ((flags & 512 /* AssignTypeFlags.SkipSelfClsTypeCheck */) === 0 ||
@@ -17961,7 +17982,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17961
17982
  if (destParamDetails.argsIndex !== undefined) {
17962
17983
  const destArgsType = destParamDetails.params[destParamDetails.argsIndex].type;
17963
17984
  const srcParamType = srcParamDetails.params[i].type;
17964
- if (!assignParam(destArgsType, srcParamType, i, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
17985
+ if (!assignParam(destArgsType, srcParamType, i, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17965
17986
  canAssign = false;
17966
17987
  }
17967
17988
  continue;
@@ -17974,9 +17995,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
17974
17995
  // populating TypeVar constraints.
17975
17996
  const paramInfo = srcParamDetails.params[i];
17976
17997
  const defaultArgType = (_f = paramInfo.defaultType) !== null && _f !== void 0 ? _f : paramInfo.defaultType;
17998
+ // Enforce invariance below because the default arg value
17999
+ // is constructed prior to the call, so its type is already
18000
+ // fixed.
17977
18001
  if (defaultArgType &&
17978
- !assignType(paramInfo.type, defaultArgType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), srcConstraints,
17979
- /* destConstraints */ undefined, flags, recursionCount)) {
18002
+ !assignType(paramInfo.type, defaultArgType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
17980
18003
  canAssign = false;
17981
18004
  }
17982
18005
  continue;
@@ -18015,7 +18038,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18015
18038
  canAssign = false;
18016
18039
  }
18017
18040
  else {
18018
- if (!assignParam(destParamType, srcArgsType, paramIndex, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18041
+ if (!assignParam(destParamType, srcArgsType, paramIndex, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
18019
18042
  canAssign = false;
18020
18043
  }
18021
18044
  if (destParamDetails.params[paramIndex].kind !== parameterUtils_1.ParamKind.Positional &&
@@ -18057,7 +18080,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18057
18080
  if (!(0, types_1.isUnpacked)(srcArgsType)) {
18058
18081
  srcArgsType = makeTupleObject([{ type: srcArgsType, isUnbounded: true }], /* isUnpackedTuple */ true);
18059
18082
  }
18060
- if (!assignParam(destArgsType, srcArgsType, destParamDetails.params[destParamDetails.argsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18083
+ if (!assignParam(destArgsType, srcArgsType, destParamDetails.params[destParamDetails.argsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
18061
18084
  canAssign = false;
18062
18085
  }
18063
18086
  }
@@ -18115,7 +18138,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18115
18138
  }
18116
18139
  else if (destParamDetails.kwargsIndex !== undefined) {
18117
18140
  // Make sure we can assign the type to the Kwargs.
18118
- if (!assignParam(destParamDetails.params[destParamDetails.kwargsIndex].type, srcParamType, destParamDetails.params[destParamDetails.kwargsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18141
+ if (!assignParam(destParamDetails.params[destParamDetails.kwargsIndex].type, srcParamType, destParamDetails.params[destParamDetails.kwargsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
18119
18142
  canAssign = false;
18120
18143
  }
18121
18144
  }
@@ -18124,19 +18147,18 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18124
18147
  // populating TypeVar constraints.
18125
18148
  const defaultArgType = (_a = srcParamInfo.defaultType) !== null && _a !== void 0 ? _a : srcParamInfo.defaultType;
18126
18149
  if (defaultArgType &&
18127
- !assignType(srcParamInfo.type, defaultArgType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), srcConstraints,
18128
- /* destConstraints */ undefined, flags, recursionCount)) {
18150
+ !assignType(srcParamInfo.type, defaultArgType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
18129
18151
  canAssign = false;
18130
18152
  }
18131
18153
  }
18132
18154
  }
18133
18155
  else {
18134
18156
  const destParamType = destParamInfo.type;
18135
- const specializedDestParamType = destConstraints
18136
- ? solveAndApplyConstraints(destParamType, destConstraints)
18157
+ const specializedDestParamType = constraints
18158
+ ? solveAndApplyConstraints(destParamType, constraints)
18137
18159
  : destParamType;
18138
18160
  if (!assignParam(destParamInfo.type, srcParamType,
18139
- /* paramIndex */ undefined, paramDiag === null || paramDiag === void 0 ? void 0 : paramDiag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18161
+ /* paramIndex */ undefined, paramDiag === null || paramDiag === void 0 ? void 0 : paramDiag.createAddendum(), constraints, flags, recursionCount)) {
18140
18162
  if (paramDiag) {
18141
18163
  paramDiag.addMessage(localize_1.LocAddendum.namedParamTypeMismatch().format({
18142
18164
  name: srcParamInfo.param.name,
@@ -18162,7 +18184,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18162
18184
  destParamMap.forEach((destParamInfo, paramName) => {
18163
18185
  if (srcParamDetails.kwargsIndex !== undefined && destParamInfo.param.name) {
18164
18186
  // Make sure the src kwargs type is compatible.
18165
- if (!assignParam(destParamInfo.type, srcParamDetails.params[srcParamDetails.kwargsIndex].type, destParamInfo.index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18187
+ if (!assignParam(destParamInfo.type, srcParamDetails.params[srcParamDetails.kwargsIndex].type, destParamInfo.index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
18166
18188
  canAssign = false;
18167
18189
  }
18168
18190
  destParamMap.delete(paramName);
@@ -18174,7 +18196,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18174
18196
  });
18175
18197
  // If both src and dest have a "**kwargs" parameter, make sure their types are compatible.
18176
18198
  if (srcParamDetails.kwargsIndex !== undefined && destParamDetails.kwargsIndex !== undefined) {
18177
- if (!assignParam(destParamDetails.params[destParamDetails.kwargsIndex].type, srcParamDetails.params[srcParamDetails.kwargsIndex].type, destParamDetails.params[destParamDetails.kwargsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18199
+ if (!assignParam(destParamDetails.params[destParamDetails.kwargsIndex].type, srcParamDetails.params[srcParamDetails.kwargsIndex].type, destParamDetails.params[destParamDetails.kwargsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), constraints, flags, recursionCount)) {
18178
18200
  canAssign = false;
18179
18201
  }
18180
18202
  }
@@ -18197,26 +18219,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18197
18219
  canAssign = false;
18198
18220
  }
18199
18221
  }
18200
- // If the target function was generic and we solved some of the type variables
18201
- // in that generic type, assign them back to the destination typeVar.
18202
- const effectiveSrcConstraints = reverseMatching ? destConstraints : srcConstraints;
18203
- if (!effectiveSrcConstraints.isEmpty()) {
18204
- const srcConstraintSet = effectiveSrcConstraints.getMainConstraintSet();
18205
- const solutionSet = (0, constraintSolver_1.solveConstraints)(evaluatorInterface, effectiveSrcConstraints).getMainSolutionSet();
18206
- srcConstraintSet.doForEachTypeVar((entry) => {
18207
- const solvedValue = solutionSet.getType(entry.typeVar);
18208
- if (solvedValue) {
18209
- assignType(entry.typeVar, solvedValue,
18210
- /* diag */ undefined, destConstraints, srcConstraints, 0 /* AssignTypeFlags.Default */, recursionCount);
18211
- }
18212
- });
18213
- }
18214
18222
  // Are we assigning to a function with a ParamSpec?
18215
18223
  if (targetIncludesParamSpec) {
18216
- const effectiveSrcType = reverseMatching ? destType : srcType;
18217
- const effectiveDestType = reverseMatching ? srcType : destType;
18218
- const effectiveSrcParamSpec = reverseMatching ? destParamSpec : srcParamSpec;
18219
- const effectiveDestParamSpec = reverseMatching ? srcParamSpec : destParamSpec;
18224
+ const effectiveSrcType = isContra ? destType : srcType;
18225
+ const effectiveDestType = isContra ? srcType : destType;
18226
+ const effectiveSrcParamSpec = isContra ? destParamSpec : srcParamSpec;
18227
+ const effectiveDestParamSpec = isContra ? srcParamSpec : destParamSpec;
18220
18228
  if (effectiveDestParamSpec) {
18221
18229
  const requiredMatchParamCount = effectiveDestType.shared.parameters.filter((p, i) => {
18222
18230
  if (!p.name) {
@@ -18265,15 +18273,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18265
18273
  if (effectiveSrcParamSpec) {
18266
18274
  types_1.FunctionType.addParamSpecVariadics(remainingFunction, (0, typeUtils_1.convertToInstance)(effectiveSrcParamSpec));
18267
18275
  }
18268
- if (!assignType(effectiveDestParamSpec, remainingFunction,
18269
- /* diag */ undefined, destConstraints, srcConstraints, flags)) {
18276
+ if (!assignType(effectiveDestParamSpec, remainingFunction, /* diag */ undefined, constraints, flags)) {
18270
18277
  // If we couldn't assign the function to the ParamSpec, see if we can
18271
18278
  // assign only the ParamSpec. This is possible if there were no
18272
18279
  // remaining parameters.
18273
18280
  if (remainingParams.length > 0 ||
18274
18281
  !effectiveSrcParamSpec ||
18275
18282
  !assignType((0, typeUtils_1.convertToInstance)(effectiveDestParamSpec), (0, typeUtils_1.convertToInstance)(effectiveSrcParamSpec),
18276
- /* diag */ undefined, destConstraints, srcConstraints, flags)) {
18283
+ /* diag */ undefined, constraints, flags)) {
18277
18284
  canAssign = false;
18278
18285
  }
18279
18286
  }
@@ -18282,9 +18289,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18282
18289
  }
18283
18290
  // Match the return parameter.
18284
18291
  if (checkReturnType) {
18285
- const destReturnType = getFunctionEffectiveReturnType(destType);
18292
+ const destReturnType = getEffectiveReturnType(destType);
18286
18293
  if (!(0, types_1.isAnyOrUnknown)(destReturnType)) {
18287
- const srcReturnType = solveAndApplyConstraints(getFunctionEffectiveReturnType(srcType), srcConstraints);
18294
+ const srcReturnType = solveAndApplyConstraints(getEffectiveReturnType(srcType), constraints);
18288
18295
  const returnDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
18289
18296
  let isReturnTypeCompatible = false;
18290
18297
  let effectiveFlags = flags;
@@ -18295,7 +18302,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18295
18302
  (0, typeUtils_1.containsLiteralType)(srcType.shared.declaredReturnType, /* includeTypeArgs */ true)) {
18296
18303
  effectiveFlags |= 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */;
18297
18304
  }
18298
- if (assignType(destReturnType, srcReturnType, returnDiag === null || returnDiag === void 0 ? void 0 : returnDiag.createAddendum(), destConstraints, srcConstraints, effectiveFlags, recursionCount)) {
18305
+ if (assignType(destReturnType, srcReturnType, returnDiag === null || returnDiag === void 0 ? void 0 : returnDiag.createAddendum(), constraints, effectiveFlags, recursionCount)) {
18299
18306
  isReturnTypeCompatible = true;
18300
18307
  }
18301
18308
  else {
@@ -18306,7 +18313,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18306
18313
  types_1.ClassType.isBuiltIn(srcReturnType, ['TypeGuard', 'TypeIs']) &&
18307
18314
  boolClass &&
18308
18315
  (0, types_1.isInstantiableClass)(boolClass)) {
18309
- if (assignType(destReturnType, types_1.ClassType.cloneAsInstance(boolClass), returnDiag === null || returnDiag === void 0 ? void 0 : returnDiag.createAddendum(), destConstraints, srcConstraints, flags, recursionCount)) {
18316
+ if (assignType(destReturnType, types_1.ClassType.cloneAsInstance(boolClass), returnDiag === null || returnDiag === void 0 ? void 0 : returnDiag.createAddendum(), constraints, flags, recursionCount)) {
18310
18317
  isReturnTypeCompatible = true;
18311
18318
  }
18312
18319
  }
@@ -18322,9 +18329,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18322
18329
  }
18323
18330
  }
18324
18331
  }
18325
- // Apply any solved source TypeVars to the dest TypeVar solutions. This
18326
- // allows for higher-order functions to accept generic callbacks.
18327
- (0, typeUtils_1.applySourceContextTypeVars)(destConstraints, (0, constraintSolver_1.solveConstraints)(evaluatorInterface, srcConstraints));
18328
18332
  return canAssign;
18329
18333
  }
18330
18334
  // If the declaredType contains type arguments that are "Any" and
@@ -18470,7 +18474,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18470
18474
  function validateOverrideMethod(baseMethod, overrideMethod, baseClass, diag, enforceParamNames = true) {
18471
18475
  // If we're overriding a non-method with a method, report it as an error.
18472
18476
  // This occurs when a non-property overrides a property.
18473
- if (!(0, types_1.isFunction)(baseMethod) && !(0, types_1.isOverloadedFunction)(baseMethod)) {
18477
+ if (!(0, types_1.isFunction)(baseMethod) && !(0, types_1.isOverloaded)(baseMethod)) {
18474
18478
  diag.addMessage(localize_1.LocAddendum.overrideType().format({ type: printType(baseMethod) }));
18475
18479
  return false;
18476
18480
  }
@@ -18479,9 +18483,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18479
18483
  if ((0, types_1.isFunction)(overrideMethod)) {
18480
18484
  return validateOverrideMethodInternal(baseMethod, overrideMethod, diag, enforceParamNames);
18481
18485
  }
18486
+ const overloadsAndImpl = [...types_1.OverloadedType.getOverloads(overrideMethod)];
18487
+ const impl = types_1.OverloadedType.getImplementation(overrideMethod);
18488
+ if (impl && (0, types_1.isFunction)(impl)) {
18489
+ overloadsAndImpl.push(impl);
18490
+ }
18482
18491
  // For an overload overriding a base method, at least one overload
18483
18492
  // or the implementation must be compatible with the base method.
18484
- if (overrideMethod.priv.overloads.some((overrideOverload) => {
18493
+ if (overloadsAndImpl.some((overrideOverload) => {
18485
18494
  return validateOverrideMethodInternal(baseMethod, overrideOverload,
18486
18495
  /* diag */ undefined, enforceParamNames);
18487
18496
  })) {
@@ -18493,7 +18502,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18493
18502
  // For a non-overloaded method overriding an overloaded method, the
18494
18503
  // override must match all of the overloads.
18495
18504
  if ((0, types_1.isFunction)(overrideMethod)) {
18496
- return types_1.OverloadedFunctionType.getOverloads(baseMethod).every((overload) => {
18505
+ return types_1.OverloadedType.getOverloads(baseMethod).every((overload) => {
18497
18506
  // If the override isn't applicable for this base class, skip the check.
18498
18507
  if (baseClass && !isOverrideMethodApplicable(overload, baseClass)) {
18499
18508
  return true;
@@ -18505,8 +18514,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18505
18514
  // must all match and be in the correct order. It is OK if the base method
18506
18515
  // has additional overloads that are not present in the override.
18507
18516
  let previousMatchIndex = -1;
18508
- const baseOverloads = types_1.OverloadedFunctionType.getOverloads(baseMethod);
18509
- for (const overrideOverload of types_1.OverloadedFunctionType.getOverloads(overrideMethod)) {
18517
+ const baseOverloads = types_1.OverloadedType.getOverloads(baseMethod);
18518
+ for (const overrideOverload of types_1.OverloadedType.getOverloads(overrideMethod)) {
18510
18519
  let possibleMatchIndex;
18511
18520
  let matchIndex = baseOverloads.findIndex((baseOverload, index) => {
18512
18521
  // If the override isn't applicable for this base class, skip the check.
@@ -18580,8 +18589,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18580
18589
  : childClass;
18581
18590
  return assignType(baseParamDetails.params[0].type, childSelfOrClsType,
18582
18591
  /* diag */ undefined,
18583
- /* destConstraints */ undefined,
18584
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */);
18592
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */);
18585
18593
  }
18586
18594
  // Determines whether the override method is compatible with the overridden method.
18587
18595
  // This is used both for parent/child overrides and implicit overrides for peer
@@ -18627,8 +18635,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18627
18635
  const overrideArgsType = overrideParamDetails.params[overrideParamDetails.argsIndex].type;
18628
18636
  for (let i = overrideParamDetails.positionParamCount; i < baseParamDetails.positionParamCount; i++) {
18629
18637
  if (!assignType(overrideArgsType, baseParamDetails.params[i].type, diag === null || diag === void 0 ? void 0 : diag.createAddendum(),
18630
- /* destConstraints */ undefined,
18631
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18638
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18632
18639
  localize_1.LocAddendum.overrideParamType().format({
18633
18640
  index: i + 1,
18634
18641
  baseType: printType(baseParamDetails.params[i].type),
@@ -18717,8 +18724,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18717
18724
  if (!exemptSelfClsParam || (!baseIsSynthesizedTypeVar && !overrideIsSynthesizedTypeVar)) {
18718
18725
  if (baseParam.category !== overrideParam.category ||
18719
18726
  !assignType(overrideParamType, baseParamType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(),
18720
- /* destConstraints */ undefined,
18721
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18727
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18722
18728
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideParamType().format({
18723
18729
  index: i + 1,
18724
18730
  baseType: printType(baseParamType),
@@ -18761,8 +18767,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18761
18767
  const overrideParamType = overrideParamDetails.params[overrideParamDetails.argsIndex].type;
18762
18768
  const baseParamType = baseParamDetails.params[baseParamDetails.argsIndex].type;
18763
18769
  if (!assignType(overrideParamType, baseParamType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(),
18764
- /* destConstraints */ undefined,
18765
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18770
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18766
18771
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideParamKeywordType().format({
18767
18772
  name: (_b = overrideParamDetails.params[overrideParamDetails.argsIndex].param.name) !== null && _b !== void 0 ? _b : '?',
18768
18773
  baseType: printType(baseParamType),
@@ -18790,8 +18795,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18790
18795
  targetParamType = overrideParamDetails.params[overrideParamDetails.kwargsIndex].type;
18791
18796
  }
18792
18797
  if (!assignType(targetParamType, paramInfo.type, diag === null || diag === void 0 ? void 0 : diag.createAddendum(),
18793
- /* destConstraints */ undefined,
18794
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18798
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18795
18799
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideParamKeywordType().format({
18796
18800
  name: (_b = paramInfo.param.name) !== null && _b !== void 0 ? _b : '?',
18797
18801
  baseType: printType(paramInfo.type),
@@ -18847,11 +18851,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18847
18851
  }
18848
18852
  }
18849
18853
  // Now check the return type.
18850
- const baseReturnType = getFunctionEffectiveReturnType(baseMethod);
18851
- const overrideReturnType = getFunctionEffectiveReturnType(overrideMethod);
18854
+ const baseReturnType = getEffectiveReturnType(baseMethod);
18855
+ const overrideReturnType = getEffectiveReturnType(overrideMethod);
18852
18856
  if (!assignType(baseReturnType, overrideReturnType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(),
18853
- /* destConstraints */ undefined,
18854
- /* srcConstraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18857
+ /* constraints */ undefined, 0 /* AssignTypeFlags.Default */)) {
18855
18858
  diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.overrideReturnType().format({
18856
18859
  baseType: printType(baseReturnType),
18857
18860
  overrideType: printType(overrideReturnType),
@@ -18883,8 +18886,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
18883
18886
  // If there's a bound type, make sure the source is derived from it.
18884
18887
  if (destType.shared.boundType && !(0, typeUtils_1.isTypeAliasPlaceholder)(effectiveSrcType)) {
18885
18888
  if (!assignType(destType.shared.boundType, effectiveSrcType, diag.createAddendum(),
18886
- /* destConstraints */ undefined,
18887
- /* srcConstraints */ undefined)) {
18889
+ /* constraints */ undefined)) {
18888
18890
  // Avoid adding a message that will confuse users if the TypeVar was
18889
18891
  // synthesized for internal purposes.
18890
18892
  if (!destType.shared.isSynthesized) {
@@ -19054,8 +19056,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19054
19056
  }
19055
19057
  else {
19056
19058
  const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
19057
- if (!assignType(memberTypeFirstParamType, firstParamType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), constraints,
19058
- /* srcConstraints */ undefined, 8192 /* AssignTypeFlags.AllowUnspecifiedTypeArgs */, recursionCount)) {
19059
+ if (!assignType(memberTypeFirstParamType, firstParamType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), constraints, 8192 /* AssignTypeFlags.AllowUnspecifiedTypeArgs */, recursionCount)) {
19059
19060
  if (memberTypeFirstParam.name &&
19060
19061
  !types_1.FunctionParam.isNameSynthesized(memberTypeFirstParam) &&
19061
19062
  types_1.FunctionParam.isTypeDeclared(memberTypeFirstParam)) {
@@ -19073,7 +19074,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19073
19074
  }
19074
19075
  // Get the effective return type, which will have the side effect of lazily
19075
19076
  // evaluating (and caching) the inferred return type if there is no defined return type.
19076
- getFunctionEffectiveReturnType(memberType);
19077
+ getEffectiveReturnType(memberType);
19077
19078
  const specializedFunction = solveAndApplyConstraints(memberType, constraints);
19078
19079
  return types_1.FunctionType.clone(specializedFunction, stripFirstParam, baseType);
19079
19080
  }
@@ -19193,11 +19194,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19193
19194
  return false;
19194
19195
  }
19195
19196
  function printObjectTypeForClass(type) {
19196
- return TypePrinter.printObjectTypeForClass(type, evaluatorOptions.printTypeFlags, getFunctionEffectiveReturnType);
19197
+ return TypePrinter.printObjectTypeForClass(type, evaluatorOptions.printTypeFlags, getEffectiveReturnType);
19197
19198
  }
19198
19199
  function printFunctionParts(type, extraFlags) {
19199
19200
  const flags = extraFlags ? evaluatorOptions.printTypeFlags | extraFlags : evaluatorOptions.printTypeFlags;
19200
- return TypePrinter.printFunctionParts(type, flags, getFunctionEffectiveReturnType);
19201
+ return TypePrinter.printFunctionParts(type, flags, getEffectiveReturnType);
19201
19202
  }
19202
19203
  // Prints two types and determines whether they need to be output in
19203
19204
  // fully-qualified form for disambiguation.
@@ -19237,7 +19238,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19237
19238
  if (options === null || options === void 0 ? void 0 : options.useFullyQualifiedNames) {
19238
19239
  flags |= 4096 /* TypePrinter.PrintTypeFlags.UseFullyQualifiedNames */;
19239
19240
  }
19240
- return TypePrinter.printType(type, flags, getFunctionEffectiveReturnType);
19241
+ return TypePrinter.printType(type, flags, getEffectiveReturnType);
19241
19242
  }
19242
19243
  // Calls back into the parser to parse the contents of a string literal.
19243
19244
  // This is unfortunately needed in some cases — specifically where the
@@ -19298,7 +19299,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19298
19299
  return codeFlowEngine.printControlFlowGraph(flowNode, reference, callName, logger);
19299
19300
  }
19300
19301
  // Track these apis internal usages when logging is on. otherwise, it should be noop.
19301
- const getFunctionInferredReturnType = wrapWithLogger(_getFunctionInferredReturnType);
19302
+ const getFunctionInferredReturnType = wrapWithLogger(_getInferredReturnType);
19302
19303
  const evaluatorInterface = {
19303
19304
  runWithCancellationToken,
19304
19305
  getType,
@@ -19355,7 +19356,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19355
19356
  getEffectiveTypeOfSymbolForUsage,
19356
19357
  getInferredTypeOfDeclaration,
19357
19358
  getDeclaredTypeForExpression,
19358
- getFunctionDeclaredReturnType,
19359
+ getFunctionDeclaredReturnType: getDeclaredReturnType,
19359
19360
  getFunctionInferredReturnType,
19360
19361
  getBestOverloadForArgs,
19361
19362
  getBuiltInType,
@@ -19408,5 +19409,4 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
19408
19409
  const codeFlowEngine = (0, codeFlowEngine_1.getCodeFlowEngine)(evaluatorInterface, speculativeTypeTracker);
19409
19410
  return evaluatorInterface;
19410
19411
  }
19411
- exports.createTypeEvaluator = createTypeEvaluator;
19412
19412
  //# sourceMappingURL=typeEvaluator.js.map