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

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 (593) hide show
  1. package/dist/analyzer/analysis.js +4 -1
  2. package/dist/analyzer/analysis.js.map +1 -1
  3. package/dist/analyzer/analyzerFileInfo.js.map +1 -1
  4. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  5. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  6. package/dist/analyzer/binder.js +1 -0
  7. package/dist/analyzer/binder.js.map +1 -1
  8. package/dist/analyzer/cacheManager.js.map +1 -1
  9. package/dist/analyzer/checker.d.ts +1 -2
  10. package/dist/analyzer/checker.js +251 -121
  11. package/dist/analyzer/checker.js.map +1 -1
  12. package/dist/analyzer/circularDependency.js.map +1 -1
  13. package/dist/analyzer/codeFlowEngine.js +29 -3
  14. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  15. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  16. package/dist/analyzer/codeFlowUtils.js.map +1 -1
  17. package/dist/analyzer/commentUtils.js.map +1 -1
  18. package/dist/analyzer/constraintSolver.d.ts +2 -2
  19. package/dist/analyzer/constraintSolver.js +28 -6
  20. package/dist/analyzer/constraintSolver.js.map +1 -1
  21. package/dist/analyzer/constructorTransform.js.map +1 -1
  22. package/dist/analyzer/constructors.js.map +1 -1
  23. package/dist/analyzer/dataClasses.js +6 -6
  24. package/dist/analyzer/dataClasses.js.map +1 -1
  25. package/dist/analyzer/declaration.js.map +1 -1
  26. package/dist/analyzer/declarationUtils.js.map +1 -1
  27. package/dist/analyzer/decorators.js +6 -6
  28. package/dist/analyzer/decorators.js.map +1 -1
  29. package/dist/analyzer/deprecatedSymbols.js.map +1 -1
  30. package/dist/analyzer/docStringConversion.js.map +1 -1
  31. package/dist/analyzer/docStringUtils.js.map +1 -1
  32. package/dist/analyzer/enums.d.ts +4 -1
  33. package/dist/analyzer/enums.js +30 -16
  34. package/dist/analyzer/enums.js.map +1 -1
  35. package/dist/analyzer/functionTransform.js.map +1 -1
  36. package/dist/analyzer/importResolver.js +12 -4
  37. package/dist/analyzer/importResolver.js.map +1 -1
  38. package/dist/analyzer/importResult.js.map +1 -1
  39. package/dist/analyzer/importStatementUtils.js +2 -0
  40. package/dist/analyzer/importStatementUtils.js.map +1 -1
  41. package/dist/analyzer/namedTuples.js +1 -1
  42. package/dist/analyzer/namedTuples.js.map +1 -1
  43. package/dist/analyzer/operations.js +6 -0
  44. package/dist/analyzer/operations.js.map +1 -1
  45. package/dist/analyzer/packageTypeReport.js.map +1 -1
  46. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  47. package/dist/analyzer/parameterUtils.d.ts +1 -0
  48. package/dist/analyzer/parameterUtils.js +16 -2
  49. package/dist/analyzer/parameterUtils.js.map +1 -1
  50. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  51. package/dist/analyzer/parseTreeCleaner.js.map +1 -1
  52. package/dist/analyzer/parseTreeUtils.d.ts +1 -0
  53. package/dist/analyzer/parseTreeUtils.js +4 -3
  54. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  55. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  56. package/dist/analyzer/patternMatching.js +90 -61
  57. package/dist/analyzer/patternMatching.js.map +1 -1
  58. package/dist/analyzer/program.d.ts +1 -1
  59. package/dist/analyzer/program.js +2 -2
  60. package/dist/analyzer/program.js.map +1 -1
  61. package/dist/analyzer/properties.js +2 -2
  62. package/dist/analyzer/properties.js.map +1 -1
  63. package/dist/analyzer/protocols.js.map +1 -1
  64. package/dist/analyzer/pyTypedUtils.js.map +1 -1
  65. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  66. package/dist/analyzer/scope.js.map +1 -1
  67. package/dist/analyzer/scopeUtils.js.map +1 -1
  68. package/dist/analyzer/service.js.map +1 -1
  69. package/dist/analyzer/sourceFile.js +4 -4
  70. package/dist/analyzer/sourceFile.js.map +1 -1
  71. package/dist/analyzer/sourceFileInfo.js +1 -1
  72. package/dist/analyzer/sourceFileInfo.js.map +1 -1
  73. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  74. package/dist/analyzer/sourceMapper.js.map +1 -1
  75. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  76. package/dist/analyzer/staticExpressions.js.map +1 -1
  77. package/dist/analyzer/symbol.js.map +1 -1
  78. package/dist/analyzer/symbolNameUtils.js.map +1 -1
  79. package/dist/analyzer/symbolUtils.js.map +1 -1
  80. package/dist/analyzer/testWalker.js.map +1 -1
  81. package/dist/analyzer/tracePrinter.js.map +1 -1
  82. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  83. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  84. package/dist/analyzer/typeEvaluator.js +433 -334
  85. package/dist/analyzer/typeEvaluator.js.map +1 -1
  86. package/dist/analyzer/typeEvaluatorTypes.d.ts +1 -0
  87. package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
  88. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  89. package/dist/analyzer/typeGuards.js +10 -5
  90. package/dist/analyzer/typeGuards.js.map +1 -1
  91. package/dist/analyzer/typePrinter.js +1 -1
  92. package/dist/analyzer/typePrinter.js.map +1 -1
  93. package/dist/analyzer/typeStubWriter.js.map +1 -1
  94. package/dist/analyzer/typeUtils.d.ts +0 -1
  95. package/dist/analyzer/typeUtils.js +22 -8
  96. package/dist/analyzer/typeUtils.js.map +1 -1
  97. package/dist/analyzer/typeVarContext.d.ts +2 -2
  98. package/dist/analyzer/typeVarContext.js +10 -4
  99. package/dist/analyzer/typeVarContext.js.map +1 -1
  100. package/dist/analyzer/typeWalker.js.map +1 -1
  101. package/dist/analyzer/typedDicts.d.ts +6 -3
  102. package/dist/analyzer/typedDicts.js +292 -65
  103. package/dist/analyzer/typedDicts.js.map +1 -1
  104. package/dist/analyzer/types.d.ts +38 -26
  105. package/dist/analyzer/types.js +99 -72
  106. package/dist/analyzer/types.js.map +1 -1
  107. package/dist/backgroundAnalysis.js.map +1 -1
  108. package/dist/backgroundAnalysisBase.js.map +1 -1
  109. package/dist/backgroundThreadBase.js.map +1 -1
  110. package/dist/commands/commandController.js.map +1 -1
  111. package/dist/commands/commandResult.js.map +1 -1
  112. package/dist/commands/commands.js.map +1 -1
  113. package/dist/commands/createTypeStub.js.map +1 -1
  114. package/dist/commands/dumpFileDebugInfoCommand.js +18 -18
  115. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  116. package/dist/commands/quickActionCommand.js.map +1 -1
  117. package/dist/commands/restartServer.js.map +1 -1
  118. package/dist/common/cancellationUtils.d.ts +6 -1
  119. package/dist/common/cancellationUtils.js +18 -4
  120. package/dist/common/cancellationUtils.js.map +1 -1
  121. package/dist/common/charCodes.js.map +1 -1
  122. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  123. package/dist/common/collectionUtils.js.map +1 -1
  124. package/dist/common/commandLineOptions.js.map +1 -1
  125. package/dist/common/commandUtils.js.map +1 -1
  126. package/dist/common/configOptions.js.map +1 -1
  127. package/dist/common/console.js.map +1 -1
  128. package/dist/common/core.js.map +1 -1
  129. package/dist/common/crypto.js.map +1 -1
  130. package/dist/common/debug.js.map +1 -1
  131. package/dist/common/deferred.js.map +1 -1
  132. package/dist/common/diagnostic.js.map +1 -1
  133. package/dist/common/diagnosticRules.js.map +1 -1
  134. package/dist/common/diagnosticSink.js.map +1 -1
  135. package/dist/common/editAction.js.map +1 -1
  136. package/dist/common/envVarUtils.d.ts +2 -1
  137. package/dist/common/envVarUtils.js +5 -1
  138. package/dist/common/envVarUtils.js.map +1 -1
  139. package/dist/common/extensibility.js.map +1 -1
  140. package/dist/common/extensions.js.map +1 -1
  141. package/dist/common/fileBasedCancellationUtils.js.map +1 -1
  142. package/dist/common/fileSystem.js.map +1 -1
  143. package/dist/common/fileWatcher.js.map +1 -1
  144. package/dist/common/fullAccessHost.js +1 -1
  145. package/dist/common/fullAccessHost.js.map +1 -1
  146. package/dist/common/host.js.map +1 -1
  147. package/dist/common/logTracker.js.map +1 -1
  148. package/dist/common/lspUtils.js.map +1 -1
  149. package/dist/common/memUtils.js.map +1 -1
  150. package/dist/common/pathConsts.js.map +1 -1
  151. package/dist/common/pathUtils.js.map +1 -1
  152. package/dist/common/positionUtils.js.map +1 -1
  153. package/dist/common/progressReporter.js.map +1 -1
  154. package/dist/common/pythonVersion.js.map +1 -1
  155. package/dist/common/realFileSystem.js +1 -1
  156. package/dist/common/realFileSystem.js.map +1 -1
  157. package/dist/common/serviceProvider.js.map +1 -1
  158. package/dist/common/serviceProviderExtensions.js.map +1 -1
  159. package/dist/common/stringUtils.js.map +1 -1
  160. package/dist/common/textEditTracker.js.map +1 -1
  161. package/dist/common/textRange.js.map +1 -1
  162. package/dist/common/textRangeCollection.js.map +1 -1
  163. package/dist/common/timing.js.map +1 -1
  164. package/dist/common/uri/baseUri.d.ts +2 -0
  165. package/dist/common/uri/baseUri.js +7 -7
  166. package/dist/common/uri/baseUri.js.map +1 -1
  167. package/dist/common/uri/emptyUri.d.ts +2 -0
  168. package/dist/common/uri/emptyUri.js +6 -0
  169. package/dist/common/uri/emptyUri.js.map +1 -1
  170. package/dist/common/uri/fileUri.d.ts +6 -4
  171. package/dist/common/uri/fileUri.js +18 -9
  172. package/dist/common/uri/fileUri.js.map +1 -1
  173. package/dist/common/uri/memoization.js.map +1 -1
  174. package/dist/common/uri/uri.d.ts +8 -0
  175. package/dist/common/uri/uri.js +16 -7
  176. package/dist/common/uri/uri.js.map +1 -1
  177. package/dist/common/uri/uriUtils.js.map +1 -1
  178. package/dist/common/uri/webUri.d.ts +3 -1
  179. package/dist/common/uri/webUri.js +21 -8
  180. package/dist/common/uri/webUri.js.map +1 -1
  181. package/dist/common/workspaceEditUtils.js.map +1 -1
  182. package/dist/languageServerBase.js.map +1 -1
  183. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  184. package/dist/languageService/autoImporter.d.ts +1 -0
  185. package/dist/languageService/autoImporter.js +3 -1
  186. package/dist/languageService/autoImporter.js.map +1 -1
  187. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  188. package/dist/languageService/codeActionProvider.js.map +1 -1
  189. package/dist/languageService/completionProvider.js +11 -3
  190. package/dist/languageService/completionProvider.js.map +1 -1
  191. package/dist/languageService/completionProviderUtils.js.map +1 -1
  192. package/dist/languageService/definitionProvider.js.map +1 -1
  193. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  194. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  195. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  196. package/dist/languageService/hoverProvider.js +1 -1
  197. package/dist/languageService/hoverProvider.js.map +1 -1
  198. package/dist/languageService/importSorter.js.map +1 -1
  199. package/dist/languageService/navigationUtils.js.map +1 -1
  200. package/dist/languageService/quickActions.js.map +1 -1
  201. package/dist/languageService/referencesProvider.js +11 -1
  202. package/dist/languageService/referencesProvider.js.map +1 -1
  203. package/dist/languageService/renameProvider.js.map +1 -1
  204. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  205. package/dist/languageService/symbolIndexer.js.map +1 -1
  206. package/dist/languageService/tooltipUtils.js.map +1 -1
  207. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  208. package/dist/localization/localize.d.ts +45 -3
  209. package/dist/localization/localize.js +16 -3
  210. package/dist/localization/localize.js.map +1 -1
  211. package/dist/localization/package.nls.cs.json +15 -9
  212. package/dist/localization/package.nls.de.json +17 -11
  213. package/dist/localization/package.nls.en-us.json +25 -12
  214. package/dist/localization/package.nls.es.json +16 -10
  215. package/dist/localization/package.nls.fr.json +16 -10
  216. package/dist/localization/package.nls.it.json +16 -10
  217. package/dist/localization/package.nls.ja.json +17 -11
  218. package/dist/localization/package.nls.ko.json +14 -8
  219. package/dist/localization/package.nls.pl.json +14 -8
  220. package/dist/localization/package.nls.pt-br.json +17 -11
  221. package/dist/localization/package.nls.qps-ploc.json +12 -6
  222. package/dist/localization/package.nls.ru.json +17 -11
  223. package/dist/localization/package.nls.tr.json +16 -10
  224. package/dist/localization/package.nls.zh-cn.json +17 -11
  225. package/dist/localization/package.nls.zh-tw.json +17 -11
  226. package/dist/nodeMain.js.map +1 -1
  227. package/dist/nodeServer.js.map +1 -1
  228. package/dist/parser/characterStream.js.map +1 -1
  229. package/dist/parser/characters.js.map +1 -1
  230. package/dist/parser/parseNodes.js.map +1 -1
  231. package/dist/parser/parser.js.map +1 -1
  232. package/dist/parser/stringTokenUtils.js.map +1 -1
  233. package/dist/parser/tokenizer.js.map +1 -1
  234. package/dist/parser/tokenizerTypes.js.map +1 -1
  235. package/dist/parser/unicode.js.map +1 -1
  236. package/dist/pprof/profiler.js.map +1 -1
  237. package/dist/pyright.js.map +1 -1
  238. package/dist/pyrightFileSystem.js.map +1 -1
  239. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  240. package/dist/server.d.ts +2 -1
  241. package/dist/server.js +9 -7
  242. package/dist/server.js.map +1 -1
  243. package/dist/tests/cacheManager.test.js.map +1 -1
  244. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  245. package/dist/tests/checker.test.js +0 -4
  246. package/dist/tests/checker.test.js.map +1 -1
  247. package/dist/tests/classDeclaration.test.js.map +1 -1
  248. package/dist/tests/collectionUtils.test.js.map +1 -1
  249. package/dist/tests/common.test.js.map +1 -1
  250. package/dist/tests/completions.test.js +23 -0
  251. package/dist/tests/completions.test.js.map +1 -1
  252. package/dist/tests/config.test.js +1 -2
  253. package/dist/tests/config.test.js.map +1 -1
  254. package/dist/tests/debug.test.js.map +1 -1
  255. package/dist/tests/deferred.test.js.map +1 -1
  256. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  257. package/dist/tests/diagnostics.test.js.map +1 -1
  258. package/dist/tests/docStringConversion.test.js.map +1 -1
  259. package/dist/tests/docStringUtils.test.js.map +1 -1
  260. package/dist/tests/documentSymbolCollector.test.js.map +1 -1
  261. package/dist/tests/envVarUtils.test.d.ts +1 -0
  262. package/dist/tests/envVarUtils.test.js +130 -0
  263. package/dist/tests/envVarUtils.test.js.map +1 -0
  264. package/dist/tests/filesystem.test.js.map +1 -1
  265. package/dist/tests/fourSlashParser.test.js.map +1 -1
  266. package/dist/tests/fourSlashRunner.test.js.map +1 -1
  267. package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -1
  268. package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -1
  269. package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js.map +1 -1
  270. package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js.map +1 -1
  271. package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -1
  272. package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -1
  273. package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -1
  274. package/dist/tests/fourslash/completions.autoimport.lib.alias.fourslash.js.map +1 -1
  275. package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -1
  276. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  277. package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -1
  278. package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -1
  279. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  280. package/dist/tests/fourslash/completions.builtinOverride.fourslash.js.map +1 -1
  281. package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -1
  282. package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
  283. package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
  284. package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
  285. package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
  286. package/dist/tests/fourslash/completions.comment.fourslash.js.map +1 -1
  287. package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -1
  288. package/dist/tests/fourslash/completions.declNames.exception.fourslash.js.map +1 -1
  289. package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -1
  290. package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js.map +1 -1
  291. package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -1
  292. package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -1
  293. package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -1
  294. package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -1
  295. package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -1
  296. package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
  297. package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
  298. package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -1
  299. package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
  300. package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -1
  301. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -1
  302. package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -1
  303. package/dist/tests/fourslash/completions.enums.members.fourslash.js.map +1 -1
  304. package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -1
  305. package/dist/tests/fourslash/completions.excluded.fourslash.js.map +1 -1
  306. package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
  307. package/dist/tests/fourslash/completions.fstring.fourslash.js.map +1 -1
  308. package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
  309. package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js.map +1 -1
  310. package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +1 -1
  311. package/dist/tests/fourslash/completions.importInterimFile.fourslash.disabled.js.map +1 -1
  312. package/dist/tests/fourslash/completions.importPrivateNoPytyped.fourslash.js.map +1 -1
  313. package/dist/tests/fourslash/completions.importPytyped.fourslash.js.map +1 -1
  314. package/dist/tests/fourslash/completions.importPytypedLocal.fourslash.js.map +1 -1
  315. package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +1 -1
  316. package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js.map +1 -1
  317. package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -1
  318. package/dist/tests/fourslash/completions.included.fourslash.js.map +1 -1
  319. package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -1
  320. package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js.map +1 -1
  321. package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -1
  322. package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -1
  323. package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js.map +1 -1
  324. package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js.map +1 -1
  325. package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -1
  326. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
  327. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
  328. package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
  329. package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -1
  330. package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
  331. package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js.map +1 -1
  332. package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js.map +1 -1
  333. package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js.map +1 -1
  334. package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -1
  335. package/dist/tests/fourslash/completions.override.default.fourslash.js.map +1 -1
  336. package/dist/tests/fourslash/completions.override.default.importStub.js.map +1 -1
  337. package/dist/tests/fourslash/completions.override.default.imported.fourslash.js.map +1 -1
  338. package/dist/tests/fourslash/completions.override.default.stub.fourslash.js.map +1 -1
  339. package/dist/tests/fourslash/completions.override.fourslash.js.map +1 -1
  340. package/dist/tests/fourslash/completions.override.property.fourslash.js.map +1 -1
  341. package/dist/tests/fourslash/completions.override.property.stub.fourslash.js.map +1 -1
  342. package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -1
  343. package/dist/tests/fourslash/completions.override.stub.fourslash.js.map +1 -1
  344. package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
  345. package/dist/tests/fourslash/completions.parameters.fourslash.js.map +1 -1
  346. package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -1
  347. package/dist/tests/fourslash/completions.parentFolder.fourslash.js.map +1 -1
  348. package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -1
  349. package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
  350. package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -1
  351. package/dist/tests/fourslash/completions.property.fourslash.js.map +1 -1
  352. package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js.map +1 -1
  353. package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
  354. package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -1
  355. package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
  356. package/dist/tests/fourslash/completions.triggers.fourslash.js.map +1 -1
  357. package/dist/tests/fourslash/completions.typeAlias.fourslash.js.map +1 -1
  358. package/dist/tests/fourslash/completions.typeshed.fourslash.js.map +1 -1
  359. package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -1
  360. package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -1
  361. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
  362. package/dist/tests/fourslash/completions.with.fourslash.js.map +1 -1
  363. package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -1
  364. package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -1
  365. package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -1
  366. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -1
  367. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -1
  368. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -1
  369. package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -1
  370. package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -1
  371. package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -1
  372. package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -1
  373. package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -1
  374. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  375. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -1
  376. package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -1
  377. package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -1
  378. package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -1
  379. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -1
  380. package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -1
  381. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -1
  382. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -1
  383. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -1
  384. package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -1
  385. package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -1
  386. package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -1
  387. package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -1
  388. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -1
  389. package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -1
  390. package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -1
  391. package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -1
  392. package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -1
  393. package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -1
  394. package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -1
  395. package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -1
  396. package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -1
  397. package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -1
  398. package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -1
  399. package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -1
  400. package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -1
  401. package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -1
  402. package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -1
  403. package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -1
  404. package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -1
  405. package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -1
  406. package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -1
  407. package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -1
  408. package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -1
  409. package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -1
  410. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -1
  411. package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -1
  412. package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -1
  413. package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -1
  414. package/dist/tests/fourslash/fourslash.js.map +1 -1
  415. package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -1
  416. package/dist/tests/fourslash/hover.async.fourslash.js.map +1 -1
  417. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  418. package/dist/tests/fourslash/hover.class.docString.fourslash.js.map +1 -1
  419. package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -1
  420. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
  421. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
  422. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
  423. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
  424. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
  425. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
  426. package/dist/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.js.map +1 -1
  427. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
  428. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
  429. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
  430. package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
  431. package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js.map +1 -1
  432. package/dist/tests/fourslash/hover.docstring.parameter.fourslash.js.map +1 -1
  433. package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
  434. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -1
  435. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -1
  436. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -1
  437. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -1
  438. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -1
  439. package/dist/tests/fourslash/hover.formatted.fourslash.js.map +1 -1
  440. package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
  441. package/dist/tests/fourslash/hover.import.django.view.fourslash.js.map +1 -1
  442. package/dist/tests/fourslash/hover.import.fourslash.js.map +1 -1
  443. package/dist/tests/fourslash/hover.inferred.fourslash.js.map +1 -1
  444. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  445. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
  446. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  447. package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -1
  448. package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -1
  449. package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js.map +1 -1
  450. package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js.map +1 -1
  451. package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
  452. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
  453. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
  454. package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
  455. package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js.map +1 -1
  456. package/dist/tests/fourslash/hover.overloadedFunction.fourslash.js.map +1 -1
  457. package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
  458. package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -1
  459. package/dist/tests/fourslash/hover.typedDict.key.fourslash.js.map +1 -1
  460. package/dist/tests/fourslash/hover.unpackedTypedDict.key.fourslash.js.map +1 -1
  461. package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -1
  462. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
  463. package/dist/tests/fourslash/import.multipart.fourslash.js.map +1 -1
  464. package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -1
  465. package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js.map +1 -1
  466. package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js.map +1 -1
  467. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
  468. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
  469. package/dist/tests/fourslash/import.wildcard.fourslash.js.map +1 -1
  470. package/dist/tests/fourslash/importnotresolved.fourslash.js.map +1 -1
  471. package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js.map +1 -1
  472. package/dist/tests/fourslash/missingModuleSource.fourslash.js.map +1 -1
  473. package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -1
  474. package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js.map +1 -1
  475. package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js.map +1 -1
  476. package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js.map +1 -1
  477. package/dist/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.js.map +1 -1
  478. package/dist/tests/fourslash/missingTypeStub.fourslash.js.map +1 -1
  479. package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js.map +1 -1
  480. package/dist/tests/fourslash/noerrors.fourslash.js.map +1 -1
  481. package/dist/tests/fourslash/orderImports1.command.fourslash.js.map +1 -1
  482. package/dist/tests/fourslash/orderImports2.command.fourslash.js.map +1 -1
  483. package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -1
  484. package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -1
  485. package/dist/tests/fourslash/rename.fourslash.js.map +1 -1
  486. package/dist/tests/fourslash/rename.function.untitledFile.fourslash.js.map +1 -1
  487. package/dist/tests/fourslash/rename.init.fourslash.js.map +1 -1
  488. package/dist/tests/fourslash/rename.library.fourslash.js.map +1 -1
  489. package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js.map +1 -1
  490. package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +1 -1
  491. package/dist/tests/fourslash/rename.multipleDecl.fourslash.js.map +1 -1
  492. package/dist/tests/fourslash/rename.parens.fourslash.js.map +1 -1
  493. package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -1
  494. package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -1
  495. package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -1
  496. package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -1
  497. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.js.map +1 -1
  498. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.js.map +1 -1
  499. package/dist/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.js.map +1 -1
  500. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.js.map +1 -1
  501. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.js.map +1 -1
  502. package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.js.map +1 -1
  503. package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -1
  504. package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
  505. package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -1
  506. package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -1
  507. package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
  508. package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -1
  509. package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -1
  510. package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -1
  511. package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -1
  512. package/dist/tests/fourslash/typeVerifier.fourslash.js.map +1 -1
  513. package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
  514. package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
  515. package/dist/tests/harness/fourslash/runner.js +1 -1
  516. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  517. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  518. package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
  519. package/dist/tests/harness/fourslash/testState.d.ts +0 -13
  520. package/dist/tests/harness/fourslash/testState.js +11 -0
  521. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  522. package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
  523. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  524. package/dist/tests/harness/testAccessHost.js.map +1 -1
  525. package/dist/tests/harness/testHost.js.map +1 -1
  526. package/dist/tests/harness/utils.js.map +1 -1
  527. package/dist/tests/harness/vfs/factory.js.map +1 -1
  528. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  529. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  530. package/dist/tests/hoverProvider.test.js.map +1 -1
  531. package/dist/tests/importResolver.test.js.map +1 -1
  532. package/dist/tests/importStatementUtils.test.js +8 -0
  533. package/dist/tests/importStatementUtils.test.js.map +1 -1
  534. package/dist/tests/ipythonMode.test.js.map +1 -1
  535. package/dist/tests/languageServer.test.d.ts +1 -0
  536. package/dist/tests/languageServer.test.js +137 -0
  537. package/dist/tests/languageServer.test.js.map +1 -0
  538. package/dist/tests/localizer.test.js.map +1 -1
  539. package/dist/tests/logger.test.js.map +1 -1
  540. package/dist/tests/lsp/customLsp.d.ts +112 -0
  541. package/dist/tests/lsp/customLsp.js +67 -0
  542. package/dist/tests/lsp/customLsp.js.map +1 -0
  543. package/dist/tests/lsp/languageServer.d.ts +1 -0
  544. package/dist/tests/lsp/languageServer.js +326 -0
  545. package/dist/tests/lsp/languageServer.js.map +1 -0
  546. package/dist/tests/lsp/languageServerTestUtils.d.ts +100 -0
  547. package/dist/tests/lsp/languageServerTestUtils.js +803 -0
  548. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -0
  549. package/dist/tests/lsp/main.d.ts +1 -0
  550. package/dist/tests/lsp/main.js +12 -0
  551. package/dist/tests/lsp/main.js.map +1 -0
  552. package/dist/tests/lsp/webpack.testserver.config.d.ts +4 -0
  553. package/dist/tests/lsp/webpack.testserver.config.js +64 -0
  554. package/dist/tests/lsp/webpack.testserver.config.js.map +1 -0
  555. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  556. package/dist/tests/parser.test.js.map +1 -1
  557. package/dist/tests/pathUtils.test.js.map +1 -1
  558. package/dist/tests/positionUtils.test.js.map +1 -1
  559. package/dist/tests/pyrightFileSystem.test.js.map +1 -1
  560. package/dist/tests/serialization.test.js.map +1 -1
  561. package/dist/tests/service.test.js.map +1 -1
  562. package/dist/tests/signatureHelp.test.js.map +1 -1
  563. package/dist/tests/sourceFile.test.js.map +1 -1
  564. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  565. package/dist/tests/stringUtils.test.js.map +1 -1
  566. package/dist/tests/symbolNameUtils.test.js.map +1 -1
  567. package/dist/tests/testState.test.js.map +1 -1
  568. package/dist/tests/testStateUtils.js.map +1 -1
  569. package/dist/tests/testUtils.js.map +1 -1
  570. package/dist/tests/textEditUtil.test.js.map +1 -1
  571. package/dist/tests/textRange.test.js.map +1 -1
  572. package/dist/tests/tokenizer.test.js.map +1 -1
  573. package/dist/tests/typeEvaluator1.test.js +21 -5
  574. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  575. package/dist/tests/typeEvaluator2.test.js +8 -4
  576. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  577. package/dist/tests/typeEvaluator3.test.js +5 -9
  578. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  579. package/dist/tests/typeEvaluator4.test.js +1 -1
  580. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  581. package/dist/tests/typeEvaluator5.test.js +43 -1
  582. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  583. package/dist/tests/typePrinter.test.js.map +1 -1
  584. package/dist/tests/uri.test.js +74 -26
  585. package/dist/tests/uri.test.js.map +1 -1
  586. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  587. package/dist/tests/zipfs.test.js.map +1 -1
  588. package/dist/workspaceFactory.js +2 -1
  589. package/dist/workspaceFactory.js.map +1 -1
  590. package/package.json +23 -15
  591. package/dist/analyzer/regions.d.ts +0 -11
  592. package/dist/analyzer/regions.js +0 -62
  593. package/dist/analyzer/regions.js.map +0 -1
@@ -32,7 +32,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
32
32
  return result;
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.narrowForKeyAssignment = exports.getTypeOfIndexedTypedDict = exports.assignToTypedDict = exports.assignTypedDictToTypedDict = exports.getTypedDictMembersForClass = exports.synthesizeTypedDictClassMethods = exports.createTypedDictTypeInlined = exports.createTypedDictType = void 0;
35
+ exports.narrowForKeyAssignment = exports.getTypeOfIndexedTypedDict = exports.assignToTypedDict = exports.assignTypedDictToTypedDict = exports.getEffectiveExtraItemsEntryType = exports.getTypedDictDictEquivalent = exports.getTypedDictMappingEquivalent = exports.getTypedDictMembersForClass = exports.synthesizeTypedDictClassMethods = exports.createTypedDictTypeInlined = exports.createTypedDictType = void 0;
36
36
  const collectionUtils_1 = require("../common/collectionUtils");
37
37
  const debug_1 = require("../common/debug");
38
38
  const diagnostic_1 = require("../common/diagnostic");
@@ -49,7 +49,7 @@ const typeUtils_1 = require("./typeUtils");
49
49
  const typeVarContext_1 = require("./typeVarContext");
50
50
  // Creates a new custom TypedDict "alternate syntax" factory class.
51
51
  function createTypedDictType(evaluator, errorNode, typedDictClass, argList) {
52
- var _a, _b;
52
+ var _a, _b, _c;
53
53
  const fileInfo = AnalyzerNodeInfo.getFileInfo(errorNode);
54
54
  // TypedDict supports two different syntaxes:
55
55
  // Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
@@ -70,7 +70,7 @@ function createTypedDictType(evaluator, errorNode, typedDictClass, argList) {
70
70
  }
71
71
  }
72
72
  const effectiveClassName = className || 'TypedDict';
73
- const classType = types_1.ClassType.createInstantiable(effectiveClassName, ParseTreeUtils.getClassFullName(errorNode, fileInfo.moduleName, effectiveClassName), fileInfo.moduleName, fileInfo.fileUri, 128 /* ClassTypeFlags.TypedDictClass */ | 536870912 /* ClassTypeFlags.ValidTypeAliasClass */, ParseTreeUtils.getTypeSourceId(errorNode),
73
+ const classType = types_1.ClassType.createInstantiable(effectiveClassName, ParseTreeUtils.getClassFullName(errorNode, fileInfo.moduleName, effectiveClassName), fileInfo.moduleName, fileInfo.fileUri, 128 /* ClassTypeFlags.TypedDictClass */ | 1073741824 /* ClassTypeFlags.ValidTypeAliasClass */, ParseTreeUtils.getTypeSourceId(errorNode),
74
74
  /* declaredMetaclass */ undefined, typedDictClass.details.effectiveMetaclass);
75
75
  classType.details.baseClasses.push(typedDictClass);
76
76
  (0, typeUtils_1.computeMroLinearization)(classType);
@@ -122,7 +122,7 @@ function createTypedDictType(evaluator, errorNode, typedDictClass, argList) {
122
122
  }
123
123
  if (usingDictSyntax) {
124
124
  for (const arg of argList.slice(2)) {
125
- if (((_a = arg.name) === null || _a === void 0 ? void 0 : _a.value) === 'total') {
125
+ if (((_a = arg.name) === null || _a === void 0 ? void 0 : _a.value) === 'total' || ((_b = arg.name) === null || _b === void 0 ? void 0 : _b.value) === 'closed') {
126
126
  if (!arg.valueExpression ||
127
127
  arg.valueExpression.nodeType !== 11 /* ParseNodeType.Constant */ ||
128
128
  !(arg.valueExpression.constType === 15 /* KeywordType.False */ ||
@@ -130,7 +130,13 @@ function createTypedDictType(evaluator, errorNode, typedDictClass, argList) {
130
130
  evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.typedDictBoolParam().format({ name: arg.name.value }), arg.valueExpression || errorNode);
131
131
  }
132
132
  else if (arg.name.value === 'total' && arg.valueExpression.constType === 15 /* KeywordType.False */) {
133
- classType.details.flags |= 256 /* ClassTypeFlags.CanOmitDictValues */;
133
+ classType.details.flags |= 1024 /* ClassTypeFlags.CanOmitDictValues */;
134
+ }
135
+ else if (arg.name.value === 'closed' && arg.valueExpression.constType === 33 /* KeywordType.True */) {
136
+ if (AnalyzerNodeInfo.getFileInfo(errorNode).diagnosticRuleSet.enableExperimentalFeatures) {
137
+ classType.details.flags |=
138
+ 256 /* ClassTypeFlags.TypedDictMarkedClosed */ | 512 /* ClassTypeFlags.TypedDictEffectivelyClosed */;
139
+ }
134
140
  }
135
141
  }
136
142
  else {
@@ -138,9 +144,9 @@ function createTypedDictType(evaluator, errorNode, typedDictClass, argList) {
138
144
  }
139
145
  }
140
146
  }
141
- synthesizeTypedDictClassMethods(evaluator, errorNode, classType, /* isClassFinal */ false);
147
+ synthesizeTypedDictClassMethods(evaluator, errorNode, classType);
142
148
  // Validate that the assigned variable name is consistent with the provided name.
143
- if (((_b = errorNode.parent) === null || _b === void 0 ? void 0 : _b.nodeType) === 3 /* ParseNodeType.Assignment */ && className) {
149
+ if (((_c = errorNode.parent) === null || _c === void 0 ? void 0 : _c.nodeType) === 3 /* ParseNodeType.Assignment */ && className) {
144
150
  const target = errorNode.parent.leftExpression;
145
151
  const typedDictTarget = target.nodeType === 54 /* ParseNodeType.TypeAnnotation */ ? target.valueExpression : target;
146
152
  if (typedDictTarget.nodeType === 38 /* ParseNodeType.Name */) {
@@ -163,11 +169,12 @@ function createTypedDictTypeInlined(evaluator, dictNode, typedDictClass) {
163
169
  classType.details.baseClasses.push(typedDictClass);
164
170
  (0, typeUtils_1.computeMroLinearization)(classType);
165
171
  getTypedDictFieldsFromDictSyntax(evaluator, dictNode, classType.details.fields, /* isInline */ true);
166
- synthesizeTypedDictClassMethods(evaluator, dictNode, classType, /* isClassFinal */ true);
172
+ synthesizeTypedDictClassMethods(evaluator, dictNode, classType);
167
173
  return classType;
168
174
  }
169
175
  exports.createTypedDictTypeInlined = createTypedDictTypeInlined;
170
- function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFinal) {
176
+ function synthesizeTypedDictClassMethods(evaluator, node, classType) {
177
+ var _a;
171
178
  (0, debug_1.assert)(types_1.ClassType.isTypedDictClass(classType));
172
179
  // Synthesize a __new__ method.
173
180
  const newType = types_1.FunctionType.createSynthesizedInstance('__new__', 1 /* FunctionTypeFlags.ConstructorMethod */);
@@ -209,9 +216,9 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
209
216
  // All parameters must be named, so insert an empty "*".
210
217
  types_1.FunctionType.addKeywordOnlyParameterSeparator(initOverride2);
211
218
  const entries = getTypedDictMembersForClass(evaluator, classType);
212
- let allEntriesAreNotRequired = true;
213
- let allEntriesAreReadOnly = true;
214
- entries.forEach((entry, name) => {
219
+ const extraEntriesInfo = (_a = entries.extraItems) !== null && _a !== void 0 ? _a : getEffectiveExtraItemsEntryType(evaluator, classType);
220
+ let allEntriesAreReadOnly = entries.knownItems.size > 0;
221
+ entries.knownItems.forEach((entry, name) => {
215
222
  types_1.FunctionType.addParameter(initOverride1, {
216
223
  category: 0 /* ParameterCategory.Simple */,
217
224
  name,
@@ -226,13 +233,26 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
226
233
  type: entry.valueType,
227
234
  hasDeclaredType: true,
228
235
  });
229
- if (entry.isRequired) {
230
- allEntriesAreNotRequired = false;
231
- }
232
236
  if (!entry.isReadOnly) {
233
237
  allEntriesAreReadOnly = false;
234
238
  }
235
239
  });
240
+ if (entries.extraItems && !(0, types_1.isNever)(entries.extraItems.valueType)) {
241
+ types_1.FunctionType.addParameter(initOverride1, {
242
+ category: 2 /* ParameterCategory.KwargsDict */,
243
+ name: 'kwargs',
244
+ hasDefault: false,
245
+ type: entries.extraItems.valueType,
246
+ hasDeclaredType: true,
247
+ });
248
+ types_1.FunctionType.addParameter(initOverride2, {
249
+ category: 2 /* ParameterCategory.KwargsDict */,
250
+ name: 'kwargs',
251
+ hasDefault: false,
252
+ type: entries.extraItems.valueType,
253
+ hasDeclaredType: true,
254
+ });
255
+ }
236
256
  const symbolTable = classType.details.fields;
237
257
  const initType = types_1.OverloadedFunctionType.create([initOverride1, initOverride2]);
238
258
  symbolTable.set('__init__', symbol_1.Symbol.createWithType(4 /* SymbolFlags.ClassMember */, initType));
@@ -389,7 +409,7 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
389
409
  updateMethod3.details.declaredReturnType = evaluator.getNoneType();
390
410
  const tuplesToCombine = [];
391
411
  const tupleClass = evaluator.getBuiltInType(node, 'tuple');
392
- entries.forEach((entry, name) => {
412
+ entries.knownItems.forEach((entry, name) => {
393
413
  if (!entry.isReadOnly) {
394
414
  // For writable entries, add a tuple entry.
395
415
  if (tupleClass && (0, types_1.isInstantiableClass)(tupleClass) && strClass && (0, types_1.isInstantiableClass)(strClass)) {
@@ -433,7 +453,7 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
433
453
  const getOverloads = [];
434
454
  const popOverloads = [];
435
455
  const setDefaultOverloads = [];
436
- entries.forEach((entry, name) => {
456
+ entries.knownItems.forEach((entry, name) => {
437
457
  const nameLiteralType = types_1.ClassType.cloneAsInstance(types_1.ClassType.cloneWithLiteral(strClass, name));
438
458
  getOverloads.push(createGetMethod(nameLiteralType, entry.valueType, /* includeDefault */ false, entry.isRequired));
439
459
  getOverloads.push(createGetMethod(nameLiteralType, entry.valueType,
@@ -448,9 +468,9 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
448
468
  setDefaultOverloads.push(createSetDefaultMethod(nameLiteralType, entry.valueType));
449
469
  }
450
470
  });
451
- // If the class is marked "@final", we can assume that any other literal
471
+ // If the class is closed, we can assume that any other literal
452
472
  // key values will return the default parameter value.
453
- if (isClassFinal) {
473
+ if (types_1.ClassType.isTypedDictEffectivelyClosed(classType) && (0, types_1.isNever)(extraEntriesInfo.valueType)) {
454
474
  const literalStringType = evaluator.getTypingType(node, 'LiteralString');
455
475
  if (literalStringType && (0, types_1.isInstantiableClass)(literalStringType)) {
456
476
  const literalStringInstance = types_1.ClassType.cloneAsInstance(literalStringType);
@@ -476,9 +496,10 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
476
496
  symbolTable.set('__delitem__', symbol_1.Symbol.createWithType(4 /* SymbolFlags.ClassMember */, createDelItemMethod(strType)));
477
497
  }
478
498
  symbolTable.set('update', symbol_1.Symbol.createWithType(4 /* SymbolFlags.ClassMember */, createUpdateMethod()));
479
- // If the TypedDict is final and all of its entries are NotRequired,
480
- // add a "clear" and "popitem" method.
481
- if (isClassFinal && allEntriesAreNotRequired && !allEntriesAreReadOnly) {
499
+ // If the TypedDict is closed and all of its entries are NotRequired and
500
+ // not ReadOnly, add a "clear" and "popitem" method.
501
+ const dictValueType = getTypedDictDictEquivalent(evaluator, classType);
502
+ if (dictValueType) {
482
503
  const clearMethod = types_1.FunctionType.createSynthesizedInstance('clear');
483
504
  types_1.FunctionType.addParameter(clearMethod, selfParam);
484
505
  clearMethod.details.declaredReturnType = evaluator.getNoneType();
@@ -489,7 +510,7 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
489
510
  if (tupleType && (0, types_1.isInstantiableClass)(tupleType)) {
490
511
  tupleType = (0, typeUtils_1.specializeTupleClass)(types_1.ClassType.cloneAsInstance(tupleType), [
491
512
  { type: strType, isUnbounded: false },
492
- { type: types_1.UnknownType.create(), isUnbounded: false },
513
+ { type: dictValueType, isUnbounded: false },
493
514
  ],
494
515
  /* isTypeArgumentExplicit */ true);
495
516
  }
@@ -499,21 +520,50 @@ function synthesizeTypedDictClassMethods(evaluator, node, classType, isClassFina
499
520
  popItemMethod.details.declaredReturnType = tupleType;
500
521
  symbolTable.set('popitem', symbol_1.Symbol.createWithType(4 /* SymbolFlags.ClassMember */, popItemMethod));
501
522
  }
523
+ // If the TypedDict is closed, we can provide a more accurate value type
524
+ // for the "items", "keys" and "values" methods.
525
+ const mappingValueType = getTypedDictMappingEquivalent(evaluator, classType);
526
+ if (mappingValueType) {
527
+ ['items', 'keys', 'values'].forEach((methodName) => {
528
+ const method = types_1.FunctionType.createSynthesizedInstance(methodName);
529
+ types_1.FunctionType.addParameter(method, selfParam);
530
+ const returnTypeClass = evaluator.getTypingType(node, `dict_${methodName}`);
531
+ if (returnTypeClass &&
532
+ (0, types_1.isInstantiableClass)(returnTypeClass) &&
533
+ returnTypeClass.details.typeParameters.length === 2) {
534
+ method.details.declaredReturnType = types_1.ClassType.cloneForSpecialization(types_1.ClassType.cloneAsInstance(returnTypeClass), [strType, mappingValueType],
535
+ /* isTypeArgumentExplicit */ true);
536
+ symbolTable.set(methodName, symbol_1.Symbol.createWithType(4 /* SymbolFlags.ClassMember */, method));
537
+ }
538
+ });
539
+ }
502
540
  }
503
541
  }
504
542
  exports.synthesizeTypedDictClassMethods = synthesizeTypedDictClassMethods;
505
543
  function getTypedDictMembersForClass(evaluator, classType, allowNarrowed = false) {
544
+ var _a;
506
545
  // Were the entries already calculated and cached?
507
546
  if (!classType.details.typedDictEntries) {
508
- const entries = new Map();
547
+ const entries = {
548
+ knownItems: new Map(),
549
+ extraItems: undefined,
550
+ };
509
551
  getTypedDictMembersForClassRecursive(evaluator, classType, entries);
552
+ if (types_1.ClassType.isTypedDictMarkedClosed(classType) && !entries.extraItems) {
553
+ entries.extraItems = {
554
+ valueType: types_1.NeverType.createNever(),
555
+ isReadOnly: false,
556
+ isRequired: false,
557
+ isProvided: false,
558
+ };
559
+ }
510
560
  // Cache the entries for next time.
511
561
  classType.details.typedDictEntries = entries;
512
562
  }
513
563
  const typeVarContext = (0, typeUtils_1.buildTypeVarContextFromSpecializedClass)(classType);
514
564
  // Create a specialized copy of the entries so the caller can mutate them.
515
565
  const entries = new Map();
516
- classType.details.typedDictEntries.forEach((value, key) => {
566
+ classType.details.typedDictEntries.knownItems.forEach((value, key) => {
517
567
  const tdEntry = { ...value };
518
568
  tdEntry.valueType = (0, typeUtils_1.applySolvedTypeVars)(tdEntry.valueType, typeVarContext);
519
569
  // If the class is "Partial", make all entries optional and convert all
@@ -537,9 +587,72 @@ function getTypedDictMembersForClass(evaluator, classType, allowNarrowed = false
537
587
  entries.set(key, tdEntry);
538
588
  });
539
589
  }
540
- return entries;
590
+ return {
591
+ knownItems: entries,
592
+ extraItems: (_a = classType.details.typedDictEntries) === null || _a === void 0 ? void 0 : _a.extraItems,
593
+ };
541
594
  }
542
595
  exports.getTypedDictMembersForClass = getTypedDictMembersForClass;
596
+ // If the TypedDict class is consistent with Mapping[str, T] where T
597
+ // is some type other than object, it returns T. Otherwise it returns undefined.
598
+ function getTypedDictMappingEquivalent(evaluator, classType) {
599
+ (0, debug_1.assert)((0, types_1.isInstantiableClass)(classType));
600
+ (0, debug_1.assert)(types_1.ClassType.isTypedDictClass(classType));
601
+ // If the TypedDict class isn't closed, it's just a normal Mapping[str, object].
602
+ if (!types_1.ClassType.isTypedDictEffectivelyClosed(classType)) {
603
+ return undefined;
604
+ }
605
+ const entries = getTypedDictMembersForClass(evaluator, classType);
606
+ const typesToCombine = [];
607
+ entries.knownItems.forEach((entry) => {
608
+ typesToCombine.push(entry.valueType);
609
+ });
610
+ if (entries.extraItems) {
611
+ typesToCombine.push(entries.extraItems.valueType);
612
+ }
613
+ // Is the final value type 'object'?
614
+ const valueType = (0, types_1.combineTypes)(typesToCombine);
615
+ if ((0, types_1.isClassInstance)(valueType) && types_1.ClassType.isBuiltIn(valueType, 'object')) {
616
+ return undefined;
617
+ }
618
+ return valueType;
619
+ }
620
+ exports.getTypedDictMappingEquivalent = getTypedDictMappingEquivalent;
621
+ // If the TypedDict class is consistent with dict[str, T], it returns T.
622
+ // Otherwise it returns undefined.
623
+ function getTypedDictDictEquivalent(evaluator, classType, recursionCount = 0) {
624
+ (0, debug_1.assert)((0, types_1.isInstantiableClass)(classType));
625
+ (0, debug_1.assert)(types_1.ClassType.isTypedDictClass(classType));
626
+ // If the TypedDict class isn't closed, it's not equivalent to a dict.
627
+ if (!types_1.ClassType.isTypedDictEffectivelyClosed(classType)) {
628
+ return undefined;
629
+ }
630
+ const entries = getTypedDictMembersForClass(evaluator, classType);
631
+ // If there is no "extraItems" defined or it is read-only, it's not
632
+ // equivalent to a dict.
633
+ if (!entries.extraItems || entries.extraItems.isReadOnly) {
634
+ return undefined;
635
+ }
636
+ let dictValueType = entries.extraItems.valueType;
637
+ let isEquivalentToDict = true;
638
+ entries.knownItems.forEach((entry) => {
639
+ if (entry.isReadOnly || entry.isRequired) {
640
+ isEquivalentToDict = false;
641
+ }
642
+ dictValueType = (0, types_1.combineTypes)([dictValueType, entry.valueType]);
643
+ if (!evaluator.assignType(dictValueType, entry.valueType,
644
+ /* diag */ undefined,
645
+ /* destTypeVarContext */ undefined,
646
+ /* srcTypeVarContext */ undefined, 1 /* AssignTypeFlags.EnforceInvariance */, recursionCount + 1)) {
647
+ isEquivalentToDict = false;
648
+ }
649
+ });
650
+ if (!isEquivalentToDict) {
651
+ return undefined;
652
+ }
653
+ return dictValueType;
654
+ }
655
+ exports.getTypedDictDictEquivalent = getTypedDictDictEquivalent;
543
656
  function getTypedDictFieldsFromDictSyntax(evaluator, entryDict, classFields, isInline) {
544
657
  const entrySet = new Set();
545
658
  const fileInfo = AnalyzerNodeInfo.getFileInfo(entryDict);
@@ -581,7 +694,7 @@ function getTypedDictFieldsFromDictSyntax(evaluator, entryDict, classFields, isI
581
694
  // get evaluated again.
582
695
  evaluator.setTypeResultForNode(entryDict, { type: types_1.UnknownType.create() });
583
696
  }
584
- function getTypedDictMembersForClassRecursive(evaluator, classType, keyMap, recursionCount = 0) {
697
+ function getTypedDictMembersForClassRecursive(evaluator, classType, entries, recursionCount = 0) {
585
698
  (0, debug_1.assert)(types_1.ClassType.isTypedDictClass(classType));
586
699
  if (recursionCount > types_1.maxTypeRecursionCount) {
587
700
  return;
@@ -593,7 +706,7 @@ function getTypedDictMembersForClassRecursive(evaluator, classType, keyMap, recu
593
706
  (0, debug_1.assert)((0, types_1.isClass)(specializedBaseClassType));
594
707
  // Recursively gather keys from parent classes. Don't report any errors
595
708
  // in these cases because they will be reported within that class.
596
- getTypedDictMembersForClassRecursive(evaluator, specializedBaseClassType, keyMap, recursionCount);
709
+ getTypedDictMembersForClassRecursive(evaluator, specializedBaseClassType, entries, recursionCount);
597
710
  }
598
711
  });
599
712
  const typeVarContext = (0, typeUtils_1.buildTypeVarContextFromSpecializedClass)(classType);
@@ -605,48 +718,79 @@ function getTypedDictMembersForClassRecursive(evaluator, classType, keyMap, recu
605
718
  if (lastDecl && lastDecl.type === 1 /* DeclarationType.Variable */) {
606
719
  let valueType = evaluator.getEffectiveTypeOfSymbol(symbol);
607
720
  valueType = (0, typeUtils_1.applySolvedTypeVars)(valueType, typeVarContext);
721
+ const allowRequired = !types_1.ClassType.isTypedDictMarkedClosed(classType) || name !== '__extra_items__';
608
722
  let isRequired = !types_1.ClassType.isCanOmitDictValues(classType);
609
723
  let isReadOnly = false;
610
- if (isRequiredTypedDictVariable(evaluator, symbol)) {
724
+ if (isRequiredTypedDictVariable(evaluator, symbol, allowRequired)) {
611
725
  isRequired = true;
612
726
  }
613
- else if (isNotRequiredTypedDictVariable(evaluator, symbol)) {
727
+ else if (isNotRequiredTypedDictVariable(evaluator, symbol, allowRequired)) {
614
728
  isRequired = false;
615
729
  }
616
730
  if (isReadOnlyTypedDictVariable(evaluator, symbol)) {
617
731
  isReadOnly = true;
618
732
  }
619
- keyMap.set(name, {
733
+ const tdEntry = {
620
734
  valueType,
621
735
  isReadOnly,
622
736
  isRequired,
623
737
  isProvided: false,
624
- });
738
+ };
739
+ if (types_1.ClassType.isTypedDictMarkedClosed(classType) && name === '__extra_items__') {
740
+ tdEntry.isRequired = false;
741
+ entries.extraItems = tdEntry;
742
+ }
743
+ else {
744
+ entries.knownItems.set(name, tdEntry);
745
+ }
625
746
  }
626
747
  }
627
748
  });
628
749
  }
750
+ function getEffectiveExtraItemsEntryType(evaluator, classType) {
751
+ var _a;
752
+ (0, debug_1.assert)(types_1.ClassType.isTypedDictClass(classType));
753
+ // Missing entries in a non-closed TypedDict class are implicitly typed as
754
+ // ReadOnly[NotRequired[object]].
755
+ if (!types_1.ClassType.isTypedDictMarkedClosed(classType)) {
756
+ return {
757
+ valueType: evaluator.getObjectType(),
758
+ isReadOnly: true,
759
+ isRequired: false,
760
+ isProvided: false,
761
+ };
762
+ }
763
+ if ((_a = classType.details.typedDictEntries) === null || _a === void 0 ? void 0 : _a.extraItems) {
764
+ return classType.details.typedDictEntries.extraItems;
765
+ }
766
+ return {
767
+ valueType: types_1.NeverType.createNever(),
768
+ isReadOnly: true,
769
+ isRequired: false,
770
+ isProvided: false,
771
+ };
772
+ }
773
+ exports.getEffectiveExtraItemsEntryType = getEffectiveExtraItemsEntryType;
629
774
  function assignTypedDictToTypedDict(evaluator, destType, srcType, diag, typeVarContext, flags, recursionCount = 0) {
775
+ var _a, _b;
630
776
  let typesAreConsistent = true;
631
777
  const destEntries = getTypedDictMembersForClass(evaluator, destType);
632
778
  const srcEntries = getTypedDictMembersForClass(evaluator, srcType, /* allowNarrowed */ true);
633
- destEntries.forEach((destEntry, name) => {
634
- const srcEntry = srcEntries.get(name);
779
+ const extraSrcEntries = (_a = srcEntries.extraItems) !== null && _a !== void 0 ? _a : getEffectiveExtraItemsEntryType(evaluator, srcType);
780
+ destEntries.knownItems.forEach((destEntry, name) => {
781
+ const srcEntry = srcEntries.knownItems.get(name);
635
782
  if (!srcEntry) {
636
783
  if (destEntry.isRequired || !destEntry.isReadOnly) {
637
784
  diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.typedDictFieldMissing().format({
638
785
  name,
639
- type: evaluator.printType(srcType),
786
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(srcType)),
640
787
  }));
641
788
  typesAreConsistent = false;
642
789
  }
643
790
  else {
644
- // Missing entries are implicitly typed as ReadOnly[NotRequired[object]],
645
- // so we need to make sure the dest entry is compatible with that.
646
- const objType = evaluator.getObjectType();
647
- if ((0, types_1.isClassInstance)(objType)) {
791
+ if ((0, types_1.isClassInstance)(extraSrcEntries.valueType)) {
648
792
  const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
649
- if (!evaluator.assignType(destEntry.valueType, objType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), typeVarContext,
793
+ if (!evaluator.assignType(destEntry.valueType, extraSrcEntries.valueType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), typeVarContext,
650
794
  /* srcTypeVarContext */ undefined, flags, recursionCount)) {
651
795
  subDiag === null || subDiag === void 0 ? void 0 : subDiag.addMessage(localize_1.LocAddendum.memberTypeMismatch().format({ name }));
652
796
  typesAreConsistent = false;
@@ -661,30 +805,85 @@ function assignTypedDictToTypedDict(evaluator, destType, srcType, diag, typeVarC
661
805
  : localize_1.LocAddendum.typedDictFieldNotRequired();
662
806
  diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(message.format({
663
807
  name,
664
- type: evaluator.printType(destType),
808
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType)),
665
809
  }));
666
810
  typesAreConsistent = false;
667
811
  }
668
812
  if (!destEntry.isReadOnly && srcEntry.isReadOnly) {
669
813
  diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.typedDictFieldNotReadOnly().format({
670
814
  name,
671
- type: evaluator.printType(destType),
815
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType)),
672
816
  }));
673
817
  typesAreConsistent = false;
674
818
  }
675
819
  const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
676
- let adjustedFlags = flags;
677
- // If the dest field is not read-only, we need to enforce invariance.
678
- if (!destEntry.isReadOnly) {
679
- adjustedFlags |= 1 /* AssignTypeFlags.EnforceInvariance */;
680
- }
681
820
  if (!evaluator.assignType(destEntry.valueType, srcEntry.valueType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), typeVarContext,
682
- /* srcTypeVarContext */ undefined, adjustedFlags, recursionCount)) {
821
+ /* srcTypeVarContext */ undefined, destEntry.isReadOnly ? flags : flags | 1 /* AssignTypeFlags.EnforceInvariance */, recursionCount)) {
683
822
  subDiag === null || subDiag === void 0 ? void 0 : subDiag.addMessage(localize_1.LocAddendum.memberTypeMismatch().format({ name }));
684
823
  typesAreConsistent = false;
685
824
  }
686
825
  }
687
826
  });
827
+ // If the destination TypedDict is closed, check any extra entries in the source
828
+ // TypedDict to ensure that they don't violate the "extra items" type.
829
+ if (types_1.ClassType.isTypedDictEffectivelyClosed(destType)) {
830
+ const extraDestEntries = (_b = destEntries.extraItems) !== null && _b !== void 0 ? _b : getEffectiveExtraItemsEntryType(evaluator, destType);
831
+ srcEntries.knownItems.forEach((srcEntry, name) => {
832
+ // Have we already checked this item in the loop above?
833
+ if (destEntries.knownItems.has(name)) {
834
+ return;
835
+ }
836
+ if (!destEntries.extraItems) {
837
+ const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
838
+ subDiag === null || subDiag === void 0 ? void 0 : subDiag.addMessage(localize_1.LocAddendum.typedDictExtraFieldNotAllowed().format({
839
+ name,
840
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType)),
841
+ }));
842
+ typesAreConsistent = false;
843
+ }
844
+ else {
845
+ if (srcEntry.isRequired && !destEntries.extraItems.isReadOnly) {
846
+ diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.typedDictFieldNotRequired().format({
847
+ name,
848
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType)),
849
+ }));
850
+ typesAreConsistent = false;
851
+ }
852
+ const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
853
+ if (!evaluator.assignType(destEntries.extraItems.valueType, srcEntry.valueType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), typeVarContext,
854
+ /* srcTypeVarContext */ undefined, destEntries.extraItems.isReadOnly ? flags : flags | 1 /* AssignTypeFlags.EnforceInvariance */, recursionCount)) {
855
+ subDiag === null || subDiag === void 0 ? void 0 : subDiag.addMessage(localize_1.LocAddendum.typedDictExtraFieldTypeMismatch().format({
856
+ name,
857
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType)),
858
+ }));
859
+ typesAreConsistent = false;
860
+ }
861
+ else if (!destEntries.extraItems.isReadOnly && srcEntry.isReadOnly) {
862
+ diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.typedDictFieldNotReadOnly().format({
863
+ name,
864
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(srcType)),
865
+ }));
866
+ typesAreConsistent = false;
867
+ }
868
+ }
869
+ });
870
+ const subDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
871
+ if (!evaluator.assignType(extraDestEntries.valueType, extraSrcEntries.valueType, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), typeVarContext,
872
+ /* srcTypeVarContext */ undefined, extraDestEntries.isReadOnly ? flags : flags | 1 /* AssignTypeFlags.EnforceInvariance */, recursionCount)) {
873
+ subDiag === null || subDiag === void 0 ? void 0 : subDiag.addMessage(localize_1.LocAddendum.typedDictExtraFieldTypeMismatch().format({
874
+ name: '__extra_items__',
875
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(srcType)),
876
+ }));
877
+ typesAreConsistent = false;
878
+ }
879
+ else if (!extraDestEntries.isReadOnly && extraSrcEntries.isReadOnly) {
880
+ diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(localize_1.LocAddendum.typedDictFieldNotReadOnly().format({
881
+ name: '__extra_items__',
882
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(destType)),
883
+ }));
884
+ typesAreConsistent = false;
885
+ }
886
+ }
688
887
  return typesAreConsistent;
689
888
  }
690
889
  exports.assignTypedDictToTypedDict = assignTypedDictToTypedDict;
@@ -711,7 +910,7 @@ function assignToTypedDict(evaluator, classType, keyTypes, valueTypes, diagAdden
711
910
  /* isTypeArgumentExplicit */ false);
712
911
  }
713
912
  }
714
- const symbolMap = getTypedDictMembersForClass(evaluator, genericClassType);
913
+ const tdEntries = getTypedDictMembersForClass(evaluator, genericClassType);
715
914
  keyTypes.forEach((keyTypeResult, index) => {
716
915
  const keyType = keyTypeResult.type;
717
916
  if (!(0, types_1.isClassInstance)(keyType) || !types_1.ClassType.isBuiltIn(keyType, 'str') || !(0, typeUtils_1.isLiteralType)(keyType)) {
@@ -719,17 +918,33 @@ function assignToTypedDict(evaluator, classType, keyTypes, valueTypes, diagAdden
719
918
  }
720
919
  else {
721
920
  const keyValue = keyType.literalValue;
722
- const symbolEntry = symbolMap.get(keyValue);
921
+ const symbolEntry = tdEntries.knownItems.get(keyValue);
723
922
  if (!symbolEntry) {
724
- // The provided key name doesn't exist.
725
- isMatch = false;
726
- if (diagAddendum) {
923
+ if (tdEntries.extraItems) {
727
924
  const subDiag = diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum();
728
- subDiag.addMessage(localize_1.LocAddendum.typedDictFieldUndefined().format({
729
- name: keyType.literalValue,
730
- type: evaluator.printType(types_1.ClassType.cloneAsInstance(classType)),
731
- }));
732
- subDiag.addTextRange(keyTypeResult.node);
925
+ if (!evaluator.assignType(tdEntries.extraItems.valueType, valueTypes[index].type, subDiag === null || subDiag === void 0 ? void 0 : subDiag.createAddendum(), typeVarContext,
926
+ /* srcTypeVarContext */ undefined, 256 /* AssignTypeFlags.RetainLiteralsForTypeVar */)) {
927
+ if (subDiag) {
928
+ subDiag.addMessage(localize_1.LocAddendum.typedDictFieldTypeMismatch().format({
929
+ name: '__extra_items__',
930
+ type: evaluator.printType(valueTypes[index].type),
931
+ }));
932
+ subDiag.addTextRange(keyTypeResult.node);
933
+ }
934
+ isMatch = false;
935
+ }
936
+ }
937
+ else {
938
+ // The provided key name doesn't exist.
939
+ isMatch = false;
940
+ if (diagAddendum) {
941
+ const subDiag = diagAddendum === null || diagAddendum === void 0 ? void 0 : diagAddendum.createAddendum();
942
+ subDiag.addMessage(localize_1.LocAddendum.typedDictFieldUndefined().format({
943
+ name: keyType.literalValue,
944
+ type: evaluator.printType(types_1.ClassType.cloneAsInstance(classType)),
945
+ }));
946
+ subDiag.addTextRange(keyTypeResult.node);
947
+ }
733
948
  }
734
949
  }
735
950
  else {
@@ -762,7 +977,7 @@ function assignToTypedDict(evaluator, classType, keyTypes, valueTypes, diagAdden
762
977
  return undefined;
763
978
  }
764
979
  // See if any required keys are missing.
765
- symbolMap.forEach((entry, name) => {
980
+ tdEntries.knownItems.forEach((entry, name) => {
766
981
  if (entry.isRequired && !entry.isProvided) {
767
982
  if (diagAddendum) {
768
983
  diagAddendum.addMessage(localize_1.LocAddendum.typedDictFieldRequired().format({
@@ -799,7 +1014,7 @@ function getTypeOfIndexedTypedDict(evaluator, node, baseType, usage) {
799
1014
  let diag = new diagnostic_1.DiagnosticAddendum();
800
1015
  let allDiagsInvolveNotRequiredKeys = true;
801
1016
  const resultingType = (0, typeUtils_1.mapSubtypes)(indexType, (subtype) => {
802
- var _a, _b;
1017
+ var _a, _b, _c;
803
1018
  if ((0, types_1.isAnyOrUnknown)(subtype)) {
804
1019
  return subtype;
805
1020
  }
@@ -811,7 +1026,7 @@ function getTypeOfIndexedTypedDict(evaluator, node, baseType, usage) {
811
1026
  }
812
1027
  // Look up the entry in the typed dict to get its type.
813
1028
  const entryName = subtype.literalValue;
814
- const entry = entries.get(entryName);
1029
+ const entry = (_a = entries.knownItems.get(entryName)) !== null && _a !== void 0 ? _a : entries.extraItems;
815
1030
  if (!entry) {
816
1031
  diag.addMessage(localize_1.LocAddendum.keyUndefined().format({
817
1032
  name: entryName,
@@ -835,7 +1050,7 @@ function getTypeOfIndexedTypedDict(evaluator, node, baseType, usage) {
835
1050
  }));
836
1051
  }
837
1052
  if (usage.method === 'set') {
838
- if (!evaluator.assignType(entry.valueType, (_b = (_a = usage.setType) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : types_1.AnyType.create(), diag)) {
1053
+ if (!evaluator.assignType(entry.valueType, (_c = (_b = usage.setType) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : types_1.AnyType.create(), diag)) {
839
1054
  allDiagsInvolveNotRequiredKeys = false;
840
1055
  }
841
1056
  }
@@ -885,7 +1100,7 @@ function narrowForKeyAssignment(classType, key) {
885
1100
  if (!types_1.ClassType.isTypedDictClass(classType) || !classType.details.typedDictEntries) {
886
1101
  return classType;
887
1102
  }
888
- const tdEntry = classType.details.typedDictEntries.get(key);
1103
+ const tdEntry = classType.details.typedDictEntries.knownItems.get(key);
889
1104
  if (!tdEntry || tdEntry.isRequired) {
890
1105
  return classType;
891
1106
  }
@@ -905,7 +1120,7 @@ function narrowForKeyAssignment(classType, key) {
905
1120
  return types_1.ClassType.cloneForNarrowedTypedDictEntries(classType, narrowedEntries);
906
1121
  }
907
1122
  exports.narrowForKeyAssignment = narrowForKeyAssignment;
908
- function isRequiredTypedDictVariable(evaluator, symbol) {
1123
+ function isRequiredTypedDictVariable(evaluator, symbol, allowRequired) {
909
1124
  return symbol.getDeclarations().some((decl) => {
910
1125
  if (decl.type !== 1 /* DeclarationType.Variable */ || !decl.typeAnnotationNode) {
911
1126
  return false;
@@ -914,10 +1129,16 @@ function isRequiredTypedDictVariable(evaluator, symbol) {
914
1129
  allowFinal: true,
915
1130
  allowRequired: true,
916
1131
  });
1132
+ if (!allowRequired) {
1133
+ if (annotatedType.isRequired) {
1134
+ evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.requiredNotInTypedDict(), decl.typeAnnotationNode);
1135
+ }
1136
+ return false;
1137
+ }
917
1138
  return !!annotatedType.isRequired;
918
1139
  });
919
1140
  }
920
- function isNotRequiredTypedDictVariable(evaluator, symbol) {
1141
+ function isNotRequiredTypedDictVariable(evaluator, symbol, allowRequired) {
921
1142
  return symbol.getDeclarations().some((decl) => {
922
1143
  if (decl.type !== 1 /* DeclarationType.Variable */ || !decl.typeAnnotationNode) {
923
1144
  return false;
@@ -926,6 +1147,12 @@ function isNotRequiredTypedDictVariable(evaluator, symbol) {
926
1147
  allowFinal: true,
927
1148
  allowRequired: true,
928
1149
  });
1150
+ if (!allowRequired) {
1151
+ if (annotatedType.isNotRequired) {
1152
+ evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.notRequiredNotInTypedDict(), decl.typeAnnotationNode);
1153
+ }
1154
+ return false;
1155
+ }
929
1156
  return !!annotatedType.isNotRequired;
930
1157
  });
931
1158
  }