@zzzen/pyright-internal 1.2.0-dev.20231112 → 1.2.0-dev.20231126
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 +198 -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 +1 -0
- package/dist/analyzer/checker.js +286 -256
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +1 -1
- package/dist/analyzer/codeFlowEngine.js +26 -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/constraintSolver.js +48 -45
- 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 +33 -31
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +67 -63
- 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 +44 -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/docStringConversion.js +1 -1
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/docStringUtils.js +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 +27 -18
- 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 +78 -78
- 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 +71 -64
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +1 -1
- package/dist/analyzer/program.js +20 -17
- 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 +14 -14
- 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 +15 -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 +1272 -1176
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +3 -1
- package/dist/analyzer/typeEvaluatorTypes.js +3 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.d.ts +1 -1
- package/dist/analyzer/typeGuards.js +95 -67
- 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.js +163 -123
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +1 -0
- package/dist/analyzer/typeVarContext.js +12 -9
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typeWalker.js +10 -10
- package/dist/analyzer/typedDicts.js +74 -70
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +17 -12
- package/dist/analyzer/types.js +191 -181
- 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 +7 -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.js +1 -1
- 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 +1 -1
- package/dist/common/configOptions.js +11 -7
- 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.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.d.ts +3 -3
- package/dist/languageServerBase.js +19 -19
- 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 +8 -8
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +171 -173
- 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.js +10 -6
- 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 +10 -12
- package/dist/localization/localize.js +8 -5
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +5 -8
- package/dist/localization/package.nls.de.json +5 -8
- package/dist/localization/package.nls.en-us.json +12 -9
- package/dist/localization/package.nls.es.json +5 -8
- package/dist/localization/package.nls.fr.json +5 -8
- package/dist/localization/package.nls.it.json +5 -8
- package/dist/localization/package.nls.ja.json +5 -8
- package/dist/localization/package.nls.ko.json +5 -8
- package/dist/localization/package.nls.pl.json +5 -8
- package/dist/localization/package.nls.pt-br.json +5 -8
- package/dist/localization/package.nls.qps-ploc.json +2 -5
- package/dist/localization/package.nls.ru.json +5 -8
- package/dist/localization/package.nls.tr.json +5 -8
- package/dist/localization/package.nls.zh-cn.json +5 -8
- package/dist/localization/package.nls.zh-tw.json +5 -8
- 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 +38 -18
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +1 -0
- package/dist/pyrightFileSystem.js +1 -1
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +1 -0
- package/dist/tests/chainedSourceFiles.test.js +5 -1
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +5 -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/config.test.js +7 -5
- package/dist/tests/config.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/docStringConversion.test.js +0 -22
- package/dist/tests/docStringConversion.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/completions.params.fourslash.js +11 -0
- package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js +10 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
- 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.js +6 -2
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.js +17 -13
- 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/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 +18 -2
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +19 -3
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +11 -3
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +11 -3
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +5 -1
- 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
package/dist/analyzer/types.js
CHANGED
@@ -39,7 +39,7 @@ var TypeCategory;
|
|
39
39
|
TypeCategory[TypeCategory["Union"] = 8] = "Union";
|
40
40
|
// Type variable (defined with TypeVar)
|
41
41
|
TypeCategory[TypeCategory["TypeVar"] = 9] = "TypeVar";
|
42
|
-
})(TypeCategory
|
42
|
+
})(TypeCategory || (exports.TypeCategory = TypeCategory = {}));
|
43
43
|
var TypeFlags;
|
44
44
|
(function (TypeFlags) {
|
45
45
|
TypeFlags[TypeFlags["None"] = 0] = "None";
|
@@ -52,7 +52,7 @@ var TypeFlags;
|
|
52
52
|
TypeFlags[TypeFlags["Annotated"] = 4] = "Annotated";
|
53
53
|
// This type is a special form like "UnionType".
|
54
54
|
TypeFlags[TypeFlags["SpecialForm"] = 8] = "SpecialForm";
|
55
|
-
})(TypeFlags
|
55
|
+
})(TypeFlags || (exports.TypeFlags = TypeFlags = {}));
|
56
56
|
exports.WildcardTypeVarScopeId = '*';
|
57
57
|
exports.InScopePlaceholderScopeId = '-';
|
58
58
|
class EnumLiteral {
|
@@ -70,28 +70,30 @@ exports.EnumLiteral = EnumLiteral;
|
|
70
70
|
// This constant controls the maximum number of nested types (i.e. types
|
71
71
|
// used as type arguments or parameter types in other types) before we
|
72
72
|
// give up. This constant was previously set to 32, but there were certain
|
73
|
-
// pathological recursive types where this resulted in a hang.
|
74
|
-
|
73
|
+
// pathological recursive types where this resulted in a hang. It was also
|
74
|
+
// previously lowered to 10, but this caused some legitimate failures in
|
75
|
+
// code that used numpy.
|
76
|
+
exports.maxTypeRecursionCount = 12;
|
75
77
|
var TypeBase;
|
76
78
|
(function (TypeBase) {
|
77
79
|
function isInstantiable(type) {
|
78
|
-
return (type.flags & 1 /* Instantiable */) !== 0;
|
80
|
+
return (type.flags & 1 /* TypeFlags.Instantiable */) !== 0;
|
79
81
|
}
|
80
82
|
TypeBase.isInstantiable = isInstantiable;
|
81
83
|
function isInstance(type) {
|
82
|
-
return (type.flags & 2 /* Instance */) !== 0;
|
84
|
+
return (type.flags & 2 /* TypeFlags.Instance */) !== 0;
|
83
85
|
}
|
84
86
|
TypeBase.isInstance = isInstance;
|
85
87
|
function isAnnotated(type) {
|
86
|
-
return (type.flags & 4 /* Annotated */) !== 0;
|
88
|
+
return (type.flags & 4 /* TypeFlags.Annotated */) !== 0;
|
87
89
|
}
|
88
90
|
TypeBase.isAnnotated = isAnnotated;
|
89
91
|
function isSpecialForm(type) {
|
90
|
-
return (type.flags & 8 /* SpecialForm */) !== 0;
|
92
|
+
return (type.flags & 8 /* TypeFlags.SpecialForm */) !== 0;
|
91
93
|
}
|
92
94
|
TypeBase.isSpecialForm = isSpecialForm;
|
93
95
|
function setSpecialForm(type) {
|
94
|
-
return (type.flags |= 8 /* SpecialForm */);
|
96
|
+
return (type.flags |= 8 /* TypeFlags.SpecialForm */);
|
95
97
|
}
|
96
98
|
TypeBase.setSpecialForm = setSpecialForm;
|
97
99
|
function isAmbiguous(type) {
|
@@ -108,8 +110,8 @@ var TypeBase;
|
|
108
110
|
(0, debug_1.assert)(TypeBase.isInstantiable(type));
|
109
111
|
const newInstance = TypeBase.cloneType(type);
|
110
112
|
if (newInstance.instantiableNestingLevel === undefined) {
|
111
|
-
newInstance.flags &= ~1 /* Instantiable */;
|
112
|
-
newInstance.flags |= 2 /* Instance */;
|
113
|
+
newInstance.flags &= ~1 /* TypeFlags.Instantiable */;
|
114
|
+
newInstance.flags |= 2 /* TypeFlags.Instance */;
|
113
115
|
delete newInstance.instantiableNestingLevel;
|
114
116
|
}
|
115
117
|
else {
|
@@ -133,8 +135,8 @@ var TypeBase;
|
|
133
135
|
function cloneTypeAsInstantiable(type, cache) {
|
134
136
|
const newInstance = TypeBase.cloneType(type);
|
135
137
|
if (TypeBase.isInstance(type)) {
|
136
|
-
newInstance.flags &= ~2 /* Instance */;
|
137
|
-
newInstance.flags |= 1 /* Instantiable */;
|
138
|
+
newInstance.flags &= ~2 /* TypeFlags.Instance */;
|
139
|
+
newInstance.flags |= 1 /* TypeFlags.Instantiable */;
|
138
140
|
}
|
139
141
|
else {
|
140
142
|
newInstance.instantiableNestingLevel =
|
@@ -165,7 +167,7 @@ var TypeBase;
|
|
165
167
|
TypeBase.cloneForTypeAlias = cloneForTypeAlias;
|
166
168
|
function cloneForAnnotated(type) {
|
167
169
|
const typeClone = cloneType(type);
|
168
|
-
typeClone.flags |= 4 /* Annotated */;
|
170
|
+
typeClone.flags |= 4 /* TypeFlags.Annotated */;
|
169
171
|
return typeClone;
|
170
172
|
}
|
171
173
|
TypeBase.cloneForAnnotated = cloneForAnnotated;
|
@@ -189,29 +191,29 @@ var TypeBase;
|
|
189
191
|
return typeClone;
|
190
192
|
}
|
191
193
|
TypeBase.cloneForAmbiguousType = cloneForAmbiguousType;
|
192
|
-
})(TypeBase
|
194
|
+
})(TypeBase || (exports.TypeBase = TypeBase = {}));
|
193
195
|
var UnboundType;
|
194
196
|
(function (UnboundType) {
|
195
197
|
const _instance = {
|
196
|
-
category: 0 /* Unbound */,
|
197
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
198
|
+
category: 0 /* TypeCategory.Unbound */,
|
199
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
198
200
|
};
|
199
201
|
function create() {
|
200
202
|
// All Unbound objects are the same, so use a shared instance.
|
201
203
|
return _instance;
|
202
204
|
}
|
203
205
|
UnboundType.create = create;
|
204
|
-
})(UnboundType
|
206
|
+
})(UnboundType || (exports.UnboundType = UnboundType = {}));
|
205
207
|
var UnknownType;
|
206
208
|
(function (UnknownType) {
|
207
209
|
const _instance = {
|
208
|
-
category: 1 /* Unknown */,
|
209
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
210
|
+
category: 1 /* TypeCategory.Unknown */,
|
211
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
210
212
|
isIncomplete: false,
|
211
213
|
};
|
212
214
|
const _incompleteInstance = {
|
213
|
-
category: 1 /* Unknown */,
|
214
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
215
|
+
category: 1 /* TypeCategory.Unknown */,
|
216
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
215
217
|
isIncomplete: true,
|
216
218
|
};
|
217
219
|
function create(isIncomplete = false) {
|
@@ -220,23 +222,23 @@ var UnknownType;
|
|
220
222
|
UnknownType.create = create;
|
221
223
|
function createPossibleType(possibleType, isIncomplete) {
|
222
224
|
const unknownWithPossibleType = {
|
223
|
-
category: 1 /* Unknown */,
|
224
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
225
|
+
category: 1 /* TypeCategory.Unknown */,
|
226
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
225
227
|
isIncomplete,
|
226
228
|
possibleType,
|
227
229
|
};
|
228
230
|
return unknownWithPossibleType;
|
229
231
|
}
|
230
232
|
UnknownType.createPossibleType = createPossibleType;
|
231
|
-
})(UnknownType
|
233
|
+
})(UnknownType || (exports.UnknownType = UnknownType = {}));
|
232
234
|
var ModuleType;
|
233
235
|
(function (ModuleType) {
|
234
236
|
function create(moduleName, filePath, symbolTable) {
|
235
237
|
const newModuleType = {
|
236
|
-
category: 7 /* Module */,
|
238
|
+
category: 7 /* TypeCategory.Module */,
|
237
239
|
fields: symbolTable || new Map(),
|
238
240
|
loaderFields: new Map(),
|
239
|
-
flags: 1 /* Instantiable */ | 1 /* Instantiable */,
|
241
|
+
flags: 1 /* TypeFlags.Instantiable */ | 1 /* TypeFlags.Instantiable */,
|
240
242
|
moduleName,
|
241
243
|
filePath,
|
242
244
|
};
|
@@ -265,7 +267,7 @@ var ModuleType;
|
|
265
267
|
return symbol;
|
266
268
|
}
|
267
269
|
ModuleType.getField = getField;
|
268
|
-
})(ModuleType
|
270
|
+
})(ModuleType || (exports.ModuleType = ModuleType = {}));
|
269
271
|
var ClassTypeFlags;
|
270
272
|
(function (ClassTypeFlags) {
|
271
273
|
ClassTypeFlags[ClassTypeFlags["None"] = 0] = "None";
|
@@ -346,12 +348,12 @@ var ClassTypeFlags;
|
|
346
348
|
ClassTypeFlags[ClassTypeFlags["SynthesizeDataClassUnsafeHash"] = 67108864] = "SynthesizeDataClassUnsafeHash";
|
347
349
|
// Decorated with @type_check_only.
|
348
350
|
ClassTypeFlags[ClassTypeFlags["TypeCheckOnly"] = 134217728] = "TypeCheckOnly";
|
349
|
-
})(ClassTypeFlags
|
351
|
+
})(ClassTypeFlags || (exports.ClassTypeFlags = ClassTypeFlags = {}));
|
350
352
|
var ClassType;
|
351
353
|
(function (ClassType) {
|
352
354
|
function createInstantiable(name, fullName, moduleName, filePath, flags, typeSourceId, declaredMetaclass, effectiveMetaclass, docString) {
|
353
355
|
const newClass = {
|
354
|
-
category: 6 /* Class */,
|
356
|
+
category: 6 /* TypeCategory.Class */,
|
355
357
|
details: {
|
356
358
|
name,
|
357
359
|
fullName,
|
@@ -367,7 +369,7 @@ var ClassType;
|
|
367
369
|
typeParameters: [],
|
368
370
|
docString,
|
369
371
|
},
|
370
|
-
flags: 1 /* Instantiable */,
|
372
|
+
flags: 1 /* TypeFlags.Instantiable */,
|
371
373
|
};
|
372
374
|
return newClass;
|
373
375
|
}
|
@@ -381,7 +383,7 @@ var ClassType;
|
|
381
383
|
return type.cached.typeBaseInstanceType;
|
382
384
|
}
|
383
385
|
const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ includeSubclasses);
|
384
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
386
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
385
387
|
if (includeSubclasses) {
|
386
388
|
newInstance.includeSubclasses = true;
|
387
389
|
}
|
@@ -394,7 +396,7 @@ var ClassType;
|
|
394
396
|
return type.cached.typeBaseInstantiableType;
|
395
397
|
}
|
396
398
|
const newInstance = TypeBase.cloneTypeAsInstantiable(type, includeSubclasses);
|
397
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
399
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
398
400
|
if (includeSubclasses) {
|
399
401
|
newInstance.includeSubclasses = true;
|
400
402
|
}
|
@@ -572,7 +574,7 @@ var ClassType;
|
|
572
574
|
}
|
573
575
|
ClassType.isUnspecialized = isUnspecialized;
|
574
576
|
function isSpecialBuiltIn(classType, className) {
|
575
|
-
if (!(classType.details.flags & 2 /* SpecialBuiltIn */) && !classType.aliasName) {
|
577
|
+
if (!(classType.details.flags & 2 /* ClassTypeFlags.SpecialBuiltIn */) && !classType.aliasName) {
|
576
578
|
return false;
|
577
579
|
}
|
578
580
|
if (className !== undefined) {
|
@@ -582,7 +584,7 @@ var ClassType;
|
|
582
584
|
}
|
583
585
|
ClassType.isSpecialBuiltIn = isSpecialBuiltIn;
|
584
586
|
function isBuiltIn(classType, className) {
|
585
|
-
if (!(classType.details.flags & 1 /* BuiltInClass */)) {
|
587
|
+
if (!(classType.details.flags & 1 /* ClassTypeFlags.BuiltInClass */)) {
|
586
588
|
return false;
|
587
589
|
}
|
588
590
|
if (className !== undefined) {
|
@@ -598,79 +600,79 @@ var ClassType;
|
|
598
600
|
}
|
599
601
|
ClassType.derivesFromAnyOrUnknown = derivesFromAnyOrUnknown;
|
600
602
|
function supportsAbstractMethods(classType) {
|
601
|
-
return !!(classType.details.flags & 1024 /* SupportsAbstractMethods */);
|
603
|
+
return !!(classType.details.flags & 1024 /* ClassTypeFlags.SupportsAbstractMethods */);
|
602
604
|
}
|
603
605
|
ClassType.supportsAbstractMethods = supportsAbstractMethods;
|
604
606
|
function isDataClass(classType) {
|
605
|
-
return !!(classType.details.flags & 4 /* DataClass */);
|
607
|
+
return !!(classType.details.flags & 4 /* ClassTypeFlags.DataClass */);
|
606
608
|
}
|
607
609
|
ClassType.isDataClass = isDataClass;
|
608
610
|
function isSkipSynthesizedDataClassInit(classType) {
|
609
|
-
return !!(classType.details.flags & 16 /* SkipSynthesizedDataClassInit */);
|
611
|
+
return !!(classType.details.flags & 16 /* ClassTypeFlags.SkipSynthesizedDataClassInit */);
|
610
612
|
}
|
611
613
|
ClassType.isSkipSynthesizedDataClassInit = isSkipSynthesizedDataClassInit;
|
612
614
|
function isSkipSynthesizedDataClassEq(classType) {
|
613
|
-
return !!(classType.details.flags & 32 /* SkipSynthesizedDataClassEq */);
|
615
|
+
return !!(classType.details.flags & 32 /* ClassTypeFlags.SkipSynthesizedDataClassEq */);
|
614
616
|
}
|
615
617
|
ClassType.isSkipSynthesizedDataClassEq = isSkipSynthesizedDataClassEq;
|
616
618
|
function isFrozenDataClass(classType) {
|
617
|
-
return !!(classType.details.flags & 8 /* FrozenDataClass */);
|
619
|
+
return !!(classType.details.flags & 8 /* ClassTypeFlags.FrozenDataClass */);
|
618
620
|
}
|
619
621
|
ClassType.isFrozenDataClass = isFrozenDataClass;
|
620
622
|
function isSynthesizedDataclassOrder(classType) {
|
621
|
-
return !!(classType.details.flags & 64 /* SynthesizedDataClassOrder */);
|
623
|
+
return !!(classType.details.flags & 64 /* ClassTypeFlags.SynthesizedDataClassOrder */);
|
622
624
|
}
|
623
625
|
ClassType.isSynthesizedDataclassOrder = isSynthesizedDataclassOrder;
|
624
626
|
function isDataClassKeywordOnlyParams(classType) {
|
625
|
-
return !!(classType.details.flags & 2097152 /* DataClassKeywordOnlyParams */);
|
627
|
+
return !!(classType.details.flags & 2097152 /* ClassTypeFlags.DataClassKeywordOnlyParams */);
|
626
628
|
}
|
627
629
|
ClassType.isDataClassKeywordOnlyParams = isDataClassKeywordOnlyParams;
|
628
630
|
function isGeneratedDataClassSlots(classType) {
|
629
|
-
return !!(classType.details.flags & 33554432 /* GenerateDataClassSlots */);
|
631
|
+
return !!(classType.details.flags & 33554432 /* ClassTypeFlags.GenerateDataClassSlots */);
|
630
632
|
}
|
631
633
|
ClassType.isGeneratedDataClassSlots = isGeneratedDataClassSlots;
|
632
634
|
function isSynthesizeDataClassUnsafeHash(classType) {
|
633
|
-
return !!(classType.details.flags & 67108864 /* SynthesizeDataClassUnsafeHash */);
|
635
|
+
return !!(classType.details.flags & 67108864 /* ClassTypeFlags.SynthesizeDataClassUnsafeHash */);
|
634
636
|
}
|
635
637
|
ClassType.isSynthesizeDataClassUnsafeHash = isSynthesizeDataClassUnsafeHash;
|
636
638
|
function isTypeCheckOnly(classType) {
|
637
|
-
return !!(classType.details.flags & 134217728 /* TypeCheckOnly */);
|
639
|
+
return !!(classType.details.flags & 134217728 /* ClassTypeFlags.TypeCheckOnly */);
|
638
640
|
}
|
639
641
|
ClassType.isTypeCheckOnly = isTypeCheckOnly;
|
640
642
|
function isTypedDictClass(classType) {
|
641
|
-
return !!(classType.details.flags & 128 /* TypedDictClass */);
|
643
|
+
return !!(classType.details.flags & 128 /* ClassTypeFlags.TypedDictClass */);
|
642
644
|
}
|
643
645
|
ClassType.isTypedDictClass = isTypedDictClass;
|
644
646
|
function isCanOmitDictValues(classType) {
|
645
|
-
return !!(classType.details.flags & 256 /* CanOmitDictValues */);
|
647
|
+
return !!(classType.details.flags & 256 /* ClassTypeFlags.CanOmitDictValues */);
|
646
648
|
}
|
647
649
|
ClassType.isCanOmitDictValues = isCanOmitDictValues;
|
648
650
|
function isEnumClass(classType) {
|
649
|
-
return !!(classType.details.flags & 1048576 /* EnumClass */);
|
651
|
+
return !!(classType.details.flags & 1048576 /* ClassTypeFlags.EnumClass */);
|
650
652
|
}
|
651
653
|
ClassType.isEnumClass = isEnumClass;
|
652
654
|
function isPropertyClass(classType) {
|
653
|
-
return !!(classType.details.flags & 2048 /* PropertyClass */);
|
655
|
+
return !!(classType.details.flags & 2048 /* ClassTypeFlags.PropertyClass */);
|
654
656
|
}
|
655
657
|
ClassType.isPropertyClass = isPropertyClass;
|
656
658
|
function isClassProperty(classType) {
|
657
|
-
return !!(classType.details.flags & 4194304 /* ClassProperty */);
|
659
|
+
return !!(classType.details.flags & 4194304 /* ClassTypeFlags.ClassProperty */);
|
658
660
|
}
|
659
661
|
ClassType.isClassProperty = isClassProperty;
|
660
662
|
function isFinal(classType) {
|
661
|
-
return !!(classType.details.flags & 4096 /* Final */);
|
663
|
+
return !!(classType.details.flags & 4096 /* ClassTypeFlags.Final */);
|
662
664
|
}
|
663
665
|
ClassType.isFinal = isFinal;
|
664
666
|
function isProtocolClass(classType) {
|
665
|
-
return !!(classType.details.flags & 8192 /* ProtocolClass */);
|
667
|
+
return !!(classType.details.flags & 8192 /* ClassTypeFlags.ProtocolClass */);
|
666
668
|
}
|
667
669
|
ClassType.isProtocolClass = isProtocolClass;
|
668
670
|
function isDefinedInStub(classType) {
|
669
|
-
return !!(classType.details.flags & 8388608 /* DefinedInStub */);
|
671
|
+
return !!(classType.details.flags & 8388608 /* ClassTypeFlags.DefinedInStub */);
|
670
672
|
}
|
671
673
|
ClassType.isDefinedInStub = isDefinedInStub;
|
672
674
|
function isPseudoGenericClass(classType) {
|
673
|
-
return !!(classType.details.flags & 16384 /* PseudoGenericClass */);
|
675
|
+
return !!(classType.details.flags & 16384 /* ClassTypeFlags.PseudoGenericClass */);
|
674
676
|
}
|
675
677
|
ClassType.isPseudoGenericClass = isPseudoGenericClass;
|
676
678
|
function getDataClassEntries(classType) {
|
@@ -678,27 +680,27 @@ var ClassType;
|
|
678
680
|
}
|
679
681
|
ClassType.getDataClassEntries = getDataClassEntries;
|
680
682
|
function isRuntimeCheckable(classType) {
|
681
|
-
return !!(classType.details.flags & 32768 /* RuntimeCheckable */);
|
683
|
+
return !!(classType.details.flags & 32768 /* ClassTypeFlags.RuntimeCheckable */);
|
682
684
|
}
|
683
685
|
ClassType.isRuntimeCheckable = isRuntimeCheckable;
|
684
686
|
function isTypingExtensionClass(classType) {
|
685
|
-
return !!(classType.details.flags & 65536 /* TypingExtensionClass */);
|
687
|
+
return !!(classType.details.flags & 65536 /* ClassTypeFlags.TypingExtensionClass */);
|
686
688
|
}
|
687
689
|
ClassType.isTypingExtensionClass = isTypingExtensionClass;
|
688
690
|
function isPartiallyEvaluated(classType) {
|
689
|
-
return !!(classType.details.flags & 131072 /* PartiallyEvaluated */);
|
691
|
+
return !!(classType.details.flags & 131072 /* ClassTypeFlags.PartiallyEvaluated */);
|
690
692
|
}
|
691
693
|
ClassType.isPartiallyEvaluated = isPartiallyEvaluated;
|
692
694
|
function hasCustomClassGetItem(classType) {
|
693
|
-
return !!(classType.details.flags & 262144 /* HasCustomClassGetItem */);
|
695
|
+
return !!(classType.details.flags & 262144 /* ClassTypeFlags.HasCustomClassGetItem */);
|
694
696
|
}
|
695
697
|
ClassType.hasCustomClassGetItem = hasCustomClassGetItem;
|
696
698
|
function isTupleClass(classType) {
|
697
|
-
return !!(classType.details.flags & 524288 /* TupleClass */);
|
699
|
+
return !!(classType.details.flags & 524288 /* ClassTypeFlags.TupleClass */);
|
698
700
|
}
|
699
701
|
ClassType.isTupleClass = isTupleClass;
|
700
702
|
function isReadOnlyInstanceVariables(classType) {
|
701
|
-
return !!(classType.details.flags & 16777216 /* ReadOnlyInstanceVariables */);
|
703
|
+
return !!(classType.details.flags & 16777216 /* ClassTypeFlags.ReadOnlyInstanceVariables */);
|
702
704
|
}
|
703
705
|
ClassType.isReadOnlyInstanceVariables = isReadOnlyInstanceVariables;
|
704
706
|
function getTypeParameters(classType) {
|
@@ -829,15 +831,15 @@ var ClassType;
|
|
829
831
|
return classType.details.mro.slice(0).reverse();
|
830
832
|
}
|
831
833
|
ClassType.getReverseMro = getReverseMro;
|
832
|
-
})(ClassType
|
834
|
+
})(ClassType || (exports.ClassType = ClassType = {}));
|
833
835
|
function isPositionOnlySeparator(param) {
|
834
836
|
// A simple parameter with no name is treated as a "/" separator.
|
835
|
-
return param.category === 0 /* Simple */ && !param.name;
|
837
|
+
return param.category === 0 /* ParameterCategory.Simple */ && !param.name;
|
836
838
|
}
|
837
839
|
exports.isPositionOnlySeparator = isPositionOnlySeparator;
|
838
840
|
function isKeywordOnlySeparator(param) {
|
839
841
|
// An *args parameter with no name is treated as a "*" separator.
|
840
|
-
return param.category === 1 /* ArgsList */ && !param.name;
|
842
|
+
return param.category === 1 /* ParameterCategory.ArgsList */ && !param.name;
|
841
843
|
}
|
842
844
|
exports.isKeywordOnlySeparator = isKeywordOnlySeparator;
|
843
845
|
var FunctionTypeFlags;
|
@@ -891,24 +893,24 @@ var FunctionTypeFlags;
|
|
891
893
|
FunctionTypeFlags[FunctionTypeFlags["PartiallyEvaluated"] = 131072] = "PartiallyEvaluated";
|
892
894
|
// Decorated with @override as defined in PEP 698.
|
893
895
|
FunctionTypeFlags[FunctionTypeFlags["Overridden"] = 262144] = "Overridden";
|
894
|
-
})(FunctionTypeFlags
|
896
|
+
})(FunctionTypeFlags || (exports.FunctionTypeFlags = FunctionTypeFlags = {}));
|
895
897
|
var FunctionType;
|
896
898
|
(function (FunctionType) {
|
897
899
|
function createInstance(name, fullName, moduleName, functionFlags, docString) {
|
898
|
-
return create(name, fullName, moduleName, functionFlags, 2 /* Instance */, docString);
|
900
|
+
return create(name, fullName, moduleName, functionFlags, 2 /* TypeFlags.Instance */, docString);
|
899
901
|
}
|
900
902
|
FunctionType.createInstance = createInstance;
|
901
903
|
function createInstantiable(functionFlags, docString) {
|
902
|
-
return create('', '', '', functionFlags, 1 /* Instantiable */, docString);
|
904
|
+
return create('', '', '', functionFlags, 1 /* TypeFlags.Instantiable */, docString);
|
903
905
|
}
|
904
906
|
FunctionType.createInstantiable = createInstantiable;
|
905
|
-
function createSynthesizedInstance(name, additionalFlags = 0 /* None */) {
|
906
|
-
return create(name, '', '', additionalFlags | 64 /* SynthesizedMethod */, 2 /* Instance */);
|
907
|
+
function createSynthesizedInstance(name, additionalFlags = 0 /* FunctionTypeFlags.None */) {
|
908
|
+
return create(name, '', '', additionalFlags | 64 /* FunctionTypeFlags.SynthesizedMethod */, 2 /* TypeFlags.Instance */);
|
907
909
|
}
|
908
910
|
FunctionType.createSynthesizedInstance = createSynthesizedInstance;
|
909
911
|
function create(name, fullName, moduleName, functionFlags, typeFlags, docString) {
|
910
912
|
const newFunctionType = {
|
911
|
-
category: 4 /* Function */,
|
913
|
+
category: 4 /* TypeCategory.Function */,
|
912
914
|
details: {
|
913
915
|
name,
|
914
916
|
fullName,
|
@@ -932,7 +934,7 @@ var FunctionType;
|
|
932
934
|
newFunction.preBoundFlags = newFunction.details.flags;
|
933
935
|
if (stripFirstParam) {
|
934
936
|
if (type.details.parameters.length > 0) {
|
935
|
-
if (type.details.parameters[0].category === 0 /* Simple */) {
|
937
|
+
if (type.details.parameters[0].category === 0 /* ParameterCategory.Simple */) {
|
936
938
|
if (type.details.parameters.length > 0 && !type.details.parameters[0].isTypeInferred) {
|
937
939
|
// Stash away the effective type of the first parameter if it
|
938
940
|
// wasn't synthesized.
|
@@ -946,8 +948,8 @@ var FunctionType;
|
|
946
948
|
}
|
947
949
|
// If we strip off the first parameter, this is no longer an
|
948
950
|
// instance method or class method.
|
949
|
-
newFunction.details.flags &= ~(1 /* ConstructorMethod */ | 2 /* ClassMethod */);
|
950
|
-
newFunction.details.flags |= 4 /* StaticMethod */;
|
951
|
+
newFunction.details.flags &= ~(1 /* FunctionTypeFlags.ConstructorMethod */ | 2 /* FunctionTypeFlags.ClassMethod */);
|
952
|
+
newFunction.details.flags |= 4 /* FunctionTypeFlags.StaticMethod */;
|
951
953
|
}
|
952
954
|
if (type.typeAliasInfo !== undefined) {
|
953
955
|
newFunction.typeAliasInfo = type.typeAliasInfo;
|
@@ -974,7 +976,7 @@ var FunctionType;
|
|
974
976
|
return type.cached.typeBaseInstanceType;
|
975
977
|
}
|
976
978
|
const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ true);
|
977
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
979
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
978
980
|
return newInstance;
|
979
981
|
}
|
980
982
|
FunctionType.cloneAsInstance = cloneAsInstance;
|
@@ -984,7 +986,7 @@ var FunctionType;
|
|
984
986
|
return type.cached.typeBaseInstantiableType;
|
985
987
|
}
|
986
988
|
const newInstance = TypeBase.cloneTypeAsInstantiable(type, /* cache */ true);
|
987
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
989
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
988
990
|
return newInstance;
|
989
991
|
}
|
990
992
|
FunctionType.cloneAsInstantiable = cloneAsInstantiable;
|
@@ -1036,14 +1038,14 @@ var FunctionType;
|
|
1036
1038
|
}
|
1037
1039
|
newFunction.details.flags =
|
1038
1040
|
(paramSpecValue.details.flags &
|
1039
|
-
(2 /* ClassMethod */ |
|
1040
|
-
4 /* StaticMethod */ |
|
1041
|
-
1 /* ConstructorMethod */ |
|
1042
|
-
256 /* Overloaded */ |
|
1043
|
-
32768 /* SkipArgsKwargsCompatibilityCheck */)) |
|
1044
|
-
64 /* SynthesizedMethod */;
|
1041
|
+
(2 /* FunctionTypeFlags.ClassMethod */ |
|
1042
|
+
4 /* FunctionTypeFlags.StaticMethod */ |
|
1043
|
+
1 /* FunctionTypeFlags.ConstructorMethod */ |
|
1044
|
+
256 /* FunctionTypeFlags.Overloaded */ |
|
1045
|
+
32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */)) |
|
1046
|
+
64 /* FunctionTypeFlags.SynthesizedMethod */;
|
1045
1047
|
if (FunctionType.isParamSpecValue(type)) {
|
1046
|
-
newFunction.details.flags |= 65536 /* ParamSpecValue */;
|
1048
|
+
newFunction.details.flags |= 65536 /* FunctionTypeFlags.ParamSpecValue */;
|
1047
1049
|
}
|
1048
1050
|
// Update the specialized parameter types as well.
|
1049
1051
|
if (type.specializedTypes) {
|
@@ -1116,9 +1118,9 @@ var FunctionType;
|
|
1116
1118
|
newFunction.specializedTypes.parameterTypes = newFunction.specializedTypes.parameterTypes.slice(0, newFunction.specializedTypes.parameterTypes.length - 2);
|
1117
1119
|
}
|
1118
1120
|
// Update the flags of the function.
|
1119
|
-
newFunction.details.flags &= ~32768 /* SkipArgsKwargsCompatibilityCheck */;
|
1120
|
-
if (paramSpecValue.details.flags & 32768 /* SkipArgsKwargsCompatibilityCheck */) {
|
1121
|
-
newFunction.details.flags |= 32768 /* SkipArgsKwargsCompatibilityCheck */;
|
1121
|
+
newFunction.details.flags &= ~32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */;
|
1122
|
+
if (paramSpecValue.details.flags & 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */) {
|
1123
|
+
newFunction.details.flags |= 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */;
|
1122
1124
|
}
|
1123
1125
|
// If there is a position-only separator in the captured param spec signature,
|
1124
1126
|
// remove the position-only separator in the existing signature. Otherwise,
|
@@ -1185,13 +1187,13 @@ var FunctionType;
|
|
1185
1187
|
function getDefaultParameters(useUnknown = false) {
|
1186
1188
|
return [
|
1187
1189
|
{
|
1188
|
-
category: 1 /* ArgsList */,
|
1190
|
+
category: 1 /* ParameterCategory.ArgsList */,
|
1189
1191
|
name: 'args',
|
1190
1192
|
type: useUnknown ? UnknownType.create() : AnyType.create(),
|
1191
1193
|
hasDeclaredType: !useUnknown,
|
1192
1194
|
},
|
1193
1195
|
{
|
1194
|
-
category: 2 /* KwargsDict */,
|
1196
|
+
category: 2 /* ParameterCategory.KwargsDict */,
|
1195
1197
|
name: 'kwargs',
|
1196
1198
|
type: useUnknown ? UnknownType.create() : AnyType.create(),
|
1197
1199
|
hasDeclaredType: !useUnknown,
|
@@ -1209,13 +1211,13 @@ var FunctionType;
|
|
1209
1211
|
if (!param.name) {
|
1210
1212
|
continue;
|
1211
1213
|
}
|
1212
|
-
if (param.category === 0 /* Simple */) {
|
1214
|
+
if (param.category === 0 /* ParameterCategory.Simple */) {
|
1213
1215
|
return false;
|
1214
1216
|
}
|
1215
|
-
else if (param.category === 1 /* ArgsList */) {
|
1217
|
+
else if (param.category === 1 /* ParameterCategory.ArgsList */) {
|
1216
1218
|
sawArgs = true;
|
1217
1219
|
}
|
1218
|
-
else if (param.category === 2 /* KwargsDict */) {
|
1220
|
+
else if (param.category === 2 /* ParameterCategory.KwargsDict */) {
|
1219
1221
|
sawKwargs = true;
|
1220
1222
|
}
|
1221
1223
|
if (!isAnyOrUnknown(FunctionType.getEffectiveParameterType(functionType, i))) {
|
@@ -1227,82 +1229,82 @@ var FunctionType;
|
|
1227
1229
|
FunctionType.hasDefaultParameters = hasDefaultParameters;
|
1228
1230
|
function isInstanceMethod(type) {
|
1229
1231
|
return ((type.details.flags &
|
1230
|
-
(1 /* ConstructorMethod */ |
|
1231
|
-
4 /* StaticMethod */ |
|
1232
|
-
2 /* ClassMethod */)) ===
|
1232
|
+
(1 /* FunctionTypeFlags.ConstructorMethod */ |
|
1233
|
+
4 /* FunctionTypeFlags.StaticMethod */ |
|
1234
|
+
2 /* FunctionTypeFlags.ClassMethod */)) ===
|
1233
1235
|
0);
|
1234
1236
|
}
|
1235
1237
|
FunctionType.isInstanceMethod = isInstanceMethod;
|
1236
1238
|
function isConstructorMethod(type) {
|
1237
|
-
return (type.details.flags & 1 /* ConstructorMethod */) !== 0;
|
1239
|
+
return (type.details.flags & 1 /* FunctionTypeFlags.ConstructorMethod */) !== 0;
|
1238
1240
|
}
|
1239
1241
|
FunctionType.isConstructorMethod = isConstructorMethod;
|
1240
1242
|
function isStaticMethod(type) {
|
1241
|
-
return (type.details.flags & 4 /* StaticMethod */) !== 0;
|
1243
|
+
return (type.details.flags & 4 /* FunctionTypeFlags.StaticMethod */) !== 0;
|
1242
1244
|
}
|
1243
1245
|
FunctionType.isStaticMethod = isStaticMethod;
|
1244
1246
|
function isClassMethod(type) {
|
1245
|
-
return (type.details.flags & 2 /* ClassMethod */) !== 0;
|
1247
|
+
return (type.details.flags & 2 /* FunctionTypeFlags.ClassMethod */) !== 0;
|
1246
1248
|
}
|
1247
1249
|
FunctionType.isClassMethod = isClassMethod;
|
1248
1250
|
function isAbstractMethod(type) {
|
1249
|
-
return (type.details.flags & 8 /* AbstractMethod */) !== 0;
|
1251
|
+
return (type.details.flags & 8 /* FunctionTypeFlags.AbstractMethod */) !== 0;
|
1250
1252
|
}
|
1251
1253
|
FunctionType.isAbstractMethod = isAbstractMethod;
|
1252
1254
|
function isGenerator(type) {
|
1253
|
-
return (type.details.flags & 16 /* Generator */) !== 0;
|
1255
|
+
return (type.details.flags & 16 /* FunctionTypeFlags.Generator */) !== 0;
|
1254
1256
|
}
|
1255
1257
|
FunctionType.isGenerator = isGenerator;
|
1256
1258
|
function isSynthesizedMethod(type) {
|
1257
|
-
return (type.details.flags & 64 /* SynthesizedMethod */) !== 0;
|
1259
|
+
return (type.details.flags & 64 /* FunctionTypeFlags.SynthesizedMethod */) !== 0;
|
1258
1260
|
}
|
1259
1261
|
FunctionType.isSynthesizedMethod = isSynthesizedMethod;
|
1260
1262
|
function isTypeCheckOnly(type) {
|
1261
|
-
return (type.details.flags & 128 /* TypeCheckOnly */) !== 0;
|
1263
|
+
return (type.details.flags & 128 /* FunctionTypeFlags.TypeCheckOnly */) !== 0;
|
1262
1264
|
}
|
1263
1265
|
FunctionType.isTypeCheckOnly = isTypeCheckOnly;
|
1264
1266
|
function isOverloaded(type) {
|
1265
|
-
return (type.details.flags & 256 /* Overloaded */) !== 0;
|
1267
|
+
return (type.details.flags & 256 /* FunctionTypeFlags.Overloaded */) !== 0;
|
1266
1268
|
}
|
1267
1269
|
FunctionType.isOverloaded = isOverloaded;
|
1268
1270
|
function isDefaultParameterCheckDisabled(type) {
|
1269
|
-
return (type.details.flags & 32 /* DisableDefaultChecks */) !== 0;
|
1271
|
+
return (type.details.flags & 32 /* FunctionTypeFlags.DisableDefaultChecks */) !== 0;
|
1270
1272
|
}
|
1271
1273
|
FunctionType.isDefaultParameterCheckDisabled = isDefaultParameterCheckDisabled;
|
1272
1274
|
function isAsync(type) {
|
1273
|
-
return (type.details.flags & 512 /* Async */) !== 0;
|
1275
|
+
return (type.details.flags & 512 /* FunctionTypeFlags.Async */) !== 0;
|
1274
1276
|
}
|
1275
1277
|
FunctionType.isAsync = isAsync;
|
1276
1278
|
function isStubDefinition(type) {
|
1277
|
-
return (type.details.flags & 2048 /* StubDefinition */) !== 0;
|
1279
|
+
return (type.details.flags & 2048 /* FunctionTypeFlags.StubDefinition */) !== 0;
|
1278
1280
|
}
|
1279
1281
|
FunctionType.isStubDefinition = isStubDefinition;
|
1280
1282
|
function isPyTypedDefinition(type) {
|
1281
|
-
return (type.details.flags & 4096 /* PyTypedDefinition */) !== 0;
|
1283
|
+
return (type.details.flags & 4096 /* FunctionTypeFlags.PyTypedDefinition */) !== 0;
|
1282
1284
|
}
|
1283
1285
|
FunctionType.isPyTypedDefinition = isPyTypedDefinition;
|
1284
1286
|
function isFinal(type) {
|
1285
|
-
return (type.details.flags & 8192 /* Final */) !== 0;
|
1287
|
+
return (type.details.flags & 8192 /* FunctionTypeFlags.Final */) !== 0;
|
1286
1288
|
}
|
1287
1289
|
FunctionType.isFinal = isFinal;
|
1288
1290
|
function hasUnannotatedParams(type) {
|
1289
|
-
return (type.details.flags & 16384 /* UnannotatedParams */) !== 0;
|
1291
|
+
return (type.details.flags & 16384 /* FunctionTypeFlags.UnannotatedParams */) !== 0;
|
1290
1292
|
}
|
1291
1293
|
FunctionType.hasUnannotatedParams = hasUnannotatedParams;
|
1292
1294
|
function shouldSkipArgsKwargsCompatibilityCheck(type) {
|
1293
|
-
return (type.details.flags & 32768 /* SkipArgsKwargsCompatibilityCheck */) !== 0;
|
1295
|
+
return (type.details.flags & 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */) !== 0;
|
1294
1296
|
}
|
1295
1297
|
FunctionType.shouldSkipArgsKwargsCompatibilityCheck = shouldSkipArgsKwargsCompatibilityCheck;
|
1296
1298
|
function isParamSpecValue(type) {
|
1297
|
-
return (type.details.flags & 65536 /* ParamSpecValue */) !== 0;
|
1299
|
+
return (type.details.flags & 65536 /* FunctionTypeFlags.ParamSpecValue */) !== 0;
|
1298
1300
|
}
|
1299
1301
|
FunctionType.isParamSpecValue = isParamSpecValue;
|
1300
1302
|
function isPartiallyEvaluated(type) {
|
1301
|
-
return !!(type.details.flags & 131072 /* PartiallyEvaluated */);
|
1303
|
+
return !!(type.details.flags & 131072 /* FunctionTypeFlags.PartiallyEvaluated */);
|
1302
1304
|
}
|
1303
1305
|
FunctionType.isPartiallyEvaluated = isPartiallyEvaluated;
|
1304
1306
|
function isOverridden(type) {
|
1305
|
-
return !!(type.details.flags & 262144 /* Overridden */);
|
1307
|
+
return !!(type.details.flags & 262144 /* FunctionTypeFlags.Overridden */);
|
1306
1308
|
}
|
1307
1309
|
FunctionType.isOverridden = isOverridden;
|
1308
1310
|
function getEffectiveParameterType(type, index) {
|
@@ -1332,20 +1334,28 @@ var FunctionType;
|
|
1332
1334
|
}
|
1333
1335
|
}
|
1334
1336
|
FunctionType.addParameter = addParameter;
|
1335
|
-
function getSpecializedReturnType(type) {
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1337
|
+
function getSpecializedReturnType(type, includeInferred = true) {
|
1338
|
+
var _a;
|
1339
|
+
if ((_a = type.specializedTypes) === null || _a === void 0 ? void 0 : _a.returnType) {
|
1340
|
+
return type.specializedTypes.returnType;
|
1341
|
+
}
|
1342
|
+
if (type.details.declaredReturnType) {
|
1343
|
+
return type.details.declaredReturnType;
|
1344
|
+
}
|
1345
|
+
if (includeInferred) {
|
1346
|
+
return type.inferredReturnType;
|
1347
|
+
}
|
1348
|
+
return undefined;
|
1339
1349
|
}
|
1340
1350
|
FunctionType.getSpecializedReturnType = getSpecializedReturnType;
|
1341
|
-
})(FunctionType
|
1351
|
+
})(FunctionType || (exports.FunctionType = FunctionType = {}));
|
1342
1352
|
var OverloadedFunctionType;
|
1343
1353
|
(function (OverloadedFunctionType) {
|
1344
1354
|
function create(overloads) {
|
1345
1355
|
const newType = {
|
1346
|
-
category: 5 /* OverloadedFunction */,
|
1356
|
+
category: 5 /* TypeCategory.OverloadedFunction */,
|
1347
1357
|
overloads: [],
|
1348
|
-
flags: 2 /* Instance */,
|
1358
|
+
flags: 2 /* TypeFlags.Instance */,
|
1349
1359
|
};
|
1350
1360
|
overloads.forEach((overload) => {
|
1351
1361
|
OverloadedFunctionType.addOverload(newType, overload);
|
@@ -1367,17 +1377,17 @@ var OverloadedFunctionType;
|
|
1367
1377
|
return type.overloads.find((func) => !FunctionType.isOverloaded(func));
|
1368
1378
|
}
|
1369
1379
|
OverloadedFunctionType.getImplementation = getImplementation;
|
1370
|
-
})(OverloadedFunctionType
|
1380
|
+
})(OverloadedFunctionType || (exports.OverloadedFunctionType = OverloadedFunctionType = {}));
|
1371
1381
|
var NeverType;
|
1372
1382
|
(function (NeverType) {
|
1373
1383
|
const _neverInstance = {
|
1374
|
-
category: 3 /* Never */,
|
1375
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1384
|
+
category: 3 /* TypeCategory.Never */,
|
1385
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1376
1386
|
isNoReturn: false,
|
1377
1387
|
};
|
1378
1388
|
const _noReturnInstance = {
|
1379
|
-
category: 3 /* Never */,
|
1380
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1389
|
+
category: 3 /* TypeCategory.Never */,
|
1390
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1381
1391
|
isNoReturn: true,
|
1382
1392
|
};
|
1383
1393
|
function createNever() {
|
@@ -1388,23 +1398,23 @@ var NeverType;
|
|
1388
1398
|
return _noReturnInstance;
|
1389
1399
|
}
|
1390
1400
|
NeverType.createNoReturn = createNoReturn;
|
1391
|
-
})(NeverType
|
1401
|
+
})(NeverType || (exports.NeverType = NeverType = {}));
|
1392
1402
|
var AnyType;
|
1393
1403
|
(function (AnyType) {
|
1394
1404
|
const _anyInstanceSpecialForm = {
|
1395
|
-
category: 2 /* Any */,
|
1405
|
+
category: 2 /* TypeCategory.Any */,
|
1396
1406
|
isEllipsis: false,
|
1397
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */ | 8 /* SpecialForm */,
|
1407
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */ | 8 /* TypeFlags.SpecialForm */,
|
1398
1408
|
};
|
1399
1409
|
const _anyInstance = {
|
1400
|
-
category: 2 /* Any */,
|
1410
|
+
category: 2 /* TypeCategory.Any */,
|
1401
1411
|
isEllipsis: false,
|
1402
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1412
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1403
1413
|
};
|
1404
1414
|
const _ellipsisInstance = {
|
1405
|
-
category: 2 /* Any */,
|
1415
|
+
category: 2 /* TypeCategory.Any */,
|
1406
1416
|
isEllipsis: true,
|
1407
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1417
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1408
1418
|
};
|
1409
1419
|
function create(isEllipsis = false) {
|
1410
1420
|
return isEllipsis ? _ellipsisInstance : _anyInstance;
|
@@ -1414,7 +1424,7 @@ var AnyType;
|
|
1414
1424
|
return _anyInstanceSpecialForm;
|
1415
1425
|
}
|
1416
1426
|
AnyType.createSpecialForm = createSpecialForm;
|
1417
|
-
})(AnyType
|
1427
|
+
})(AnyType || (exports.AnyType = AnyType = {}));
|
1418
1428
|
(function (AnyType) {
|
1419
1429
|
function convertToInstance(type) {
|
1420
1430
|
// Remove the "special form" flag if it's set. Otherwise
|
@@ -1425,7 +1435,7 @@ var AnyType;
|
|
1425
1435
|
return type;
|
1426
1436
|
}
|
1427
1437
|
AnyType.convertToInstance = convertToInstance;
|
1428
|
-
})(AnyType
|
1438
|
+
})(AnyType || (exports.AnyType = AnyType = {}));
|
1429
1439
|
var TypeCondition;
|
1430
1440
|
(function (TypeCondition) {
|
1431
1441
|
function combine(conditions1, conditions2) {
|
@@ -1496,14 +1506,14 @@ var TypeCondition;
|
|
1496
1506
|
return true;
|
1497
1507
|
}
|
1498
1508
|
TypeCondition.isCompatible = isCompatible;
|
1499
|
-
})(TypeCondition
|
1509
|
+
})(TypeCondition || (exports.TypeCondition = TypeCondition = {}));
|
1500
1510
|
var UnionType;
|
1501
1511
|
(function (UnionType) {
|
1502
1512
|
function create() {
|
1503
1513
|
const newUnionType = {
|
1504
|
-
category: 8 /* Union */,
|
1514
|
+
category: 8 /* TypeCategory.Union */,
|
1505
1515
|
subtypes: [],
|
1506
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1516
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1507
1517
|
};
|
1508
1518
|
return newUnionType;
|
1509
1519
|
}
|
@@ -1574,7 +1584,7 @@ var UnionType;
|
|
1574
1584
|
}
|
1575
1585
|
UnionType.containsType = containsType;
|
1576
1586
|
function addTypeAliasSource(unionType, typeAliasSource) {
|
1577
|
-
if (typeAliasSource.category === 8 /* Union */) {
|
1587
|
+
if (typeAliasSource.category === 8 /* TypeCategory.Union */) {
|
1578
1588
|
const sourcesToAdd = typeAliasSource.typeAliasInfo ? [typeAliasSource] : typeAliasSource.typeAliasSources;
|
1579
1589
|
if (sourcesToAdd) {
|
1580
1590
|
if (!unionType.typeAliasSources) {
|
@@ -1587,7 +1597,7 @@ var UnionType;
|
|
1587
1597
|
}
|
1588
1598
|
}
|
1589
1599
|
UnionType.addTypeAliasSource = addTypeAliasSource;
|
1590
|
-
})(UnionType
|
1600
|
+
})(UnionType || (exports.UnionType = UnionType = {}));
|
1591
1601
|
var Variance;
|
1592
1602
|
(function (Variance) {
|
1593
1603
|
Variance[Variance["Auto"] = 0] = "Auto";
|
@@ -1595,21 +1605,21 @@ var Variance;
|
|
1595
1605
|
Variance[Variance["Invariant"] = 2] = "Invariant";
|
1596
1606
|
Variance[Variance["Covariant"] = 3] = "Covariant";
|
1597
1607
|
Variance[Variance["Contravariant"] = 4] = "Contravariant";
|
1598
|
-
})(Variance
|
1608
|
+
})(Variance || (exports.Variance = Variance = {}));
|
1599
1609
|
var TypeVarScopeType;
|
1600
1610
|
(function (TypeVarScopeType) {
|
1601
1611
|
TypeVarScopeType[TypeVarScopeType["Class"] = 0] = "Class";
|
1602
1612
|
TypeVarScopeType[TypeVarScopeType["Function"] = 1] = "Function";
|
1603
1613
|
TypeVarScopeType[TypeVarScopeType["TypeAlias"] = 2] = "TypeAlias";
|
1604
|
-
})(TypeVarScopeType
|
1614
|
+
})(TypeVarScopeType || (exports.TypeVarScopeType = TypeVarScopeType = {}));
|
1605
1615
|
var TypeVarType;
|
1606
1616
|
(function (TypeVarType) {
|
1607
1617
|
function createInstance(name) {
|
1608
|
-
return create(name, /* isParamSpec */ false, 2 /* Instance */);
|
1618
|
+
return create(name, /* isParamSpec */ false, 2 /* TypeFlags.Instance */);
|
1609
1619
|
}
|
1610
1620
|
TypeVarType.createInstance = createInstance;
|
1611
1621
|
function createInstantiable(name, isParamSpec = false, runtimeClass) {
|
1612
|
-
return create(name, isParamSpec, 1 /* Instantiable */, runtimeClass);
|
1622
|
+
return create(name, isParamSpec, 1 /* TypeFlags.Instantiable */, runtimeClass);
|
1613
1623
|
}
|
1614
1624
|
TypeVarType.createInstantiable = createInstantiable;
|
1615
1625
|
function cloneAsInstance(type) {
|
@@ -1619,7 +1629,7 @@ var TypeVarType;
|
|
1619
1629
|
return type.cached.typeBaseInstanceType;
|
1620
1630
|
}
|
1621
1631
|
const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ true);
|
1622
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
1632
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
1623
1633
|
return newInstance;
|
1624
1634
|
}
|
1625
1635
|
TypeVarType.cloneAsInstance = cloneAsInstance;
|
@@ -1629,7 +1639,7 @@ var TypeVarType;
|
|
1629
1639
|
return type.cached.typeBaseInstantiableType;
|
1630
1640
|
}
|
1631
1641
|
const newInstance = TypeBase.cloneTypeAsInstantiable(type, /* cache */ true);
|
1632
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
1642
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
1633
1643
|
return newInstance;
|
1634
1644
|
}
|
1635
1645
|
TypeVarType.cloneAsInstantiable = cloneAsInstantiable;
|
@@ -1675,17 +1685,17 @@ var TypeVarType;
|
|
1675
1685
|
if (type.details.isParamSpec || type.details.isVariadic) {
|
1676
1686
|
return type;
|
1677
1687
|
}
|
1678
|
-
if (type.details.declaredVariance === 0 /* Auto */) {
|
1688
|
+
if (type.details.declaredVariance === 0 /* Variance.Auto */) {
|
1679
1689
|
return type;
|
1680
1690
|
}
|
1681
|
-
if (type.details.declaredVariance === 2 /* Invariant */) {
|
1691
|
+
if (type.details.declaredVariance === 2 /* Variance.Invariant */) {
|
1682
1692
|
if (type.details.boundType === undefined && type.details.constraints.length === 0) {
|
1683
1693
|
return type;
|
1684
1694
|
}
|
1685
1695
|
}
|
1686
1696
|
const newInstance = TypeBase.cloneType(type);
|
1687
1697
|
newInstance.details = { ...newInstance.details };
|
1688
|
-
newInstance.details.declaredVariance = 2 /* Invariant */;
|
1698
|
+
newInstance.details.declaredVariance = 2 /* Variance.Invariant */;
|
1689
1699
|
newInstance.details.boundType = undefined;
|
1690
1700
|
newInstance.details.constraints = [];
|
1691
1701
|
return newInstance;
|
@@ -1730,11 +1740,11 @@ var TypeVarType;
|
|
1730
1740
|
TypeVarType.makeNameWithScope = makeNameWithScope;
|
1731
1741
|
function create(name, isParamSpec, typeFlags, runtimeClass) {
|
1732
1742
|
const newTypeVarType = {
|
1733
|
-
category: 9 /* TypeVar */,
|
1743
|
+
category: 9 /* TypeCategory.TypeVar */,
|
1734
1744
|
details: {
|
1735
1745
|
name,
|
1736
1746
|
constraints: [],
|
1737
|
-
declaredVariance: 2 /* Invariant */,
|
1747
|
+
declaredVariance: 2 /* Variance.Invariant */,
|
1738
1748
|
isParamSpec,
|
1739
1749
|
isVariadic: false,
|
1740
1750
|
isSynthesized: false,
|
@@ -1764,11 +1774,11 @@ var TypeVarType;
|
|
1764
1774
|
var _a;
|
1765
1775
|
const variance = (_a = type.computedVariance) !== null && _a !== void 0 ? _a : type.details.declaredVariance;
|
1766
1776
|
// By this point, the variance should have been inferred.
|
1767
|
-
(0, debug_1.assert)(variance !== 0 /* Auto */, 'Expected variance to be inferred');
|
1777
|
+
(0, debug_1.assert)(variance !== 0 /* Variance.Auto */, 'Expected variance to be inferred');
|
1768
1778
|
// If we're in the process of computing variance, it will still be
|
1769
1779
|
// unknown. Default to covariant in this case.
|
1770
|
-
if (variance === 1 /* Unknown */) {
|
1771
|
-
return 3 /* Covariant */;
|
1780
|
+
if (variance === 1 /* Variance.Unknown */) {
|
1781
|
+
return 3 /* Variance.Covariant */;
|
1772
1782
|
}
|
1773
1783
|
return variance;
|
1774
1784
|
}
|
@@ -1779,21 +1789,21 @@ var TypeVarType;
|
|
1779
1789
|
return !!type.details.recursiveTypeAliasName && !type.details.boundType;
|
1780
1790
|
}
|
1781
1791
|
TypeVarType.isTypeAliasPlaceholder = isTypeAliasPlaceholder;
|
1782
|
-
})(TypeVarType
|
1792
|
+
})(TypeVarType || (exports.TypeVarType = TypeVarType = {}));
|
1783
1793
|
function isNever(type) {
|
1784
|
-
return type.category === 3 /* Never */;
|
1794
|
+
return type.category === 3 /* TypeCategory.Never */;
|
1785
1795
|
}
|
1786
1796
|
exports.isNever = isNever;
|
1787
1797
|
function isAny(type) {
|
1788
|
-
return type.category === 2 /* Any */;
|
1798
|
+
return type.category === 2 /* TypeCategory.Any */;
|
1789
1799
|
}
|
1790
1800
|
exports.isAny = isAny;
|
1791
1801
|
function isUnknown(type) {
|
1792
|
-
return type.category === 1 /* Unknown */;
|
1802
|
+
return type.category === 1 /* TypeCategory.Unknown */;
|
1793
1803
|
}
|
1794
1804
|
exports.isUnknown = isUnknown;
|
1795
1805
|
function isAnyOrUnknown(type) {
|
1796
|
-
if (type.category === 2 /* Any */ || type.category === 1 /* Unknown */) {
|
1806
|
+
if (type.category === 2 /* TypeCategory.Any */ || type.category === 1 /* TypeCategory.Unknown */) {
|
1797
1807
|
return true;
|
1798
1808
|
}
|
1799
1809
|
if (isUnion(type)) {
|
@@ -1803,11 +1813,11 @@ function isAnyOrUnknown(type) {
|
|
1803
1813
|
}
|
1804
1814
|
exports.isAnyOrUnknown = isAnyOrUnknown;
|
1805
1815
|
function isUnbound(type) {
|
1806
|
-
return type.category === 0 /* Unbound */;
|
1816
|
+
return type.category === 0 /* TypeCategory.Unbound */;
|
1807
1817
|
}
|
1808
1818
|
exports.isUnbound = isUnbound;
|
1809
1819
|
function isUnion(type) {
|
1810
|
-
return type.category === 8 /* Union */;
|
1820
|
+
return type.category === 8 /* TypeCategory.Union */;
|
1811
1821
|
}
|
1812
1822
|
exports.isUnion = isUnion;
|
1813
1823
|
function isPossiblyUnbound(type) {
|
@@ -1821,31 +1831,31 @@ function isPossiblyUnbound(type) {
|
|
1821
1831
|
}
|
1822
1832
|
exports.isPossiblyUnbound = isPossiblyUnbound;
|
1823
1833
|
function isClass(type) {
|
1824
|
-
return type.category === 6 /* Class */;
|
1834
|
+
return type.category === 6 /* TypeCategory.Class */;
|
1825
1835
|
}
|
1826
1836
|
exports.isClass = isClass;
|
1827
1837
|
function isInstantiableClass(type) {
|
1828
|
-
return type.category === 6 /* Class */ && TypeBase.isInstantiable(type);
|
1838
|
+
return type.category === 6 /* TypeCategory.Class */ && TypeBase.isInstantiable(type);
|
1829
1839
|
}
|
1830
1840
|
exports.isInstantiableClass = isInstantiableClass;
|
1831
1841
|
function isClassInstance(type) {
|
1832
|
-
return type.category === 6 /* Class */ && TypeBase.isInstance(type);
|
1842
|
+
return type.category === 6 /* TypeCategory.Class */ && TypeBase.isInstance(type);
|
1833
1843
|
}
|
1834
1844
|
exports.isClassInstance = isClassInstance;
|
1835
1845
|
function isModule(type) {
|
1836
|
-
return type.category === 7 /* Module */;
|
1846
|
+
return type.category === 7 /* TypeCategory.Module */;
|
1837
1847
|
}
|
1838
1848
|
exports.isModule = isModule;
|
1839
1849
|
function isTypeVar(type) {
|
1840
|
-
return type.category === 9 /* TypeVar */;
|
1850
|
+
return type.category === 9 /* TypeCategory.TypeVar */;
|
1841
1851
|
}
|
1842
1852
|
exports.isTypeVar = isTypeVar;
|
1843
1853
|
function isVariadicTypeVar(type) {
|
1844
|
-
return type.category === 9 /* TypeVar */ && type.details.isVariadic;
|
1854
|
+
return type.category === 9 /* TypeCategory.TypeVar */ && type.details.isVariadic;
|
1845
1855
|
}
|
1846
1856
|
exports.isVariadicTypeVar = isVariadicTypeVar;
|
1847
1857
|
function isUnpackedVariadicTypeVar(type) {
|
1848
|
-
return (type.category === 9 /* TypeVar */ &&
|
1858
|
+
return (type.category === 9 /* TypeCategory.TypeVar */ &&
|
1849
1859
|
type.details.isVariadic &&
|
1850
1860
|
!!type.isVariadicUnpacked &&
|
1851
1861
|
!type.isVariadicInUnion);
|
@@ -1863,15 +1873,15 @@ function isUnpacked(type) {
|
|
1863
1873
|
}
|
1864
1874
|
exports.isUnpacked = isUnpacked;
|
1865
1875
|
function isParamSpec(type) {
|
1866
|
-
return type.category === 9 /* TypeVar */ && type.details.isParamSpec;
|
1876
|
+
return type.category === 9 /* TypeCategory.TypeVar */ && type.details.isParamSpec;
|
1867
1877
|
}
|
1868
1878
|
exports.isParamSpec = isParamSpec;
|
1869
1879
|
function isFunction(type) {
|
1870
|
-
return type.category === 4 /* Function */;
|
1880
|
+
return type.category === 4 /* TypeCategory.Function */;
|
1871
1881
|
}
|
1872
1882
|
exports.isFunction = isFunction;
|
1873
1883
|
function isOverloadedFunction(type) {
|
1874
|
-
return type.category === 5 /* OverloadedFunction */;
|
1884
|
+
return type.category === 5 /* TypeCategory.OverloadedFunction */;
|
1875
1885
|
}
|
1876
1886
|
exports.isOverloadedFunction = isOverloadedFunction;
|
1877
1887
|
function getTypeAliasInfo(type) {
|
@@ -1897,10 +1907,10 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1897
1907
|
}
|
1898
1908
|
if (type1.category !== type2.category) {
|
1899
1909
|
if (options.treatAnySameAsUnknown) {
|
1900
|
-
if (type1.category === 2 /* Any */ && type2.category === 1 /* Unknown */) {
|
1910
|
+
if (type1.category === 2 /* TypeCategory.Any */ && type2.category === 1 /* TypeCategory.Unknown */) {
|
1901
1911
|
return true;
|
1902
1912
|
}
|
1903
|
-
if (type1.category === 1 /* Unknown */ && type2.category === 2 /* Any */) {
|
1913
|
+
if (type1.category === 1 /* TypeCategory.Unknown */ && type2.category === 2 /* TypeCategory.Any */) {
|
1904
1914
|
return true;
|
1905
1915
|
}
|
1906
1916
|
}
|
@@ -1916,8 +1926,8 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1916
1926
|
}
|
1917
1927
|
else {
|
1918
1928
|
// By default, we don't care about the Annotated flag.
|
1919
|
-
type1Flags &= ~4 /* Annotated */;
|
1920
|
-
type2Flags &= ~4 /* Annotated */;
|
1929
|
+
type1Flags &= ~4 /* TypeFlags.Annotated */;
|
1930
|
+
type2Flags &= ~4 /* TypeFlags.Annotated */;
|
1921
1931
|
}
|
1922
1932
|
if (type1Flags !== type2Flags) {
|
1923
1933
|
return false;
|
@@ -1928,7 +1938,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1928
1938
|
}
|
1929
1939
|
recursionCount++;
|
1930
1940
|
switch (type1.category) {
|
1931
|
-
case 6 /* Class */: {
|
1941
|
+
case 6 /* TypeCategory.Class */: {
|
1932
1942
|
const classType2 = type2;
|
1933
1943
|
// If the details are not the same it's not the same class.
|
1934
1944
|
if (!ClassType.isSameGenericClass(type1, classType2, recursionCount)) {
|
@@ -1979,7 +1989,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1979
1989
|
}
|
1980
1990
|
return true;
|
1981
1991
|
}
|
1982
|
-
case 4 /* Function */: {
|
1992
|
+
case 4 /* TypeCategory.Function */: {
|
1983
1993
|
// Make sure the parameter counts match.
|
1984
1994
|
const functionType2 = type2;
|
1985
1995
|
const params1 = type1.details.parameters;
|
@@ -2050,7 +2060,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2050
2060
|
}
|
2051
2061
|
return true;
|
2052
2062
|
}
|
2053
|
-
case 5 /* OverloadedFunction */: {
|
2063
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
2054
2064
|
// Make sure the overload counts match.
|
2055
2065
|
const functionType2 = type2;
|
2056
2066
|
if (type1.overloads.length !== functionType2.overloads.length) {
|
@@ -2065,7 +2075,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2065
2075
|
}
|
2066
2076
|
return true;
|
2067
2077
|
}
|
2068
|
-
case 8 /* Union */: {
|
2078
|
+
case 8 /* TypeCategory.Union */: {
|
2069
2079
|
const unionType2 = type2;
|
2070
2080
|
const subtypes1 = type1.subtypes;
|
2071
2081
|
const subtypes2 = unionType2.subtypes;
|
@@ -2077,7 +2087,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2077
2087
|
const exclusionSet = new Set();
|
2078
2088
|
return (findSubtype(type1, (subtype) => !UnionType.containsType(unionType2, subtype, exclusionSet, recursionCount)) === undefined);
|
2079
2089
|
}
|
2080
|
-
case 9 /* TypeVar */: {
|
2090
|
+
case 9 /* TypeCategory.TypeVar */: {
|
2081
2091
|
const type2TypeVar = type2;
|
2082
2092
|
if (type1.scopeId !== type2TypeVar.scopeId) {
|
2083
2093
|
return false;
|
@@ -2136,7 +2146,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2136
2146
|
}
|
2137
2147
|
return true;
|
2138
2148
|
}
|
2139
|
-
case 7 /* Module */: {
|
2149
|
+
case 7 /* TypeCategory.Module */: {
|
2140
2150
|
const type2Module = type2;
|
2141
2151
|
// Module types are the same if they share the same
|
2142
2152
|
// module symbol table.
|
@@ -2150,7 +2160,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2150
2160
|
}
|
2151
2161
|
return false;
|
2152
2162
|
}
|
2153
|
-
case 1 /* Unknown */: {
|
2163
|
+
case 1 /* TypeCategory.Unknown */: {
|
2154
2164
|
const type2Unknown = type2;
|
2155
2165
|
return type1.isIncomplete === type2Unknown.isIncomplete;
|
2156
2166
|
}
|
@@ -2206,12 +2216,12 @@ exports.findSubtype = findSubtype;
|
|
2206
2216
|
function combineTypes(subtypes, maxSubtypeCount) {
|
2207
2217
|
// Filter out any "Never" and "NoReturn" types.
|
2208
2218
|
let sawNoReturn = false;
|
2209
|
-
if (subtypes.some((subtype) => subtype.category === 3 /* Never */))
|
2219
|
+
if (subtypes.some((subtype) => subtype.category === 3 /* TypeCategory.Never */))
|
2210
2220
|
subtypes = subtypes.filter((subtype) => {
|
2211
|
-
if (subtype.category === 3 /* Never */ && subtype.isNoReturn) {
|
2221
|
+
if (subtype.category === 3 /* TypeCategory.Never */ && subtype.isNoReturn) {
|
2212
2222
|
sawNoReturn = true;
|
2213
2223
|
}
|
2214
|
-
return subtype.category !== 3 /* Never */;
|
2224
|
+
return subtype.category !== 3 /* TypeCategory.Never */;
|
2215
2225
|
});
|
2216
2226
|
if (subtypes.length === 0) {
|
2217
2227
|
return sawNoReturn ? NeverType.createNoReturn() : NeverType.createNever();
|