@zzzen/pyright-internal 1.2.0-dev.20231119 → 1.2.0-dev.20231203
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.
- package/dist/analyzer/analysis.d.ts +1 -1
- package/dist/analyzer/analysis.js +5 -1
- package/dist/analyzer/analysis.js.map +1 -1
- package/dist/analyzer/analyzerFileInfo.d.ts +1 -1
- package/dist/analyzer/analyzerNodeInfo.d.ts +1 -1
- package/dist/analyzer/analyzerNodeInfo.js +1 -1
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +201 -194
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/cacheManager.js +1 -1
- package/dist/analyzer/cacheManager.js.map +1 -1
- package/dist/analyzer/checker.d.ts +4 -1
- package/dist/analyzer/checker.js +403 -248
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +1 -1
- package/dist/analyzer/codeFlowEngine.js +33 -26
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowTypes.d.ts +1 -1
- package/dist/analyzer/codeFlowTypes.js +23 -23
- package/dist/analyzer/codeFlowTypes.js.map +1 -1
- package/dist/analyzer/codeFlowUtils.js +39 -37
- package/dist/analyzer/codeFlowUtils.js.map +1 -1
- package/dist/analyzer/commentUtils.js +7 -0
- package/dist/analyzer/commentUtils.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +51 -47
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructorTransform.js +8 -8
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/constructors.js +25 -26
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +124 -109
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +2 -2
- package/dist/analyzer/declaration.js +10 -10
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.js +41 -41
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.js +51 -51
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/enums.js +27 -27
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/functionTransform.js +4 -4
- package/dist/analyzer/functionTransform.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +1 -1
- package/dist/analyzer/importResolver.js +21 -17
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.js +1 -1
- package/dist/analyzer/importResult.js.map +1 -1
- package/dist/analyzer/importStatementUtils.js +31 -27
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +36 -32
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +94 -92
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeReport.d.ts +1 -1
- package/dist/analyzer/packageTypeReport.js +2 -2
- package/dist/analyzer/packageTypeReport.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +90 -90
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parameterUtils.js +14 -14
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parentDirectoryCache.d.ts +2 -2
- package/dist/analyzer/parseTreeCleaner.js +5 -1
- package/dist/analyzer/parseTreeCleaner.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/parseTreeUtils.js +383 -379
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.js +161 -157
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/patternMatching.d.ts +1 -1
- package/dist/analyzer/patternMatching.js +52 -50
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +1 -1
- package/dist/analyzer/program.js +18 -14
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +53 -44
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +41 -27
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js +5 -1
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/regions.js +3 -3
- package/dist/analyzer/regions.js.map +1 -1
- package/dist/analyzer/scope.js +8 -8
- package/dist/analyzer/scope.js.map +1 -1
- package/dist/analyzer/scopeUtils.js +1 -1
- package/dist/analyzer/scopeUtils.js.map +1 -1
- package/dist/analyzer/service.js +5 -1
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js +25 -21
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +2 -2
- package/dist/analyzer/sourceMapper.js +12 -8
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/staticExpressions.js +40 -40
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/symbol.d.ts +1 -1
- package/dist/analyzer/symbol.js +26 -26
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/symbolUtils.js +1 -1
- package/dist/analyzer/symbolUtils.js.map +1 -1
- package/dist/analyzer/testWalker.js +5 -5
- package/dist/analyzer/testWalker.js.map +1 -1
- package/dist/analyzer/tracePrinter.d.ts +1 -1
- package/dist/analyzer/tracePrinter.js +35 -31
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeCacheUtils.js +5 -1
- package/dist/analyzer/typeCacheUtils.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +13 -9
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +1347 -1270
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +4 -2
- package/dist/analyzer/typeEvaluatorTypes.js +4 -2
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.d.ts +1 -1
- package/dist/analyzer/typeGuards.js +79 -65
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +1 -1
- package/dist/analyzer/typePrinter.js +80 -76
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js +26 -22
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +1 -1
- package/dist/analyzer/typeUtils.js +139 -135
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +2 -0
- package/dist/analyzer/typeVarContext.js +36 -9
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typeWalker.js +10 -10
- package/dist/analyzer/typedDicts.js +76 -102
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +18 -18
- package/dist/analyzer/types.js +186 -191
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +2 -2
- package/dist/backgroundAnalysisBase.js +5 -1
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.js +5 -1
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/commandController.js +6 -7
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/commandResult.js +1 -1
- package/dist/commands/commandResult.js.map +1 -1
- package/dist/commands/commands.d.ts +0 -1
- package/dist/commands/commands.js +1 -2
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +196 -196
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/commands/quickActionCommand.js +1 -1
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/common/charCodes.js +1 -1
- package/dist/common/charCodes.js.map +1 -1
- package/dist/common/chokidarFileWatcherProvider.js +5 -1
- package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
- package/dist/common/collectionUtils.d.ts +3 -3
- package/dist/common/collectionUtils.js +3 -3
- package/dist/common/collectionUtils.js.map +1 -1
- package/dist/common/commandLineOptions.d.ts +1 -1
- package/dist/common/commandLineOptions.js +5 -5
- package/dist/common/commandLineOptions.js.map +1 -1
- package/dist/common/configOptions.d.ts +2 -1
- package/dist/common/configOptions.js +102 -10
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/console.js +7 -3
- package/dist/common/console.js.map +1 -1
- package/dist/common/core.d.ts +2 -2
- package/dist/common/core.js +6 -6
- package/dist/common/core.js.map +1 -1
- package/dist/common/diagnostic.d.ts +0 -4
- package/dist/common/diagnostic.js +6 -6
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticRules.js +1 -1
- package/dist/common/diagnosticRules.js.map +1 -1
- package/dist/common/diagnosticSink.js +12 -12
- package/dist/common/diagnosticSink.js.map +1 -1
- package/dist/common/editAction.d.ts +1 -1
- package/dist/common/editAction.js +2 -2
- package/dist/common/editAction.js.map +1 -1
- package/dist/common/envVarUtils.js +5 -1
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.js +1 -1
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/fileBasedCancellationUtils.js +5 -1
- package/dist/common/fileBasedCancellationUtils.js.map +1 -1
- package/dist/common/fileSystem.d.ts +1 -0
- package/dist/common/fileSystem.js +2 -2
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/fileWatcher.d.ts +2 -2
- package/dist/common/fullAccessHost.js +10 -6
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/host.d.ts +1 -1
- package/dist/common/host.js +2 -2
- package/dist/common/host.js.map +1 -1
- package/dist/common/lspUtils.js +7 -7
- package/dist/common/lspUtils.js.map +1 -1
- package/dist/common/memUtils.d.ts +1 -1
- package/dist/common/pathUtils.js +12 -8
- package/dist/common/pathUtils.js.map +1 -1
- package/dist/common/pythonVersion.js +1 -1
- package/dist/common/pythonVersion.js.map +1 -1
- package/dist/common/realFileSystem.js +5 -1
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/serviceProvider.d.ts +1 -1
- package/dist/common/serviceProvider.js +5 -1
- package/dist/common/serviceProvider.js.map +1 -1
- package/dist/common/serviceProviderExtensions.js +1 -1
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/stringUtils.js +5 -5
- package/dist/common/stringUtils.js.map +1 -1
- package/dist/common/textEditTracker.js +11 -7
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/textRange.js +3 -3
- package/dist/common/textRange.js.map +1 -1
- package/dist/languageServerBase.js +13 -13
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +3 -3
- package/dist/languageService/autoImporter.js +12 -8
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +27 -23
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.js +5 -19
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +166 -162
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.js +9 -9
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.js +14 -10
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentHighlightProvider.js +7 -3
- package/dist/languageService/documentHighlightProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.d.ts +1 -1
- package/dist/languageService/documentSymbolCollector.js +21 -17
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/hoverProvider.js +30 -26
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importSorter.js +1 -1
- package/dist/languageService/importSorter.js.map +1 -1
- package/dist/languageService/quickActions.d.ts +1 -2
- package/dist/languageService/quickActions.js +1 -77
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/referencesProvider.d.ts +1 -1
- package/dist/languageService/referencesProvider.js +24 -20
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js +8 -4
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.js +8 -4
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +20 -16
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.js +5 -1
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +19 -18
- package/dist/localization/localize.js +11 -8
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +0 -7
- package/dist/localization/package.nls.de.json +0 -7
- package/dist/localization/package.nls.en-us.json +11 -8
- package/dist/localization/package.nls.es.json +2 -9
- package/dist/localization/package.nls.fr.json +0 -7
- package/dist/localization/package.nls.it.json +0 -7
- package/dist/localization/package.nls.ja.json +0 -7
- package/dist/localization/package.nls.ko.json +0 -7
- package/dist/localization/package.nls.pl.json +0 -7
- package/dist/localization/package.nls.pt-br.json +0 -7
- package/dist/localization/package.nls.qps-ploc.json +0 -7
- package/dist/localization/package.nls.ru.json +0 -7
- package/dist/localization/package.nls.tr.json +0 -7
- package/dist/localization/package.nls.zh-cn.json +0 -7
- package/dist/localization/package.nls.zh-tw.json +0 -7
- package/dist/parser/characterStream.js +3 -3
- package/dist/parser/characterStream.js.map +1 -1
- package/dist/parser/characters.js +13 -9
- package/dist/parser/characters.js.map +1 -1
- package/dist/parser/parseNodes.d.ts +12 -12
- package/dist/parser/parseNodes.js +193 -193
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.js +563 -559
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/stringTokenUtils.js +47 -47
- package/dist/parser/stringTokenUtils.js.map +1 -1
- package/dist/parser/tokenizer.js +288 -288
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/tokenizerTypes.js +35 -35
- package/dist/parser/tokenizerTypes.js.map +1 -1
- package/dist/parser/unicode.d.ts +3 -3
- package/dist/pyright.js +21 -17
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +1 -0
- package/dist/pyrightFileSystem.js +2 -2
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +2 -1
- package/dist/readonlyAugmentedFileSystem.js +15 -5
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +5 -1
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +13 -1
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/collectionUtils.test.js +5 -1
- package/dist/tests/collectionUtils.test.js.map +1 -1
- package/dist/tests/common.test.js +5 -1
- package/dist/tests/common.test.js.map +1 -1
- package/dist/tests/debug.test.js +8 -4
- package/dist/tests/debug.test.js.map +1 -1
- package/dist/tests/deferred.test.js +5 -1
- package/dist/tests/deferred.test.js.map +1 -1
- package/dist/tests/diagnosticOverrides.test.js +5 -1
- package/dist/tests/diagnosticOverrides.test.js.map +1 -1
- package/dist/tests/docStringUtils.test.js +5 -1
- package/dist/tests/docStringUtils.test.js.map +1 -1
- package/dist/tests/filesystem.test.js +5 -1
- package/dist/tests/filesystem.test.js.map +1 -1
- package/dist/tests/fourSlashParser.test.js +5 -1
- package/dist/tests/fourSlashParser.test.js.map +1 -1
- package/dist/tests/fourSlashRunner.test.js +5 -1
- package/dist/tests/fourSlashRunner.test.js.map +1 -1
- package/dist/tests/fourslash/fourslash.d.ts +1 -2
- package/dist/tests/harness/fourslash/fourSlashParser.js +13 -13
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashTypes.js +11 -7
- package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
- package/dist/tests/harness/fourslash/runner.d.ts +1 -1
- package/dist/tests/harness/fourslash/runner.js +5 -1
- package/dist/tests/harness/fourslash/runner.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.js +5 -1
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.Consts.d.ts +1 -2
- package/dist/tests/harness/fourslash/testState.Consts.js +6 -3
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.js +18 -14
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/fourslash/testStateUtils.js +9 -5
- package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +5 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
- package/dist/tests/harness/testHost.js +5 -1
- package/dist/tests/harness/testHost.js.map +1 -1
- package/dist/tests/harness/utils.d.ts +13 -12
- package/dist/tests/harness/utils.js.map +1 -1
- package/dist/tests/harness/vfs/factory.js +6 -2
- package/dist/tests/harness/vfs/factory.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.d.ts +4 -3
- package/dist/tests/harness/vfs/filesystem.js +11 -7
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/harness/vfs/pathValidation.js +30 -26
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js +25 -25
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/ipythonMode.test.js +6 -6
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/localizer.test.js +5 -1
- package/dist/tests/localizer.test.js.map +1 -1
- package/dist/tests/logger.test.js +5 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +10 -10
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/parser.test.js +13 -9
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/pathUtils.test.js +5 -1
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/pyrightFileSystem.test.js +48 -1
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/sourceFile.test.js +5 -1
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +5 -1
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/stringUtils.test.js +10 -6
- package/dist/tests/stringUtils.test.js.map +1 -1
- package/dist/tests/symbolNameUtils.test.js +5 -1
- package/dist/tests/symbolNameUtils.test.js.map +1 -1
- package/dist/tests/testState.test.js +5 -1
- package/dist/tests/testState.test.js.map +1 -1
- package/dist/tests/testUtils.js +11 -7
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/textRange.test.js +5 -1
- package/dist/tests/textRange.test.js.map +1 -1
- package/dist/tests/tokenizer.test.js +463 -459
- package/dist/tests/tokenizer.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +22 -7
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +14 -6
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +23 -12
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +16 -4
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +13 -5
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js +44 -40
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/tests/workspaceEditUtils.test.js +5 -1
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/tests/zipfs.test.js +5 -1
- package/dist/tests/zipfs.test.js.map +1 -1
- package/dist/workspaceFactory.js +2 -2
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +2 -2
@@ -54,7 +54,7 @@ var MemberAccessFlags;
|
|
54
54
|
// (__getattr__, etc.) may provide the missing attribute type.
|
55
55
|
// This disables this check.
|
56
56
|
MemberAccessFlags[MemberAccessFlags["SkipAttributeAccessOverride"] = 512] = "SkipAttributeAccessOverride";
|
57
|
-
})(MemberAccessFlags
|
57
|
+
})(MemberAccessFlags || (exports.MemberAccessFlags = MemberAccessFlags = {}));
|
58
58
|
var ClassIteratorFlags;
|
59
59
|
(function (ClassIteratorFlags) {
|
60
60
|
ClassIteratorFlags[ClassIteratorFlags["Default"] = 0] = "Default";
|
@@ -66,7 +66,7 @@ var ClassIteratorFlags;
|
|
66
66
|
ClassIteratorFlags[ClassIteratorFlags["SkipObjectBaseClass"] = 2] = "SkipObjectBaseClass";
|
67
67
|
// Skip the 'type' base class in particular.
|
68
68
|
ClassIteratorFlags[ClassIteratorFlags["SkipTypeBaseClass"] = 4] = "SkipTypeBaseClass";
|
69
|
-
})(ClassIteratorFlags
|
69
|
+
})(ClassIteratorFlags || (exports.ClassIteratorFlags = ClassIteratorFlags = {}));
|
70
70
|
var AssignTypeFlags;
|
71
71
|
(function (AssignTypeFlags) {
|
72
72
|
AssignTypeFlags[AssignTypeFlags["Default"] = 0] = "Default";
|
@@ -119,7 +119,7 @@ var AssignTypeFlags;
|
|
119
119
|
// the source must be a "concrete" (non-protocol) class. This
|
120
120
|
// flag skips this check.
|
121
121
|
AssignTypeFlags[AssignTypeFlags["IgnoreProtocolAssignmentCheck"] = 4096] = "IgnoreProtocolAssignmentCheck";
|
122
|
-
})(AssignTypeFlags
|
122
|
+
})(AssignTypeFlags || (exports.AssignTypeFlags = AssignTypeFlags = {}));
|
123
123
|
// Tracks whether a function signature has been seen before within
|
124
124
|
// an expression. For example, in the expression "foo(foo, foo)", the
|
125
125
|
// signature for "foo" will be seen three times at three different
|
@@ -252,7 +252,7 @@ function mapSubtypes(type, callback, sortSubtypes = false) {
|
|
252
252
|
}
|
253
253
|
const newType = (0, types_1.combineTypes)(typesToCombine);
|
254
254
|
// Do our best to retain type aliases.
|
255
|
-
if (newType.category === 8 /* Union */) {
|
255
|
+
if (newType.category === 8 /* TypeCategory.Union */) {
|
256
256
|
types_1.UnionType.addTypeAliasSource(newType, type);
|
257
257
|
}
|
258
258
|
return newType;
|
@@ -363,14 +363,14 @@ function compareTypes(a, b, recursionCount = 0) {
|
|
363
363
|
return b.category - a.category;
|
364
364
|
}
|
365
365
|
switch (a.category) {
|
366
|
-
case 0 /* Unbound */:
|
367
|
-
case 1 /* Unknown */:
|
368
|
-
case 2 /* Any */:
|
369
|
-
case 3 /* Never */:
|
370
|
-
case 8 /* Union */: {
|
366
|
+
case 0 /* TypeCategory.Unbound */:
|
367
|
+
case 1 /* TypeCategory.Unknown */:
|
368
|
+
case 2 /* TypeCategory.Any */:
|
369
|
+
case 3 /* TypeCategory.Never */:
|
370
|
+
case 8 /* TypeCategory.Union */: {
|
371
371
|
return 0;
|
372
372
|
}
|
373
|
-
case 4 /* Function */: {
|
373
|
+
case 4 /* TypeCategory.Function */: {
|
374
374
|
const bFunc = b;
|
375
375
|
const aParamCount = a.details.parameters.length;
|
376
376
|
const bParamCount = bFunc.details.parameters.length;
|
@@ -402,7 +402,7 @@ function compareTypes(a, b, recursionCount = 0) {
|
|
402
402
|
}
|
403
403
|
return 0;
|
404
404
|
}
|
405
|
-
case 5 /* OverloadedFunction */: {
|
405
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
406
406
|
const bOver = b;
|
407
407
|
const aOverloadCount = a.overloads.length;
|
408
408
|
const bOverloadCount = bOver.overloads.length;
|
@@ -417,7 +417,7 @@ function compareTypes(a, b, recursionCount = 0) {
|
|
417
417
|
}
|
418
418
|
return 0;
|
419
419
|
}
|
420
|
-
case 6 /* Class */: {
|
420
|
+
case 6 /* TypeCategory.Class */: {
|
421
421
|
const bClass = b;
|
422
422
|
// Sort instances before instantiables.
|
423
423
|
if ((0, types_1.isClassInstance)(a) && (0, types_1.isInstantiableClass)(bClass)) {
|
@@ -478,12 +478,12 @@ function compareTypes(a, b, recursionCount = 0) {
|
|
478
478
|
}
|
479
479
|
return 0;
|
480
480
|
}
|
481
|
-
case 7 /* Module */: {
|
481
|
+
case 7 /* TypeCategory.Module */: {
|
482
482
|
const aName = a.moduleName;
|
483
483
|
const bName = b.moduleName;
|
484
484
|
return aName < bName ? -1 : aName === bName ? 0 : 1;
|
485
485
|
}
|
486
|
-
case 9 /* TypeVar */: {
|
486
|
+
case 9 /* TypeCategory.TypeVar */: {
|
487
487
|
const aName = a.details.name;
|
488
488
|
const bName = b.details.name;
|
489
489
|
return aName < bName ? -1 : aName === bName ? 0 : 1;
|
@@ -548,7 +548,7 @@ exports.preserveUnknown = preserveUnknown;
|
|
548
548
|
// Determines whether the specified type is a type that can be
|
549
549
|
// combined with other types for a union.
|
550
550
|
function isUnionableType(subtypes) {
|
551
|
-
let typeFlags = 2 /* Instance */ | 1 /* Instantiable */;
|
551
|
+
let typeFlags = 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */;
|
552
552
|
for (const subtype of subtypes) {
|
553
553
|
typeFlags &= subtype.flags;
|
554
554
|
}
|
@@ -556,7 +556,7 @@ function isUnionableType(subtypes) {
|
|
556
556
|
// and None) are both instances and instantiable. It's OK to
|
557
557
|
// include some of these, but at least one subtype needs to
|
558
558
|
// be definitively instantiable (not an instance).
|
559
|
-
return (typeFlags & 1 /* Instantiable */) !== 0 && (typeFlags & 2 /* Instance */) === 0;
|
559
|
+
return (typeFlags & 1 /* TypeFlags.Instantiable */) !== 0 && (typeFlags & 2 /* TypeFlags.Instance */) === 0;
|
560
560
|
}
|
561
561
|
exports.isUnionableType = isUnionableType;
|
562
562
|
function derivesFromAnyOrUnknown(type) {
|
@@ -585,16 +585,16 @@ function getFullNameOfType(type) {
|
|
585
585
|
return type.typeAliasInfo.fullName;
|
586
586
|
}
|
587
587
|
switch (type.category) {
|
588
|
-
case 2 /* Any */:
|
589
|
-
case 1 /* Unknown */:
|
588
|
+
case 2 /* TypeCategory.Any */:
|
589
|
+
case 1 /* TypeCategory.Unknown */:
|
590
590
|
return 'typing.Any';
|
591
|
-
case 6 /* Class */:
|
591
|
+
case 6 /* TypeCategory.Class */:
|
592
592
|
return type.details.fullName;
|
593
|
-
case 4 /* Function */:
|
593
|
+
case 4 /* TypeCategory.Function */:
|
594
594
|
return type.details.fullName;
|
595
|
-
case 7 /* Module */:
|
595
|
+
case 7 /* TypeCategory.Module */:
|
596
596
|
return type.moduleName;
|
597
|
-
case 5 /* OverloadedFunction */:
|
597
|
+
case 5 /* TypeCategory.OverloadedFunction */:
|
598
598
|
return type.overloads[0].details.fullName;
|
599
599
|
}
|
600
600
|
return undefined;
|
@@ -605,37 +605,37 @@ function addConditionToType(type, condition) {
|
|
605
605
|
return type;
|
606
606
|
}
|
607
607
|
switch (type.category) {
|
608
|
-
case 0 /* Unbound */:
|
609
|
-
case 1 /* Unknown */:
|
610
|
-
case 2 /* Any */:
|
611
|
-
case 3 /* Never */:
|
612
|
-
case 7 /* Module */:
|
613
|
-
case 9 /* TypeVar */:
|
608
|
+
case 0 /* TypeCategory.Unbound */:
|
609
|
+
case 1 /* TypeCategory.Unknown */:
|
610
|
+
case 2 /* TypeCategory.Any */:
|
611
|
+
case 3 /* TypeCategory.Never */:
|
612
|
+
case 7 /* TypeCategory.Module */:
|
613
|
+
case 9 /* TypeCategory.TypeVar */:
|
614
614
|
return type;
|
615
|
-
case 4 /* Function */:
|
615
|
+
case 4 /* TypeCategory.Function */:
|
616
616
|
return types_1.TypeBase.cloneForCondition(type, types_1.TypeCondition.combine(type.condition, condition));
|
617
|
-
case 5 /* OverloadedFunction */:
|
617
|
+
case 5 /* TypeCategory.OverloadedFunction */:
|
618
618
|
return types_1.OverloadedFunctionType.create(type.overloads.map((t) => addConditionToType(t, condition)));
|
619
|
-
case 6 /* Class */:
|
619
|
+
case 6 /* TypeCategory.Class */:
|
620
620
|
return types_1.TypeBase.cloneForCondition(type, types_1.TypeCondition.combine(type.condition, condition));
|
621
|
-
case 8 /* Union */:
|
621
|
+
case 8 /* TypeCategory.Union */:
|
622
622
|
return (0, types_1.combineTypes)(type.subtypes.map((t) => addConditionToType(t, condition)));
|
623
623
|
}
|
624
624
|
}
|
625
625
|
exports.addConditionToType = addConditionToType;
|
626
626
|
function getTypeCondition(type) {
|
627
627
|
switch (type.category) {
|
628
|
-
case 0 /* Unbound */:
|
629
|
-
case 1 /* Unknown */:
|
630
|
-
case 2 /* Any */:
|
631
|
-
case 3 /* Never */:
|
632
|
-
case 7 /* Module */:
|
633
|
-
case 9 /* TypeVar */:
|
634
|
-
case 5 /* OverloadedFunction */:
|
635
|
-
case 8 /* Union */:
|
628
|
+
case 0 /* TypeCategory.Unbound */:
|
629
|
+
case 1 /* TypeCategory.Unknown */:
|
630
|
+
case 2 /* TypeCategory.Any */:
|
631
|
+
case 3 /* TypeCategory.Never */:
|
632
|
+
case 7 /* TypeCategory.Module */:
|
633
|
+
case 9 /* TypeCategory.TypeVar */:
|
634
|
+
case 5 /* TypeCategory.OverloadedFunction */:
|
635
|
+
case 8 /* TypeCategory.Union */:
|
636
636
|
return undefined;
|
637
|
-
case 6 /* Class */:
|
638
|
-
case 4 /* Function */:
|
637
|
+
case 6 /* TypeCategory.Class */:
|
638
|
+
case 4 /* TypeCategory.Function */:
|
639
639
|
return type.condition;
|
640
640
|
}
|
641
641
|
}
|
@@ -650,7 +650,7 @@ exports.isTypeAliasPlaceholder = isTypeAliasPlaceholder;
|
|
650
650
|
// within the specified type. It's OK if it's used indirectly as
|
651
651
|
// a type argument.
|
652
652
|
function isTypeAliasRecursive(typeAliasPlaceholder, type) {
|
653
|
-
if (type.category !== 8 /* Union */) {
|
653
|
+
if (type.category !== 8 /* TypeCategory.Union */) {
|
654
654
|
if (type === typeAliasPlaceholder) {
|
655
655
|
return true;
|
656
656
|
}
|
@@ -754,7 +754,7 @@ function getUnknownTypeForTypeVar(typeVar) {
|
|
754
754
|
exports.getUnknownTypeForTypeVar = getUnknownTypeForTypeVar;
|
755
755
|
// Returns the "Unknown" equivalent for a ParamSpec.
|
756
756
|
function getUnknownTypeForParamSpec() {
|
757
|
-
const newFunction = types_1.FunctionType.createInstance('', '', '', 65536 /* ParamSpecValue */ | 32768 /* SkipArgsKwargsCompatibilityCheck */);
|
757
|
+
const newFunction = types_1.FunctionType.createInstance('', '', '', 65536 /* FunctionTypeFlags.ParamSpecValue */ | 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */);
|
758
758
|
types_1.FunctionType.addDefaultParameters(newFunction);
|
759
759
|
return newFunction;
|
760
760
|
}
|
@@ -887,7 +887,7 @@ function isCallableType(type) {
|
|
887
887
|
if (types_1.TypeBase.isInstantiable(type)) {
|
888
888
|
return true;
|
889
889
|
}
|
890
|
-
const callMember = lookUpObjectMember(type, '__call__', 16 /* SkipInstanceMembers */);
|
890
|
+
const callMember = lookUpObjectMember(type, '__call__', 16 /* MemberAccessFlags.SkipInstanceMembers */);
|
891
891
|
return !!callMember;
|
892
892
|
}
|
893
893
|
if ((0, types_1.isUnion)(type)) {
|
@@ -1097,13 +1097,13 @@ exports.transformExpectedType = transformExpectedType;
|
|
1097
1097
|
// appears in a parent and a child, the child overrides the parent.
|
1098
1098
|
function getProtocolSymbols(classType) {
|
1099
1099
|
const symbolMap = new Map();
|
1100
|
-
if ((classType.details.flags & 8192 /* ProtocolClass */) !== 0) {
|
1101
|
-
getProtocolSymbolsRecursive(classType, symbolMap, 8192 /* ProtocolClass */);
|
1100
|
+
if ((classType.details.flags & 8192 /* ClassTypeFlags.ProtocolClass */) !== 0) {
|
1101
|
+
getProtocolSymbolsRecursive(classType, symbolMap, 8192 /* ClassTypeFlags.ProtocolClass */);
|
1102
1102
|
}
|
1103
1103
|
return symbolMap;
|
1104
1104
|
}
|
1105
1105
|
exports.getProtocolSymbols = getProtocolSymbols;
|
1106
|
-
function getProtocolSymbolsRecursive(classType, symbolMap, classFlags = 8192 /* ProtocolClass */, recursionCount = 0) {
|
1106
|
+
function getProtocolSymbolsRecursive(classType, symbolMap, classFlags = 8192 /* ClassTypeFlags.ProtocolClass */, recursionCount = 0) {
|
1107
1107
|
if (recursionCount > types_1.maxTypeRecursionCount) {
|
1108
1108
|
return;
|
1109
1109
|
}
|
@@ -1160,7 +1160,7 @@ function getContainerDepth(type, recursionCount = 0) {
|
|
1160
1160
|
return 1 + maxChildDepth;
|
1161
1161
|
}
|
1162
1162
|
exports.getContainerDepth = getContainerDepth;
|
1163
|
-
function lookUpObjectMember(objectType, memberName, flags = 0 /* Default */, skipMroClass) {
|
1163
|
+
function lookUpObjectMember(objectType, memberName, flags = 0 /* MemberAccessFlags.Default */, skipMroClass) {
|
1164
1164
|
if ((0, types_1.isClassInstance)(objectType)) {
|
1165
1165
|
return lookUpClassMember(objectType, memberName, flags, skipMroClass);
|
1166
1166
|
}
|
@@ -1169,7 +1169,7 @@ function lookUpObjectMember(objectType, memberName, flags = 0 /* Default */, ski
|
|
1169
1169
|
exports.lookUpObjectMember = lookUpObjectMember;
|
1170
1170
|
// Looks up a member in a class using the multiple-inheritance rules
|
1171
1171
|
// defined by Python.
|
1172
|
-
function lookUpClassMember(classType, memberName, flags = 0 /* Default */, skipMroClass) {
|
1172
|
+
function lookUpClassMember(classType, memberName, flags = 0 /* MemberAccessFlags.Default */, skipMroClass) {
|
1173
1173
|
var _a;
|
1174
1174
|
const memberItr = getClassMemberIterator(classType, memberName, flags, skipMroClass);
|
1175
1175
|
return (_a = memberItr.next()) === null || _a === void 0 ? void 0 : _a.value;
|
@@ -1185,24 +1185,24 @@ exports.lookUpClassMember = lookUpClassMember;
|
|
1185
1185
|
// (self) -> Iterator[str].
|
1186
1186
|
// If skipMroClass is defined, all MRO classes up to and including that class
|
1187
1187
|
// are skipped.
|
1188
|
-
function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */, skipMroClass) {
|
1189
|
-
const declaredTypesOnly = (flags & 64 /* DeclaredTypesOnly */) !== 0;
|
1188
|
+
function* getClassMemberIterator(classType, memberName, flags = 0 /* MemberAccessFlags.Default */, skipMroClass) {
|
1189
|
+
const declaredTypesOnly = (flags & 64 /* MemberAccessFlags.DeclaredTypesOnly */) !== 0;
|
1190
1190
|
let skippedUndeclaredType = false;
|
1191
1191
|
if ((0, types_1.isClass)(classType)) {
|
1192
|
-
let classFlags = 0 /* Default */;
|
1193
|
-
if (flags & 1 /* SkipOriginalClass */) {
|
1192
|
+
let classFlags = 0 /* ClassIteratorFlags.Default */;
|
1193
|
+
if (flags & 1 /* MemberAccessFlags.SkipOriginalClass */) {
|
1194
1194
|
if ((0, types_1.isClass)(classType)) {
|
1195
1195
|
skipMroClass = classType;
|
1196
1196
|
}
|
1197
1197
|
}
|
1198
|
-
if (flags & 2 /* SkipBaseClasses */) {
|
1199
|
-
classFlags = classFlags | 1 /* SkipBaseClasses */;
|
1198
|
+
if (flags & 2 /* MemberAccessFlags.SkipBaseClasses */) {
|
1199
|
+
classFlags = classFlags | 1 /* ClassIteratorFlags.SkipBaseClasses */;
|
1200
1200
|
}
|
1201
|
-
if (flags & 4 /* SkipObjectBaseClass */) {
|
1202
|
-
classFlags = classFlags | 2 /* SkipObjectBaseClass */;
|
1201
|
+
if (flags & 4 /* MemberAccessFlags.SkipObjectBaseClass */) {
|
1202
|
+
classFlags = classFlags | 2 /* ClassIteratorFlags.SkipObjectBaseClass */;
|
1203
1203
|
}
|
1204
|
-
if (flags & 8 /* SkipTypeBaseClass */) {
|
1205
|
-
classFlags = classFlags | 4 /* SkipTypeBaseClass */;
|
1204
|
+
if (flags & 8 /* MemberAccessFlags.SkipTypeBaseClass */) {
|
1205
|
+
classFlags = classFlags | 4 /* ClassIteratorFlags.SkipTypeBaseClass */;
|
1206
1206
|
}
|
1207
1207
|
const classItr = getClassIterator(classType, classFlags, skipMroClass);
|
1208
1208
|
for (const [mroClass, specializedMroClass] of classItr) {
|
@@ -1211,7 +1211,7 @@ function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */,
|
|
1211
1211
|
// The class derives from an unknown type, so all bets are off
|
1212
1212
|
// when trying to find a member. Return an unknown symbol.
|
1213
1213
|
const cm = {
|
1214
|
-
symbol: symbol_1.Symbol.createWithType(0 /* None */, mroClass),
|
1214
|
+
symbol: symbol_1.Symbol.createWithType(0 /* SymbolFlags.None */, mroClass),
|
1215
1215
|
isInstanceMember: false,
|
1216
1216
|
isClassMember: true,
|
1217
1217
|
isClassVar: false,
|
@@ -1228,7 +1228,7 @@ function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */,
|
|
1228
1228
|
}
|
1229
1229
|
const memberFields = specializedMroClass.details.fields;
|
1230
1230
|
// Look at instance members first if requested.
|
1231
|
-
if ((flags & 16 /* SkipInstanceMembers */) === 0) {
|
1231
|
+
if ((flags & 16 /* MemberAccessFlags.SkipInstanceMembers */) === 0) {
|
1232
1232
|
const symbol = memberFields.get(memberName);
|
1233
1233
|
if (symbol && symbol.isInstanceMember()) {
|
1234
1234
|
const hasDeclaredType = symbol.hasTypedDeclarations();
|
@@ -1250,7 +1250,7 @@ function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */,
|
|
1250
1250
|
}
|
1251
1251
|
}
|
1252
1252
|
// Next look at class members.
|
1253
|
-
if ((flags & 32 /* SkipClassMembers */) === 0) {
|
1253
|
+
if ((flags & 32 /* MemberAccessFlags.SkipClassMembers */) === 0) {
|
1254
1254
|
const symbol = memberFields.get(memberName);
|
1255
1255
|
if (symbol && symbol.isClassMember()) {
|
1256
1256
|
const hasDeclaredType = symbol.hasTypedDeclarations();
|
@@ -1266,7 +1266,7 @@ function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */,
|
|
1266
1266
|
const isTypedDict = types_1.ClassType.isTypedDictClass(specializedMroClass);
|
1267
1267
|
if (hasDeclaredType && (isDataclass || isTypedDict)) {
|
1268
1268
|
const decls = symbol.getDeclarations();
|
1269
|
-
if (decls.length > 0 && decls[0].type === 1 /* Variable */) {
|
1269
|
+
if (decls.length > 0 && decls[0].type === 1 /* DeclarationType.Variable */) {
|
1270
1270
|
isInstanceMember = true;
|
1271
1271
|
isClassMember = isDataclass;
|
1272
1272
|
}
|
@@ -1293,7 +1293,7 @@ function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */,
|
|
1293
1293
|
// The class derives from an unknown type, so all bets are off
|
1294
1294
|
// when trying to find a member. Return an Any or Unknown symbol.
|
1295
1295
|
const cm = {
|
1296
|
-
symbol: symbol_1.Symbol.createWithType(0 /* None */, classType),
|
1296
|
+
symbol: symbol_1.Symbol.createWithType(0 /* SymbolFlags.None */, classType),
|
1297
1297
|
isInstanceMember: false,
|
1298
1298
|
isClassMember: true,
|
1299
1299
|
isClassVar: false,
|
@@ -1306,7 +1306,7 @@ function* getClassMemberIterator(classType, memberName, flags = 0 /* Default */,
|
|
1306
1306
|
return undefined;
|
1307
1307
|
}
|
1308
1308
|
exports.getClassMemberIterator = getClassMemberIterator;
|
1309
|
-
function* getClassIterator(classType, flags = 0 /* Default */, skipMroClass) {
|
1309
|
+
function* getClassIterator(classType, flags = 0 /* ClassIteratorFlags.Default */, skipMroClass) {
|
1310
1310
|
if ((0, types_1.isClass)(classType)) {
|
1311
1311
|
let foundSkipMroClass = skipMroClass === undefined;
|
1312
1312
|
for (const mroClass of classType.details.mro) {
|
@@ -1327,7 +1327,7 @@ function* getClassIterator(classType, flags = 0 /* Default */, skipMroClass) {
|
|
1327
1327
|
// it in the context of classType.
|
1328
1328
|
const specializedMroClass = partiallySpecializeType(mroClass, classType);
|
1329
1329
|
// Should we ignore members on the 'object' base class?
|
1330
|
-
if (flags & 2 /* SkipObjectBaseClass */) {
|
1330
|
+
if (flags & 2 /* ClassIteratorFlags.SkipObjectBaseClass */) {
|
1331
1331
|
if ((0, types_1.isInstantiableClass)(specializedMroClass)) {
|
1332
1332
|
if (types_1.ClassType.isBuiltIn(specializedMroClass, 'object')) {
|
1333
1333
|
break;
|
@@ -1335,7 +1335,7 @@ function* getClassIterator(classType, flags = 0 /* Default */, skipMroClass) {
|
|
1335
1335
|
}
|
1336
1336
|
}
|
1337
1337
|
// Should we ignore members on the 'type' base class?
|
1338
|
-
if (flags & 4 /* SkipTypeBaseClass */) {
|
1338
|
+
if (flags & 4 /* ClassIteratorFlags.SkipTypeBaseClass */) {
|
1339
1339
|
if ((0, types_1.isInstantiableClass)(specializedMroClass)) {
|
1340
1340
|
if (types_1.ClassType.isBuiltIn(specializedMroClass, 'type')) {
|
1341
1341
|
break;
|
@@ -1343,7 +1343,7 @@ function* getClassIterator(classType, flags = 0 /* Default */, skipMroClass) {
|
|
1343
1343
|
}
|
1344
1344
|
}
|
1345
1345
|
yield [mroClass, specializedMroClass];
|
1346
|
-
if ((flags & 1 /* SkipBaseClasses */) !== 0) {
|
1346
|
+
if ((flags & 1 /* ClassIteratorFlags.SkipBaseClasses */) !== 0) {
|
1347
1347
|
break;
|
1348
1348
|
}
|
1349
1349
|
}
|
@@ -1549,12 +1549,12 @@ function setTypeArgumentsRecursive(destType, srcType, typeVarContext, recursionC
|
|
1549
1549
|
return;
|
1550
1550
|
}
|
1551
1551
|
switch (destType.category) {
|
1552
|
-
case 8 /* Union */:
|
1552
|
+
case 8 /* TypeCategory.Union */:
|
1553
1553
|
doForEachSubtype(destType, (subtype) => {
|
1554
1554
|
setTypeArgumentsRecursive(subtype, srcType, typeVarContext, recursionCount);
|
1555
1555
|
});
|
1556
1556
|
break;
|
1557
|
-
case 6 /* Class */:
|
1557
|
+
case 6 /* TypeCategory.Class */:
|
1558
1558
|
if (destType.typeArguments) {
|
1559
1559
|
destType.typeArguments.forEach((typeArg) => {
|
1560
1560
|
setTypeArgumentsRecursive(typeArg, srcType, typeVarContext, recursionCount);
|
@@ -1566,7 +1566,7 @@ function setTypeArgumentsRecursive(destType, srcType, typeVarContext, recursionC
|
|
1566
1566
|
});
|
1567
1567
|
}
|
1568
1568
|
break;
|
1569
|
-
case 4 /* Function */:
|
1569
|
+
case 4 /* TypeCategory.Function */:
|
1570
1570
|
if (destType.specializedTypes) {
|
1571
1571
|
destType.specializedTypes.parameterTypes.forEach((paramType) => {
|
1572
1572
|
setTypeArgumentsRecursive(paramType, srcType, typeVarContext, recursionCount);
|
@@ -1590,12 +1590,12 @@ function setTypeArgumentsRecursive(destType, srcType, typeVarContext, recursionC
|
|
1590
1590
|
}
|
1591
1591
|
}
|
1592
1592
|
break;
|
1593
|
-
case 5 /* OverloadedFunction */:
|
1593
|
+
case 5 /* TypeCategory.OverloadedFunction */:
|
1594
1594
|
destType.overloads.forEach((subtype) => {
|
1595
1595
|
setTypeArgumentsRecursive(subtype, srcType, typeVarContext, recursionCount);
|
1596
1596
|
});
|
1597
1597
|
break;
|
1598
|
-
case 9 /* TypeVar */:
|
1598
|
+
case 9 /* TypeCategory.TypeVar */:
|
1599
1599
|
if (!typeVarContext.getPrimarySignature().getTypeVar(destType)) {
|
1600
1600
|
typeVarContext.setTypeVarType(destType, srcType);
|
1601
1601
|
}
|
@@ -1788,7 +1788,7 @@ function convertToInstance(type, includeSubclasses = true) {
|
|
1788
1788
|
}
|
1789
1789
|
let result = mapSubtypes(type, (subtype) => {
|
1790
1790
|
switch (subtype.category) {
|
1791
|
-
case 6 /* Class */: {
|
1791
|
+
case 6 /* TypeCategory.Class */: {
|
1792
1792
|
// Handle type[x] as a special case.
|
1793
1793
|
if (types_1.ClassType.isBuiltIn(subtype, 'type')) {
|
1794
1794
|
if (types_1.TypeBase.isInstance(subtype)) {
|
@@ -1809,19 +1809,19 @@ function convertToInstance(type, includeSubclasses = true) {
|
|
1809
1809
|
}
|
1810
1810
|
return types_1.ClassType.cloneAsInstance(subtype, includeSubclasses);
|
1811
1811
|
}
|
1812
|
-
case 4 /* Function */: {
|
1812
|
+
case 4 /* TypeCategory.Function */: {
|
1813
1813
|
if (types_1.TypeBase.isInstantiable(subtype)) {
|
1814
1814
|
return types_1.FunctionType.cloneAsInstance(subtype);
|
1815
1815
|
}
|
1816
1816
|
break;
|
1817
1817
|
}
|
1818
|
-
case 9 /* TypeVar */: {
|
1818
|
+
case 9 /* TypeCategory.TypeVar */: {
|
1819
1819
|
if (types_1.TypeBase.isInstantiable(subtype)) {
|
1820
1820
|
return types_1.TypeVarType.cloneAsInstance(subtype);
|
1821
1821
|
}
|
1822
1822
|
break;
|
1823
1823
|
}
|
1824
|
-
case 2 /* Any */: {
|
1824
|
+
case 2 /* TypeCategory.Any */: {
|
1825
1825
|
return types_1.AnyType.convertToInstance(subtype);
|
1826
1826
|
}
|
1827
1827
|
}
|
@@ -1849,13 +1849,13 @@ function convertToInstantiable(type, includeSubclasses = true) {
|
|
1849
1849
|
}
|
1850
1850
|
let result = mapSubtypes(type, (subtype) => {
|
1851
1851
|
switch (subtype.category) {
|
1852
|
-
case 6 /* Class */: {
|
1852
|
+
case 6 /* TypeCategory.Class */: {
|
1853
1853
|
return types_1.ClassType.cloneAsInstantiable(subtype, includeSubclasses);
|
1854
1854
|
}
|
1855
|
-
case 4 /* Function */: {
|
1855
|
+
case 4 /* TypeCategory.Function */: {
|
1856
1856
|
return types_1.FunctionType.cloneAsInstantiable(subtype);
|
1857
1857
|
}
|
1858
|
-
case 9 /* TypeVar */: {
|
1858
|
+
case 9 /* TypeCategory.TypeVar */: {
|
1859
1859
|
return types_1.TypeVarType.cloneAsInstantiable(subtype);
|
1860
1860
|
}
|
1861
1861
|
}
|
@@ -1998,7 +1998,7 @@ exports.containsAnyOrUnknown = containsAnyOrUnknown;
|
|
1998
1998
|
// This function does not use the TypeWalker because it is called very frequently,
|
1999
1999
|
// and allocating a memory walker object for every call significantly increases
|
2000
2000
|
// peak memory usage.
|
2001
|
-
function isPartlyUnknown(type,
|
2001
|
+
function isPartlyUnknown(type, recursionCount = 0) {
|
2002
2002
|
var _a, _b;
|
2003
2003
|
if (recursionCount > types_1.maxTypeRecursionCount) {
|
2004
2004
|
return false;
|
@@ -2010,25 +2010,27 @@ function isPartlyUnknown(type, allowUnknownTypeArgsForClasses = false, recursion
|
|
2010
2010
|
// If this is a generic type alias, see if any of its type arguments
|
2011
2011
|
// are either unspecified or are partially known.
|
2012
2012
|
if ((_a = type.typeAliasInfo) === null || _a === void 0 ? void 0 : _a.typeArguments) {
|
2013
|
-
if (type.typeAliasInfo.typeArguments.some((typeArg) => isPartlyUnknown(typeArg,
|
2013
|
+
if (type.typeAliasInfo.typeArguments.some((typeArg) => isPartlyUnknown(typeArg, recursionCount))) {
|
2014
2014
|
return true;
|
2015
2015
|
}
|
2016
2016
|
}
|
2017
2017
|
// See if a union contains an unknown type.
|
2018
2018
|
if ((0, types_1.isUnion)(type)) {
|
2019
|
-
return (
|
2020
|
-
undefined);
|
2019
|
+
return (0, types_1.findSubtype)(type, (subtype) => isPartlyUnknown(subtype, recursionCount)) !== undefined;
|
2021
2020
|
}
|
2022
2021
|
// See if an object or class has an unknown type argument.
|
2023
2022
|
if ((0, types_1.isClass)(type)) {
|
2024
|
-
|
2025
|
-
|
2023
|
+
// If this is a reference to the class itself, as opposed to a reference
|
2024
|
+
// to a type that represents the class and its subclasses, don't flag
|
2025
|
+
// the type as partially unknown.
|
2026
|
+
if (!type.includeSubclasses) {
|
2027
|
+
return false;
|
2026
2028
|
}
|
2027
|
-
if (!
|
2029
|
+
if (!types_1.ClassType.isPseudoGenericClass(type)) {
|
2028
2030
|
const typeArgs = ((_b = type.tupleTypeArguments) === null || _b === void 0 ? void 0 : _b.map((t) => t.type)) || type.typeArguments;
|
2029
2031
|
if (typeArgs) {
|
2030
2032
|
for (const argType of typeArgs) {
|
2031
|
-
if (isPartlyUnknown(argType,
|
2033
|
+
if (isPartlyUnknown(argType, recursionCount)) {
|
2032
2034
|
return true;
|
2033
2035
|
}
|
2034
2036
|
}
|
@@ -2039,7 +2041,7 @@ function isPartlyUnknown(type, allowUnknownTypeArgsForClasses = false, recursion
|
|
2039
2041
|
// See if a function has an unknown type.
|
2040
2042
|
if ((0, types_1.isOverloadedFunction)(type)) {
|
2041
2043
|
return types_1.OverloadedFunctionType.getOverloads(type).some((overload) => {
|
2042
|
-
return isPartlyUnknown(overload,
|
2044
|
+
return isPartlyUnknown(overload, recursionCount);
|
2043
2045
|
});
|
2044
2046
|
}
|
2045
2047
|
if ((0, types_1.isFunction)(type)) {
|
@@ -2047,14 +2049,14 @@ function isPartlyUnknown(type, allowUnknownTypeArgsForClasses = false, recursion
|
|
2047
2049
|
// Ignore parameters such as "*" that have no name.
|
2048
2050
|
if (type.details.parameters[i].name) {
|
2049
2051
|
const paramType = types_1.FunctionType.getEffectiveParameterType(type, i);
|
2050
|
-
if (isPartlyUnknown(paramType,
|
2052
|
+
if (isPartlyUnknown(paramType, recursionCount)) {
|
2051
2053
|
return true;
|
2052
2054
|
}
|
2053
2055
|
}
|
2054
2056
|
}
|
2055
2057
|
if (type.details.declaredReturnType &&
|
2056
2058
|
!types_1.FunctionType.isParamSpecValue(type) &&
|
2057
|
-
isPartlyUnknown(type.details.declaredReturnType,
|
2059
|
+
isPartlyUnknown(type.details.declaredReturnType, recursionCount)) {
|
2058
2060
|
return true;
|
2059
2061
|
}
|
2060
2062
|
return false;
|
@@ -2173,8 +2175,8 @@ function removeParamSpecVariadicsFromFunction(type) {
|
|
2173
2175
|
}
|
2174
2176
|
const argsParam = type.details.parameters[paramCount - 2];
|
2175
2177
|
const kwargsParam = type.details.parameters[paramCount - 1];
|
2176
|
-
if (argsParam.category !== 1 /* ArgsList */ ||
|
2177
|
-
kwargsParam.category !== 2 /* KwargsDict */ ||
|
2178
|
+
if (argsParam.category !== 1 /* ParameterCategory.ArgsList */ ||
|
2179
|
+
kwargsParam.category !== 2 /* ParameterCategory.KwargsDict */ ||
|
2178
2180
|
!(0, types_1.isParamSpec)(argsParam.type) ||
|
2179
2181
|
!(0, types_1.isParamSpec)(kwargsParam.type) ||
|
2180
2182
|
!(0, types_1.isTypeSame)(argsParam.type, kwargsParam.type)) {
|
@@ -2271,7 +2273,7 @@ function _requiresSpecialization(type, options, recursionCount = 0) {
|
|
2271
2273
|
return true;
|
2272
2274
|
}
|
2273
2275
|
switch (type.category) {
|
2274
|
-
case 6 /* Class */: {
|
2276
|
+
case 6 /* TypeCategory.Class */: {
|
2275
2277
|
if (types_1.ClassType.isPseudoGenericClass(type) && (options === null || options === void 0 ? void 0 : options.ignorePseudoGeneric)) {
|
2276
2278
|
return false;
|
2277
2279
|
}
|
@@ -2283,7 +2285,7 @@ function _requiresSpecialization(type, options, recursionCount = 0) {
|
|
2283
2285
|
}
|
2284
2286
|
return types_1.ClassType.getTypeParameters(type).length > 0;
|
2285
2287
|
}
|
2286
|
-
case 4 /* Function */: {
|
2288
|
+
case 4 /* TypeCategory.Function */: {
|
2287
2289
|
if (type.details.paramSpec) {
|
2288
2290
|
return true;
|
2289
2291
|
}
|
@@ -2307,13 +2309,13 @@ function _requiresSpecialization(type, options, recursionCount = 0) {
|
|
2307
2309
|
}
|
2308
2310
|
return false;
|
2309
2311
|
}
|
2310
|
-
case 5 /* OverloadedFunction */: {
|
2312
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
2311
2313
|
return type.overloads.some((overload) => requiresSpecialization(overload, options, recursionCount));
|
2312
2314
|
}
|
2313
|
-
case 8 /* Union */: {
|
2315
|
+
case 8 /* TypeCategory.Union */: {
|
2314
2316
|
return type.subtypes.some((subtype) => requiresSpecialization(subtype, options, recursionCount));
|
2315
2317
|
}
|
2316
|
-
case 9 /* TypeVar */: {
|
2318
|
+
case 9 /* TypeCategory.TypeVar */: {
|
2317
2319
|
// Most TypeVar types need to be specialized.
|
2318
2320
|
if (!type.details.recursiveTypeAliasName) {
|
2319
2321
|
if (type.details.isSynthesizedSelf && (options === null || options === void 0 ? void 0 : options.ignoreSelf)) {
|
@@ -2332,13 +2334,13 @@ function _requiresSpecialization(type, options, recursionCount = 0) {
|
|
2332
2334
|
}
|
2333
2335
|
// Combines two variances to produce a resulting variance.
|
2334
2336
|
function combineVariances(variance1, variance2) {
|
2335
|
-
if (variance1 === 1 /* Unknown */) {
|
2337
|
+
if (variance1 === 1 /* Variance.Unknown */) {
|
2336
2338
|
return variance2;
|
2337
2339
|
}
|
2338
|
-
if (variance2 === 2 /* Invariant */ ||
|
2339
|
-
(variance2 === 3 /* Covariant */ && variance1 === 4 /* Contravariant */) ||
|
2340
|
-
(variance2 === 4 /* Contravariant */ && variance1 === 3 /* Covariant */)) {
|
2341
|
-
return 2 /* Invariant */;
|
2340
|
+
if (variance2 === 2 /* Variance.Invariant */ ||
|
2341
|
+
(variance2 === 3 /* Variance.Covariant */ && variance1 === 4 /* Variance.Contravariant */) ||
|
2342
|
+
(variance2 === 4 /* Variance.Contravariant */ && variance1 === 3 /* Variance.Covariant */)) {
|
2343
|
+
return 2 /* Variance.Invariant */;
|
2342
2344
|
}
|
2343
2345
|
return variance1;
|
2344
2346
|
}
|
@@ -2346,12 +2348,12 @@ exports.combineVariances = combineVariances;
|
|
2346
2348
|
// Determines if the variance of the type argument for a generic class is compatible
|
2347
2349
|
// With the declared variance of the corresponding type parameter.
|
2348
2350
|
function isVarianceOfTypeArgumentCompatible(type, typeParamVariance) {
|
2349
|
-
if (typeParamVariance === 1 /* Unknown */ || typeParamVariance === 0 /* Auto */) {
|
2351
|
+
if (typeParamVariance === 1 /* Variance.Unknown */ || typeParamVariance === 0 /* Variance.Auto */) {
|
2350
2352
|
return true;
|
2351
2353
|
}
|
2352
2354
|
if ((0, types_1.isTypeVar)(type) && !type.details.isParamSpec && !type.details.isVariadic) {
|
2353
2355
|
const typeArgVariance = type.details.declaredVariance;
|
2354
|
-
if (typeArgVariance === 4 /* Contravariant */ || typeArgVariance === 3 /* Covariant */) {
|
2356
|
+
if (typeArgVariance === 4 /* Variance.Contravariant */ || typeArgVariance === 3 /* Variance.Covariant */) {
|
2355
2357
|
return typeArgVariance === typeParamVariance;
|
2356
2358
|
}
|
2357
2359
|
}
|
@@ -2366,23 +2368,23 @@ function isVarianceOfTypeArgumentCompatible(type, typeParamVariance) {
|
|
2366
2368
|
typeArgType = type.typeArguments[index];
|
2367
2369
|
}
|
2368
2370
|
const declaredVariance = typeParam.details.declaredVariance;
|
2369
|
-
if (declaredVariance === 0 /* Auto */) {
|
2371
|
+
if (declaredVariance === 0 /* Variance.Auto */) {
|
2370
2372
|
return true;
|
2371
2373
|
}
|
2372
|
-
let effectiveVariance = 2 /* Invariant */;
|
2373
|
-
if (declaredVariance === 3 /* Covariant */) {
|
2374
|
+
let effectiveVariance = 2 /* Variance.Invariant */;
|
2375
|
+
if (declaredVariance === 3 /* Variance.Covariant */) {
|
2374
2376
|
// If the declared variance is covariant, the effective variance
|
2375
2377
|
// is simply copied from the type param variance.
|
2376
2378
|
effectiveVariance = typeParamVariance;
|
2377
2379
|
}
|
2378
|
-
else if (declaredVariance === 4 /* Contravariant */) {
|
2380
|
+
else if (declaredVariance === 4 /* Variance.Contravariant */) {
|
2379
2381
|
// If the declared variance is contravariant, it flips the
|
2380
2382
|
// effective variance from contravariant to covariant or vice versa.
|
2381
|
-
if (typeParamVariance === 3 /* Covariant */) {
|
2382
|
-
effectiveVariance = 4 /* Contravariant */;
|
2383
|
+
if (typeParamVariance === 3 /* Variance.Covariant */) {
|
2384
|
+
effectiveVariance = 4 /* Variance.Contravariant */;
|
2383
2385
|
}
|
2384
|
-
else if (typeParamVariance === 4 /* Contravariant */) {
|
2385
|
-
effectiveVariance = 3 /* Covariant */;
|
2386
|
+
else if (typeParamVariance === 4 /* Variance.Contravariant */) {
|
2387
|
+
effectiveVariance = 3 /* Variance.Covariant */;
|
2386
2388
|
}
|
2387
2389
|
}
|
2388
2390
|
return isVarianceOfTypeArgumentCompatible(typeArgType !== null && typeArgType !== void 0 ? typeArgType : types_1.UnknownType.create(), effectiveVariance);
|
@@ -2530,27 +2532,27 @@ function addDeclaringModuleNamesForType(type, moduleList, recursionCount = 0) {
|
|
2530
2532
|
}
|
2531
2533
|
};
|
2532
2534
|
switch (type.category) {
|
2533
|
-
case 6 /* Class */: {
|
2535
|
+
case 6 /* TypeCategory.Class */: {
|
2534
2536
|
addIfUnique(type.details.moduleName);
|
2535
2537
|
break;
|
2536
2538
|
}
|
2537
|
-
case 4 /* Function */: {
|
2539
|
+
case 4 /* TypeCategory.Function */: {
|
2538
2540
|
addIfUnique(type.details.moduleName);
|
2539
2541
|
break;
|
2540
2542
|
}
|
2541
|
-
case 5 /* OverloadedFunction */: {
|
2543
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
2542
2544
|
type.overloads.forEach((overload) => {
|
2543
2545
|
addDeclaringModuleNamesForType(overload, moduleList, recursionCount);
|
2544
2546
|
});
|
2545
2547
|
break;
|
2546
2548
|
}
|
2547
|
-
case 8 /* Union */: {
|
2549
|
+
case 8 /* TypeCategory.Union */: {
|
2548
2550
|
doForEachSubtype(type, (subtype) => {
|
2549
2551
|
addDeclaringModuleNamesForType(subtype, moduleList, recursionCount);
|
2550
2552
|
});
|
2551
2553
|
break;
|
2552
2554
|
}
|
2553
|
-
case 7 /* Module */: {
|
2555
|
+
case 7 /* TypeCategory.Module */: {
|
2554
2556
|
addIfUnique(type.moduleName);
|
2555
2557
|
break;
|
2556
2558
|
}
|
@@ -2558,13 +2560,13 @@ function addDeclaringModuleNamesForType(type, moduleList, recursionCount = 0) {
|
|
2558
2560
|
}
|
2559
2561
|
function convertTypeToParamSpecValue(type) {
|
2560
2562
|
if ((0, types_1.isParamSpec)(type)) {
|
2561
|
-
const newFunction = types_1.FunctionType.createInstance('', '', '', 65536 /* ParamSpecValue */);
|
2563
|
+
const newFunction = types_1.FunctionType.createInstance('', '', '', 65536 /* FunctionTypeFlags.ParamSpecValue */);
|
2562
2564
|
newFunction.details.paramSpec = type;
|
2563
2565
|
newFunction.details.typeVarScopeId = getTypeVarScopeId(type);
|
2564
2566
|
return newFunction;
|
2565
2567
|
}
|
2566
2568
|
if ((0, types_1.isFunction)(type)) {
|
2567
|
-
const newFunction = types_1.FunctionType.createInstance('', '', '', type.details.flags | 65536 /* ParamSpecValue */, type.details.docString);
|
2569
|
+
const newFunction = types_1.FunctionType.createInstance('', '', '', type.details.flags | 65536 /* FunctionTypeFlags.ParamSpecValue */, type.details.docString);
|
2568
2570
|
type.details.parameters.forEach((param, index) => {
|
2569
2571
|
types_1.FunctionType.addParameter(newFunction, {
|
2570
2572
|
category: param.category,
|
@@ -2594,7 +2596,7 @@ function convertParamSpecValueToType(paramSpecValue, omitParamSpec = false) {
|
|
2594
2596
|
}
|
2595
2597
|
if (hasParameters || !paramSpecValue.details.paramSpec || omitParamSpec) {
|
2596
2598
|
// Create a function type from the param spec entries.
|
2597
|
-
const functionType = types_1.FunctionType.createInstance('', '', '', 65536 /* ParamSpecValue */ | paramSpecValue.details.flags);
|
2599
|
+
const functionType = types_1.FunctionType.createInstance('', '', '', 65536 /* FunctionTypeFlags.ParamSpecValue */ | paramSpecValue.details.flags);
|
2598
2600
|
functionType.details.paramSpecTypeVarScopeId = paramSpecValue.details.typeVarScopeId;
|
2599
2601
|
paramSpecValue.details.parameters.forEach((entry) => {
|
2600
2602
|
types_1.FunctionType.addParameter(functionType, {
|
@@ -2812,7 +2814,9 @@ class TypeVarTransformer {
|
|
2812
2814
|
transformTypeVarsInClassType(classType, recursionCount) {
|
2813
2815
|
const typeParams = types_1.ClassType.getTypeParameters(classType);
|
2814
2816
|
// Handle the common case where the class has no type parameters.
|
2815
|
-
if (typeParams.length === 0 &&
|
2817
|
+
if (typeParams.length === 0 &&
|
2818
|
+
!types_1.ClassType.isSpecialBuiltIn(classType) &&
|
2819
|
+
!types_1.ClassType.isBuiltIn(classType, 'type')) {
|
2816
2820
|
return classType;
|
2817
2821
|
}
|
2818
2822
|
let newTypeArgs;
|
@@ -2960,8 +2964,8 @@ class TypeVarTransformer {
|
|
2960
2964
|
const kwargsParam = functionType.details.parameters[functionType.details.parameters.length - 1];
|
2961
2965
|
const argsParamType = types_1.FunctionType.getEffectiveParameterType(functionType, functionType.details.parameters.length - 2);
|
2962
2966
|
const kwargsParamType = types_1.FunctionType.getEffectiveParameterType(functionType, functionType.details.parameters.length - 1);
|
2963
|
-
if (argsParam.category === 1 /* ArgsList */ &&
|
2964
|
-
kwargsParam.category === 2 /* KwargsDict */ &&
|
2967
|
+
if (argsParam.category === 1 /* ParameterCategory.ArgsList */ &&
|
2968
|
+
kwargsParam.category === 2 /* ParameterCategory.KwargsDict */ &&
|
2965
2969
|
(0, types_1.isParamSpec)(argsParamType) &&
|
2966
2970
|
(0, types_1.isParamSpec)(kwargsParamType) &&
|
2967
2971
|
(0, types_1.isTypeSame)(argsParamType, kwargsParamType)) {
|
@@ -2996,7 +3000,7 @@ class TypeVarTransformer {
|
|
2996
3000
|
specializedDefaultArgs.push(defaultArgType);
|
2997
3001
|
if (variadicParamIndex === undefined &&
|
2998
3002
|
(0, types_1.isVariadicTypeVar)(paramType) &&
|
2999
|
-
functionType.details.parameters[i].category === 1 /* ArgsList */) {
|
3003
|
+
functionType.details.parameters[i].category === 1 /* ParameterCategory.ArgsList */) {
|
3000
3004
|
variadicParamIndex = i;
|
3001
3005
|
if ((0, types_1.isClassInstance)(specializedType) &&
|
3002
3006
|
isTupleClass(specializedType) &&
|
@@ -3028,7 +3032,7 @@ class TypeVarTransformer {
|
|
3028
3032
|
}
|
3029
3033
|
// Unpack the tuple and synthesize a new function in the process.
|
3030
3034
|
const newFunctionType = types_1.TypeBase.isInstantiable(functionType)
|
3031
|
-
? types_1.FunctionType.createInstantiable(functionType.details.flags | 64 /* SynthesizedMethod */)
|
3035
|
+
? types_1.FunctionType.createInstantiable(functionType.details.flags | 64 /* FunctionTypeFlags.SynthesizedMethod */)
|
3032
3036
|
: types_1.FunctionType.createSynthesizedInstance('', functionType.details.flags);
|
3033
3037
|
let insertKeywordOnlySeparator = false;
|
3034
3038
|
let swallowPositionOnlySeparator = false;
|
@@ -3039,8 +3043,8 @@ class TypeVarTransformer {
|
|
3039
3043
|
variadicTypesToUnpack.forEach((unpackedType) => {
|
3040
3044
|
types_1.FunctionType.addParameter(newFunctionType, {
|
3041
3045
|
category: unpackedType.isUnbounded || (0, types_1.isVariadicTypeVar)(unpackedType.type)
|
3042
|
-
? 1 /* ArgsList */
|
3043
|
-
: 0 /* Simple */,
|
3046
|
+
? 1 /* ParameterCategory.ArgsList */
|
3047
|
+
: 0 /* ParameterCategory.Simple */,
|
3044
3048
|
name: `__p${newFunctionType.details.parameters.length}`,
|
3045
3049
|
isNameSynthesized: true,
|
3046
3050
|
type: unpackedType.type,
|
@@ -3062,14 +3066,14 @@ class TypeVarTransformer {
|
|
3062
3066
|
if ((0, types_1.isKeywordOnlySeparator)(param)) {
|
3063
3067
|
insertKeywordOnlySeparator = false;
|
3064
3068
|
}
|
3065
|
-
else if (param.category === 2 /* KwargsDict */) {
|
3069
|
+
else if (param.category === 2 /* ParameterCategory.KwargsDict */) {
|
3066
3070
|
insertKeywordOnlySeparator = false;
|
3067
3071
|
}
|
3068
3072
|
// Insert a keyword-only separator parameter if we previously
|
3069
3073
|
// unpacked a variadic TypeVar.
|
3070
|
-
if (param.category === 0 /* Simple */ && param.name && insertKeywordOnlySeparator) {
|
3074
|
+
if (param.category === 0 /* ParameterCategory.Simple */ && param.name && insertKeywordOnlySeparator) {
|
3071
3075
|
types_1.FunctionType.addParameter(newFunctionType, {
|
3072
|
-
category: 1 /* ArgsList */,
|
3076
|
+
category: 1 /* ParameterCategory.ArgsList */,
|
3073
3077
|
type: types_1.UnknownType.create(),
|
3074
3078
|
});
|
3075
3079
|
insertKeywordOnlySeparator = false;
|
@@ -3078,7 +3082,7 @@ class TypeVarTransformer {
|
|
3078
3082
|
if (param.name && param.isNameSynthesized) {
|
3079
3083
|
param.name = `__p${newFunctionType.details.parameters.length}`;
|
3080
3084
|
}
|
3081
|
-
if (param.category !== 0 /* Simple */ || param.name || !swallowPositionOnlySeparator) {
|
3085
|
+
if (param.category !== 0 /* ParameterCategory.Simple */ || param.name || !swallowPositionOnlySeparator) {
|
3082
3086
|
types_1.FunctionType.addParameter(newFunctionType, param);
|
3083
3087
|
}
|
3084
3088
|
}
|
@@ -3160,7 +3164,7 @@ class UniqueFunctionSignatureTransformer extends TypeVarTransformer {
|
|
3160
3164
|
// Create new type variables with the same scope but with
|
3161
3165
|
// different (unique) names.
|
3162
3166
|
sourceType.details.typeParameters.forEach((typeParam) => {
|
3163
|
-
if (typeParam.scopeType === 1 /* Function */) {
|
3167
|
+
if (typeParam.scopeType === 1 /* TypeVarScopeType.Function */) {
|
3164
3168
|
let replacement = types_1.TypeVarType.cloneForNewName(typeParam, `${typeParam.details.name}(${offsetIndex})`);
|
3165
3169
|
if (replacement.details.isParamSpec) {
|
3166
3170
|
replacement = convertTypeToParamSpecValue(replacement);
|
@@ -3402,7 +3406,7 @@ class ApplySolvedTypeVarsTransformer extends TypeVarTransformer {
|
|
3402
3406
|
const filteredOverloads = [];
|
3403
3407
|
doForEachSubtype((0, types_1.combineTypes)(overloadTypes), (subtype) => {
|
3404
3408
|
(0, debug_1.assert)((0, types_1.isFunction)(subtype));
|
3405
|
-
subtype = types_1.FunctionType.cloneWithNewFlags(subtype, subtype.details.flags | 256 /* Overloaded */);
|
3409
|
+
subtype = types_1.FunctionType.cloneWithNewFlags(subtype, subtype.details.flags | 256 /* FunctionTypeFlags.Overloaded */);
|
3406
3410
|
filteredOverloads.push(subtype);
|
3407
3411
|
});
|
3408
3412
|
if (filteredOverloads.length === 1) {
|