@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
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,31 @@ 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. Even at 16, there are some legitimate failures in
|
76
|
+
// numpy.
|
77
|
+
exports.maxTypeRecursionCount = 20;
|
75
78
|
var TypeBase;
|
76
79
|
(function (TypeBase) {
|
77
80
|
function isInstantiable(type) {
|
78
|
-
return (type.flags & 1 /* Instantiable */) !== 0;
|
81
|
+
return (type.flags & 1 /* TypeFlags.Instantiable */) !== 0;
|
79
82
|
}
|
80
83
|
TypeBase.isInstantiable = isInstantiable;
|
81
84
|
function isInstance(type) {
|
82
|
-
return (type.flags & 2 /* Instance */) !== 0;
|
85
|
+
return (type.flags & 2 /* TypeFlags.Instance */) !== 0;
|
83
86
|
}
|
84
87
|
TypeBase.isInstance = isInstance;
|
85
88
|
function isAnnotated(type) {
|
86
|
-
return (type.flags & 4 /* Annotated */) !== 0;
|
89
|
+
return (type.flags & 4 /* TypeFlags.Annotated */) !== 0;
|
87
90
|
}
|
88
91
|
TypeBase.isAnnotated = isAnnotated;
|
89
92
|
function isSpecialForm(type) {
|
90
|
-
return (type.flags & 8 /* SpecialForm */) !== 0;
|
93
|
+
return (type.flags & 8 /* TypeFlags.SpecialForm */) !== 0;
|
91
94
|
}
|
92
95
|
TypeBase.isSpecialForm = isSpecialForm;
|
93
96
|
function setSpecialForm(type) {
|
94
|
-
return (type.flags |= 8 /* SpecialForm */);
|
97
|
+
return (type.flags |= 8 /* TypeFlags.SpecialForm */);
|
95
98
|
}
|
96
99
|
TypeBase.setSpecialForm = setSpecialForm;
|
97
100
|
function isAmbiguous(type) {
|
@@ -108,8 +111,8 @@ var TypeBase;
|
|
108
111
|
(0, debug_1.assert)(TypeBase.isInstantiable(type));
|
109
112
|
const newInstance = TypeBase.cloneType(type);
|
110
113
|
if (newInstance.instantiableNestingLevel === undefined) {
|
111
|
-
newInstance.flags &= ~1 /* Instantiable */;
|
112
|
-
newInstance.flags |= 2 /* Instance */;
|
114
|
+
newInstance.flags &= ~1 /* TypeFlags.Instantiable */;
|
115
|
+
newInstance.flags |= 2 /* TypeFlags.Instance */;
|
113
116
|
delete newInstance.instantiableNestingLevel;
|
114
117
|
}
|
115
118
|
else {
|
@@ -133,8 +136,8 @@ var TypeBase;
|
|
133
136
|
function cloneTypeAsInstantiable(type, cache) {
|
134
137
|
const newInstance = TypeBase.cloneType(type);
|
135
138
|
if (TypeBase.isInstance(type)) {
|
136
|
-
newInstance.flags &= ~2 /* Instance */;
|
137
|
-
newInstance.flags |= 1 /* Instantiable */;
|
139
|
+
newInstance.flags &= ~2 /* TypeFlags.Instance */;
|
140
|
+
newInstance.flags |= 1 /* TypeFlags.Instantiable */;
|
138
141
|
}
|
139
142
|
else {
|
140
143
|
newInstance.instantiableNestingLevel =
|
@@ -165,7 +168,7 @@ var TypeBase;
|
|
165
168
|
TypeBase.cloneForTypeAlias = cloneForTypeAlias;
|
166
169
|
function cloneForAnnotated(type) {
|
167
170
|
const typeClone = cloneType(type);
|
168
|
-
typeClone.flags |= 4 /* Annotated */;
|
171
|
+
typeClone.flags |= 4 /* TypeFlags.Annotated */;
|
169
172
|
return typeClone;
|
170
173
|
}
|
171
174
|
TypeBase.cloneForAnnotated = cloneForAnnotated;
|
@@ -189,29 +192,29 @@ var TypeBase;
|
|
189
192
|
return typeClone;
|
190
193
|
}
|
191
194
|
TypeBase.cloneForAmbiguousType = cloneForAmbiguousType;
|
192
|
-
})(TypeBase
|
195
|
+
})(TypeBase || (exports.TypeBase = TypeBase = {}));
|
193
196
|
var UnboundType;
|
194
197
|
(function (UnboundType) {
|
195
198
|
const _instance = {
|
196
|
-
category: 0 /* Unbound */,
|
197
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
199
|
+
category: 0 /* TypeCategory.Unbound */,
|
200
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
198
201
|
};
|
199
202
|
function create() {
|
200
203
|
// All Unbound objects are the same, so use a shared instance.
|
201
204
|
return _instance;
|
202
205
|
}
|
203
206
|
UnboundType.create = create;
|
204
|
-
})(UnboundType
|
207
|
+
})(UnboundType || (exports.UnboundType = UnboundType = {}));
|
205
208
|
var UnknownType;
|
206
209
|
(function (UnknownType) {
|
207
210
|
const _instance = {
|
208
|
-
category: 1 /* Unknown */,
|
209
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
211
|
+
category: 1 /* TypeCategory.Unknown */,
|
212
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
210
213
|
isIncomplete: false,
|
211
214
|
};
|
212
215
|
const _incompleteInstance = {
|
213
|
-
category: 1 /* Unknown */,
|
214
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
216
|
+
category: 1 /* TypeCategory.Unknown */,
|
217
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
215
218
|
isIncomplete: true,
|
216
219
|
};
|
217
220
|
function create(isIncomplete = false) {
|
@@ -220,23 +223,23 @@ var UnknownType;
|
|
220
223
|
UnknownType.create = create;
|
221
224
|
function createPossibleType(possibleType, isIncomplete) {
|
222
225
|
const unknownWithPossibleType = {
|
223
|
-
category: 1 /* Unknown */,
|
224
|
-
flags: 1 /* Instantiable */ | 2 /* Instance */,
|
226
|
+
category: 1 /* TypeCategory.Unknown */,
|
227
|
+
flags: 1 /* TypeFlags.Instantiable */ | 2 /* TypeFlags.Instance */,
|
225
228
|
isIncomplete,
|
226
229
|
possibleType,
|
227
230
|
};
|
228
231
|
return unknownWithPossibleType;
|
229
232
|
}
|
230
233
|
UnknownType.createPossibleType = createPossibleType;
|
231
|
-
})(UnknownType
|
234
|
+
})(UnknownType || (exports.UnknownType = UnknownType = {}));
|
232
235
|
var ModuleType;
|
233
236
|
(function (ModuleType) {
|
234
237
|
function create(moduleName, filePath, symbolTable) {
|
235
238
|
const newModuleType = {
|
236
|
-
category: 7 /* Module */,
|
239
|
+
category: 7 /* TypeCategory.Module */,
|
237
240
|
fields: symbolTable || new Map(),
|
238
241
|
loaderFields: new Map(),
|
239
|
-
flags: 1 /* Instantiable */ | 1 /* Instantiable */,
|
242
|
+
flags: 1 /* TypeFlags.Instantiable */ | 1 /* TypeFlags.Instantiable */,
|
240
243
|
moduleName,
|
241
244
|
filePath,
|
242
245
|
};
|
@@ -265,7 +268,7 @@ var ModuleType;
|
|
265
268
|
return symbol;
|
266
269
|
}
|
267
270
|
ModuleType.getField = getField;
|
268
|
-
})(ModuleType
|
271
|
+
})(ModuleType || (exports.ModuleType = ModuleType = {}));
|
269
272
|
var ClassTypeFlags;
|
270
273
|
(function (ClassTypeFlags) {
|
271
274
|
ClassTypeFlags[ClassTypeFlags["None"] = 0] = "None";
|
@@ -346,12 +349,12 @@ var ClassTypeFlags;
|
|
346
349
|
ClassTypeFlags[ClassTypeFlags["SynthesizeDataClassUnsafeHash"] = 67108864] = "SynthesizeDataClassUnsafeHash";
|
347
350
|
// Decorated with @type_check_only.
|
348
351
|
ClassTypeFlags[ClassTypeFlags["TypeCheckOnly"] = 134217728] = "TypeCheckOnly";
|
349
|
-
})(ClassTypeFlags
|
352
|
+
})(ClassTypeFlags || (exports.ClassTypeFlags = ClassTypeFlags = {}));
|
350
353
|
var ClassType;
|
351
354
|
(function (ClassType) {
|
352
355
|
function createInstantiable(name, fullName, moduleName, filePath, flags, typeSourceId, declaredMetaclass, effectiveMetaclass, docString) {
|
353
356
|
const newClass = {
|
354
|
-
category: 6 /* Class */,
|
357
|
+
category: 6 /* TypeCategory.Class */,
|
355
358
|
details: {
|
356
359
|
name,
|
357
360
|
fullName,
|
@@ -367,7 +370,7 @@ var ClassType;
|
|
367
370
|
typeParameters: [],
|
368
371
|
docString,
|
369
372
|
},
|
370
|
-
flags: 1 /* Instantiable */,
|
373
|
+
flags: 1 /* TypeFlags.Instantiable */,
|
371
374
|
};
|
372
375
|
return newClass;
|
373
376
|
}
|
@@ -381,7 +384,7 @@ var ClassType;
|
|
381
384
|
return type.cached.typeBaseInstanceType;
|
382
385
|
}
|
383
386
|
const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ includeSubclasses);
|
384
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
387
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
385
388
|
if (includeSubclasses) {
|
386
389
|
newInstance.includeSubclasses = true;
|
387
390
|
}
|
@@ -394,7 +397,7 @@ var ClassType;
|
|
394
397
|
return type.cached.typeBaseInstantiableType;
|
395
398
|
}
|
396
399
|
const newInstance = TypeBase.cloneTypeAsInstantiable(type, includeSubclasses);
|
397
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
400
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
398
401
|
if (includeSubclasses) {
|
399
402
|
newInstance.includeSubclasses = true;
|
400
403
|
}
|
@@ -572,7 +575,7 @@ var ClassType;
|
|
572
575
|
}
|
573
576
|
ClassType.isUnspecialized = isUnspecialized;
|
574
577
|
function isSpecialBuiltIn(classType, className) {
|
575
|
-
if (!(classType.details.flags & 2 /* SpecialBuiltIn */) && !classType.aliasName) {
|
578
|
+
if (!(classType.details.flags & 2 /* ClassTypeFlags.SpecialBuiltIn */) && !classType.aliasName) {
|
576
579
|
return false;
|
577
580
|
}
|
578
581
|
if (className !== undefined) {
|
@@ -582,7 +585,7 @@ var ClassType;
|
|
582
585
|
}
|
583
586
|
ClassType.isSpecialBuiltIn = isSpecialBuiltIn;
|
584
587
|
function isBuiltIn(classType, className) {
|
585
|
-
if (!(classType.details.flags & 1 /* BuiltInClass */)) {
|
588
|
+
if (!(classType.details.flags & 1 /* ClassTypeFlags.BuiltInClass */)) {
|
586
589
|
return false;
|
587
590
|
}
|
588
591
|
if (className !== undefined) {
|
@@ -598,79 +601,79 @@ var ClassType;
|
|
598
601
|
}
|
599
602
|
ClassType.derivesFromAnyOrUnknown = derivesFromAnyOrUnknown;
|
600
603
|
function supportsAbstractMethods(classType) {
|
601
|
-
return !!(classType.details.flags & 1024 /* SupportsAbstractMethods */);
|
604
|
+
return !!(classType.details.flags & 1024 /* ClassTypeFlags.SupportsAbstractMethods */);
|
602
605
|
}
|
603
606
|
ClassType.supportsAbstractMethods = supportsAbstractMethods;
|
604
607
|
function isDataClass(classType) {
|
605
|
-
return !!(classType.details.flags & 4 /* DataClass */);
|
608
|
+
return !!(classType.details.flags & 4 /* ClassTypeFlags.DataClass */);
|
606
609
|
}
|
607
610
|
ClassType.isDataClass = isDataClass;
|
608
611
|
function isSkipSynthesizedDataClassInit(classType) {
|
609
|
-
return !!(classType.details.flags & 16 /* SkipSynthesizedDataClassInit */);
|
612
|
+
return !!(classType.details.flags & 16 /* ClassTypeFlags.SkipSynthesizedDataClassInit */);
|
610
613
|
}
|
611
614
|
ClassType.isSkipSynthesizedDataClassInit = isSkipSynthesizedDataClassInit;
|
612
615
|
function isSkipSynthesizedDataClassEq(classType) {
|
613
|
-
return !!(classType.details.flags & 32 /* SkipSynthesizedDataClassEq */);
|
616
|
+
return !!(classType.details.flags & 32 /* ClassTypeFlags.SkipSynthesizedDataClassEq */);
|
614
617
|
}
|
615
618
|
ClassType.isSkipSynthesizedDataClassEq = isSkipSynthesizedDataClassEq;
|
616
619
|
function isFrozenDataClass(classType) {
|
617
|
-
return !!(classType.details.flags & 8 /* FrozenDataClass */);
|
620
|
+
return !!(classType.details.flags & 8 /* ClassTypeFlags.FrozenDataClass */);
|
618
621
|
}
|
619
622
|
ClassType.isFrozenDataClass = isFrozenDataClass;
|
620
623
|
function isSynthesizedDataclassOrder(classType) {
|
621
|
-
return !!(classType.details.flags & 64 /* SynthesizedDataClassOrder */);
|
624
|
+
return !!(classType.details.flags & 64 /* ClassTypeFlags.SynthesizedDataClassOrder */);
|
622
625
|
}
|
623
626
|
ClassType.isSynthesizedDataclassOrder = isSynthesizedDataclassOrder;
|
624
627
|
function isDataClassKeywordOnlyParams(classType) {
|
625
|
-
return !!(classType.details.flags & 2097152 /* DataClassKeywordOnlyParams */);
|
628
|
+
return !!(classType.details.flags & 2097152 /* ClassTypeFlags.DataClassKeywordOnlyParams */);
|
626
629
|
}
|
627
630
|
ClassType.isDataClassKeywordOnlyParams = isDataClassKeywordOnlyParams;
|
628
631
|
function isGeneratedDataClassSlots(classType) {
|
629
|
-
return !!(classType.details.flags & 33554432 /* GenerateDataClassSlots */);
|
632
|
+
return !!(classType.details.flags & 33554432 /* ClassTypeFlags.GenerateDataClassSlots */);
|
630
633
|
}
|
631
634
|
ClassType.isGeneratedDataClassSlots = isGeneratedDataClassSlots;
|
632
635
|
function isSynthesizeDataClassUnsafeHash(classType) {
|
633
|
-
return !!(classType.details.flags & 67108864 /* SynthesizeDataClassUnsafeHash */);
|
636
|
+
return !!(classType.details.flags & 67108864 /* ClassTypeFlags.SynthesizeDataClassUnsafeHash */);
|
634
637
|
}
|
635
638
|
ClassType.isSynthesizeDataClassUnsafeHash = isSynthesizeDataClassUnsafeHash;
|
636
639
|
function isTypeCheckOnly(classType) {
|
637
|
-
return !!(classType.details.flags & 134217728 /* TypeCheckOnly */);
|
640
|
+
return !!(classType.details.flags & 134217728 /* ClassTypeFlags.TypeCheckOnly */);
|
638
641
|
}
|
639
642
|
ClassType.isTypeCheckOnly = isTypeCheckOnly;
|
640
643
|
function isTypedDictClass(classType) {
|
641
|
-
return !!(classType.details.flags & 128 /* TypedDictClass */);
|
644
|
+
return !!(classType.details.flags & 128 /* ClassTypeFlags.TypedDictClass */);
|
642
645
|
}
|
643
646
|
ClassType.isTypedDictClass = isTypedDictClass;
|
644
647
|
function isCanOmitDictValues(classType) {
|
645
|
-
return !!(classType.details.flags & 256 /* CanOmitDictValues */);
|
648
|
+
return !!(classType.details.flags & 256 /* ClassTypeFlags.CanOmitDictValues */);
|
646
649
|
}
|
647
650
|
ClassType.isCanOmitDictValues = isCanOmitDictValues;
|
648
651
|
function isEnumClass(classType) {
|
649
|
-
return !!(classType.details.flags & 1048576 /* EnumClass */);
|
652
|
+
return !!(classType.details.flags & 1048576 /* ClassTypeFlags.EnumClass */);
|
650
653
|
}
|
651
654
|
ClassType.isEnumClass = isEnumClass;
|
652
655
|
function isPropertyClass(classType) {
|
653
|
-
return !!(classType.details.flags & 2048 /* PropertyClass */);
|
656
|
+
return !!(classType.details.flags & 2048 /* ClassTypeFlags.PropertyClass */);
|
654
657
|
}
|
655
658
|
ClassType.isPropertyClass = isPropertyClass;
|
656
659
|
function isClassProperty(classType) {
|
657
|
-
return !!(classType.details.flags & 4194304 /* ClassProperty */);
|
660
|
+
return !!(classType.details.flags & 4194304 /* ClassTypeFlags.ClassProperty */);
|
658
661
|
}
|
659
662
|
ClassType.isClassProperty = isClassProperty;
|
660
663
|
function isFinal(classType) {
|
661
|
-
return !!(classType.details.flags & 4096 /* Final */);
|
664
|
+
return !!(classType.details.flags & 4096 /* ClassTypeFlags.Final */);
|
662
665
|
}
|
663
666
|
ClassType.isFinal = isFinal;
|
664
667
|
function isProtocolClass(classType) {
|
665
|
-
return !!(classType.details.flags & 8192 /* ProtocolClass */);
|
668
|
+
return !!(classType.details.flags & 8192 /* ClassTypeFlags.ProtocolClass */);
|
666
669
|
}
|
667
670
|
ClassType.isProtocolClass = isProtocolClass;
|
668
671
|
function isDefinedInStub(classType) {
|
669
|
-
return !!(classType.details.flags & 8388608 /* DefinedInStub */);
|
672
|
+
return !!(classType.details.flags & 8388608 /* ClassTypeFlags.DefinedInStub */);
|
670
673
|
}
|
671
674
|
ClassType.isDefinedInStub = isDefinedInStub;
|
672
675
|
function isPseudoGenericClass(classType) {
|
673
|
-
return !!(classType.details.flags & 16384 /* PseudoGenericClass */);
|
676
|
+
return !!(classType.details.flags & 16384 /* ClassTypeFlags.PseudoGenericClass */);
|
674
677
|
}
|
675
678
|
ClassType.isPseudoGenericClass = isPseudoGenericClass;
|
676
679
|
function getDataClassEntries(classType) {
|
@@ -678,27 +681,27 @@ var ClassType;
|
|
678
681
|
}
|
679
682
|
ClassType.getDataClassEntries = getDataClassEntries;
|
680
683
|
function isRuntimeCheckable(classType) {
|
681
|
-
return !!(classType.details.flags & 32768 /* RuntimeCheckable */);
|
684
|
+
return !!(classType.details.flags & 32768 /* ClassTypeFlags.RuntimeCheckable */);
|
682
685
|
}
|
683
686
|
ClassType.isRuntimeCheckable = isRuntimeCheckable;
|
684
687
|
function isTypingExtensionClass(classType) {
|
685
|
-
return !!(classType.details.flags & 65536 /* TypingExtensionClass */);
|
688
|
+
return !!(classType.details.flags & 65536 /* ClassTypeFlags.TypingExtensionClass */);
|
686
689
|
}
|
687
690
|
ClassType.isTypingExtensionClass = isTypingExtensionClass;
|
688
691
|
function isPartiallyEvaluated(classType) {
|
689
|
-
return !!(classType.details.flags & 131072 /* PartiallyEvaluated */);
|
692
|
+
return !!(classType.details.flags & 131072 /* ClassTypeFlags.PartiallyEvaluated */);
|
690
693
|
}
|
691
694
|
ClassType.isPartiallyEvaluated = isPartiallyEvaluated;
|
692
695
|
function hasCustomClassGetItem(classType) {
|
693
|
-
return !!(classType.details.flags & 262144 /* HasCustomClassGetItem */);
|
696
|
+
return !!(classType.details.flags & 262144 /* ClassTypeFlags.HasCustomClassGetItem */);
|
694
697
|
}
|
695
698
|
ClassType.hasCustomClassGetItem = hasCustomClassGetItem;
|
696
699
|
function isTupleClass(classType) {
|
697
|
-
return !!(classType.details.flags & 524288 /* TupleClass */);
|
700
|
+
return !!(classType.details.flags & 524288 /* ClassTypeFlags.TupleClass */);
|
698
701
|
}
|
699
702
|
ClassType.isTupleClass = isTupleClass;
|
700
703
|
function isReadOnlyInstanceVariables(classType) {
|
701
|
-
return !!(classType.details.flags & 16777216 /* ReadOnlyInstanceVariables */);
|
704
|
+
return !!(classType.details.flags & 16777216 /* ClassTypeFlags.ReadOnlyInstanceVariables */);
|
702
705
|
}
|
703
706
|
ClassType.isReadOnlyInstanceVariables = isReadOnlyInstanceVariables;
|
704
707
|
function getTypeParameters(classType) {
|
@@ -719,19 +722,9 @@ var ClassType;
|
|
719
722
|
ClassType.isHierarchyPartiallyEvaluated = isHierarchyPartiallyEvaluated;
|
720
723
|
// Same as isTypeSame except that it doesn't compare type arguments.
|
721
724
|
function isSameGenericClass(classType, type2, recursionCount = 0) {
|
722
|
-
if (recursionCount > exports.maxTypeRecursionCount) {
|
723
|
-
return true;
|
724
|
-
}
|
725
|
-
recursionCount++;
|
726
725
|
if (!classType.isTypedDictPartial !== !type2.isTypedDictPartial) {
|
727
726
|
return false;
|
728
727
|
}
|
729
|
-
// If the class details match, it's definitely the same class.
|
730
|
-
if (classType.details === type2.details) {
|
731
|
-
return true;
|
732
|
-
}
|
733
|
-
// If either or both have aliases (e.g. List -> list), use the
|
734
|
-
// aliases for comparison purposes.
|
735
728
|
const class1Details = classType.details;
|
736
729
|
const class2Details = type2.details;
|
737
730
|
if (class1Details === class2Details) {
|
@@ -746,6 +739,10 @@ var ClassType;
|
|
746
739
|
class1Details.typeParameters.length !== class2Details.typeParameters.length) {
|
747
740
|
return false;
|
748
741
|
}
|
742
|
+
if (recursionCount > exports.maxTypeRecursionCount) {
|
743
|
+
return true;
|
744
|
+
}
|
745
|
+
recursionCount++;
|
749
746
|
// Special-case NamedTuple and Tuple classes because we rewrite the base classes
|
750
747
|
// in these cases.
|
751
748
|
if (ClassType.isBuiltIn(classType, 'NamedTuple') && ClassType.isBuiltIn(type2, 'NamedTuple')) {
|
@@ -829,15 +826,15 @@ var ClassType;
|
|
829
826
|
return classType.details.mro.slice(0).reverse();
|
830
827
|
}
|
831
828
|
ClassType.getReverseMro = getReverseMro;
|
832
|
-
})(ClassType
|
829
|
+
})(ClassType || (exports.ClassType = ClassType = {}));
|
833
830
|
function isPositionOnlySeparator(param) {
|
834
831
|
// A simple parameter with no name is treated as a "/" separator.
|
835
|
-
return param.category === 0 /* Simple */ && !param.name;
|
832
|
+
return param.category === 0 /* ParameterCategory.Simple */ && !param.name;
|
836
833
|
}
|
837
834
|
exports.isPositionOnlySeparator = isPositionOnlySeparator;
|
838
835
|
function isKeywordOnlySeparator(param) {
|
839
836
|
// An *args parameter with no name is treated as a "*" separator.
|
840
|
-
return param.category === 1 /* ArgsList */ && !param.name;
|
837
|
+
return param.category === 1 /* ParameterCategory.ArgsList */ && !param.name;
|
841
838
|
}
|
842
839
|
exports.isKeywordOnlySeparator = isKeywordOnlySeparator;
|
843
840
|
var FunctionTypeFlags;
|
@@ -891,24 +888,24 @@ var FunctionTypeFlags;
|
|
891
888
|
FunctionTypeFlags[FunctionTypeFlags["PartiallyEvaluated"] = 131072] = "PartiallyEvaluated";
|
892
889
|
// Decorated with @override as defined in PEP 698.
|
893
890
|
FunctionTypeFlags[FunctionTypeFlags["Overridden"] = 262144] = "Overridden";
|
894
|
-
})(FunctionTypeFlags
|
891
|
+
})(FunctionTypeFlags || (exports.FunctionTypeFlags = FunctionTypeFlags = {}));
|
895
892
|
var FunctionType;
|
896
893
|
(function (FunctionType) {
|
897
894
|
function createInstance(name, fullName, moduleName, functionFlags, docString) {
|
898
|
-
return create(name, fullName, moduleName, functionFlags, 2 /* Instance */, docString);
|
895
|
+
return create(name, fullName, moduleName, functionFlags, 2 /* TypeFlags.Instance */, docString);
|
899
896
|
}
|
900
897
|
FunctionType.createInstance = createInstance;
|
901
898
|
function createInstantiable(functionFlags, docString) {
|
902
|
-
return create('', '', '', functionFlags, 1 /* Instantiable */, docString);
|
899
|
+
return create('', '', '', functionFlags, 1 /* TypeFlags.Instantiable */, docString);
|
903
900
|
}
|
904
901
|
FunctionType.createInstantiable = createInstantiable;
|
905
|
-
function createSynthesizedInstance(name, additionalFlags = 0 /* None */) {
|
906
|
-
return create(name, '', '', additionalFlags | 64 /* SynthesizedMethod */, 2 /* Instance */);
|
902
|
+
function createSynthesizedInstance(name, additionalFlags = 0 /* FunctionTypeFlags.None */) {
|
903
|
+
return create(name, '', '', additionalFlags | 64 /* FunctionTypeFlags.SynthesizedMethod */, 2 /* TypeFlags.Instance */);
|
907
904
|
}
|
908
905
|
FunctionType.createSynthesizedInstance = createSynthesizedInstance;
|
909
906
|
function create(name, fullName, moduleName, functionFlags, typeFlags, docString) {
|
910
907
|
const newFunctionType = {
|
911
|
-
category: 4 /* Function */,
|
908
|
+
category: 4 /* TypeCategory.Function */,
|
912
909
|
details: {
|
913
910
|
name,
|
914
911
|
fullName,
|
@@ -932,7 +929,7 @@ var FunctionType;
|
|
932
929
|
newFunction.preBoundFlags = newFunction.details.flags;
|
933
930
|
if (stripFirstParam) {
|
934
931
|
if (type.details.parameters.length > 0) {
|
935
|
-
if (type.details.parameters[0].category === 0 /* Simple */) {
|
932
|
+
if (type.details.parameters[0].category === 0 /* ParameterCategory.Simple */) {
|
936
933
|
if (type.details.parameters.length > 0 && !type.details.parameters[0].isTypeInferred) {
|
937
934
|
// Stash away the effective type of the first parameter if it
|
938
935
|
// wasn't synthesized.
|
@@ -946,8 +943,8 @@ var FunctionType;
|
|
946
943
|
}
|
947
944
|
// If we strip off the first parameter, this is no longer an
|
948
945
|
// instance method or class method.
|
949
|
-
newFunction.details.flags &= ~(1 /* ConstructorMethod */ | 2 /* ClassMethod */);
|
950
|
-
newFunction.details.flags |= 4 /* StaticMethod */;
|
946
|
+
newFunction.details.flags &= ~(1 /* FunctionTypeFlags.ConstructorMethod */ | 2 /* FunctionTypeFlags.ClassMethod */);
|
947
|
+
newFunction.details.flags |= 4 /* FunctionTypeFlags.StaticMethod */;
|
951
948
|
}
|
952
949
|
if (type.typeAliasInfo !== undefined) {
|
953
950
|
newFunction.typeAliasInfo = type.typeAliasInfo;
|
@@ -974,7 +971,7 @@ var FunctionType;
|
|
974
971
|
return type.cached.typeBaseInstanceType;
|
975
972
|
}
|
976
973
|
const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ true);
|
977
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
974
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
978
975
|
return newInstance;
|
979
976
|
}
|
980
977
|
FunctionType.cloneAsInstance = cloneAsInstance;
|
@@ -984,7 +981,7 @@ var FunctionType;
|
|
984
981
|
return type.cached.typeBaseInstantiableType;
|
985
982
|
}
|
986
983
|
const newInstance = TypeBase.cloneTypeAsInstantiable(type, /* cache */ true);
|
987
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
984
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
988
985
|
return newInstance;
|
989
986
|
}
|
990
987
|
FunctionType.cloneAsInstantiable = cloneAsInstantiable;
|
@@ -1036,14 +1033,14 @@ var FunctionType;
|
|
1036
1033
|
}
|
1037
1034
|
newFunction.details.flags =
|
1038
1035
|
(paramSpecValue.details.flags &
|
1039
|
-
(2 /* ClassMethod */ |
|
1040
|
-
4 /* StaticMethod */ |
|
1041
|
-
1 /* ConstructorMethod */ |
|
1042
|
-
256 /* Overloaded */ |
|
1043
|
-
32768 /* SkipArgsKwargsCompatibilityCheck */)) |
|
1044
|
-
64 /* SynthesizedMethod */;
|
1036
|
+
(2 /* FunctionTypeFlags.ClassMethod */ |
|
1037
|
+
4 /* FunctionTypeFlags.StaticMethod */ |
|
1038
|
+
1 /* FunctionTypeFlags.ConstructorMethod */ |
|
1039
|
+
256 /* FunctionTypeFlags.Overloaded */ |
|
1040
|
+
32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */)) |
|
1041
|
+
64 /* FunctionTypeFlags.SynthesizedMethod */;
|
1045
1042
|
if (FunctionType.isParamSpecValue(type)) {
|
1046
|
-
newFunction.details.flags |= 65536 /* ParamSpecValue */;
|
1043
|
+
newFunction.details.flags |= 65536 /* FunctionTypeFlags.ParamSpecValue */;
|
1047
1044
|
}
|
1048
1045
|
// Update the specialized parameter types as well.
|
1049
1046
|
if (type.specializedTypes) {
|
@@ -1116,9 +1113,9 @@ var FunctionType;
|
|
1116
1113
|
newFunction.specializedTypes.parameterTypes = newFunction.specializedTypes.parameterTypes.slice(0, newFunction.specializedTypes.parameterTypes.length - 2);
|
1117
1114
|
}
|
1118
1115
|
// 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 */;
|
1116
|
+
newFunction.details.flags &= ~32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */;
|
1117
|
+
if (paramSpecValue.details.flags & 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */) {
|
1118
|
+
newFunction.details.flags |= 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */;
|
1122
1119
|
}
|
1123
1120
|
// If there is a position-only separator in the captured param spec signature,
|
1124
1121
|
// remove the position-only separator in the existing signature. Otherwise,
|
@@ -1185,13 +1182,13 @@ var FunctionType;
|
|
1185
1182
|
function getDefaultParameters(useUnknown = false) {
|
1186
1183
|
return [
|
1187
1184
|
{
|
1188
|
-
category: 1 /* ArgsList */,
|
1185
|
+
category: 1 /* ParameterCategory.ArgsList */,
|
1189
1186
|
name: 'args',
|
1190
1187
|
type: useUnknown ? UnknownType.create() : AnyType.create(),
|
1191
1188
|
hasDeclaredType: !useUnknown,
|
1192
1189
|
},
|
1193
1190
|
{
|
1194
|
-
category: 2 /* KwargsDict */,
|
1191
|
+
category: 2 /* ParameterCategory.KwargsDict */,
|
1195
1192
|
name: 'kwargs',
|
1196
1193
|
type: useUnknown ? UnknownType.create() : AnyType.create(),
|
1197
1194
|
hasDeclaredType: !useUnknown,
|
@@ -1209,13 +1206,13 @@ var FunctionType;
|
|
1209
1206
|
if (!param.name) {
|
1210
1207
|
continue;
|
1211
1208
|
}
|
1212
|
-
if (param.category === 0 /* Simple */) {
|
1209
|
+
if (param.category === 0 /* ParameterCategory.Simple */) {
|
1213
1210
|
return false;
|
1214
1211
|
}
|
1215
|
-
else if (param.category === 1 /* ArgsList */) {
|
1212
|
+
else if (param.category === 1 /* ParameterCategory.ArgsList */) {
|
1216
1213
|
sawArgs = true;
|
1217
1214
|
}
|
1218
|
-
else if (param.category === 2 /* KwargsDict */) {
|
1215
|
+
else if (param.category === 2 /* ParameterCategory.KwargsDict */) {
|
1219
1216
|
sawKwargs = true;
|
1220
1217
|
}
|
1221
1218
|
if (!isAnyOrUnknown(FunctionType.getEffectiveParameterType(functionType, i))) {
|
@@ -1227,82 +1224,82 @@ var FunctionType;
|
|
1227
1224
|
FunctionType.hasDefaultParameters = hasDefaultParameters;
|
1228
1225
|
function isInstanceMethod(type) {
|
1229
1226
|
return ((type.details.flags &
|
1230
|
-
(1 /* ConstructorMethod */ |
|
1231
|
-
4 /* StaticMethod */ |
|
1232
|
-
2 /* ClassMethod */)) ===
|
1227
|
+
(1 /* FunctionTypeFlags.ConstructorMethod */ |
|
1228
|
+
4 /* FunctionTypeFlags.StaticMethod */ |
|
1229
|
+
2 /* FunctionTypeFlags.ClassMethod */)) ===
|
1233
1230
|
0);
|
1234
1231
|
}
|
1235
1232
|
FunctionType.isInstanceMethod = isInstanceMethod;
|
1236
1233
|
function isConstructorMethod(type) {
|
1237
|
-
return (type.details.flags & 1 /* ConstructorMethod */) !== 0;
|
1234
|
+
return (type.details.flags & 1 /* FunctionTypeFlags.ConstructorMethod */) !== 0;
|
1238
1235
|
}
|
1239
1236
|
FunctionType.isConstructorMethod = isConstructorMethod;
|
1240
1237
|
function isStaticMethod(type) {
|
1241
|
-
return (type.details.flags & 4 /* StaticMethod */) !== 0;
|
1238
|
+
return (type.details.flags & 4 /* FunctionTypeFlags.StaticMethod */) !== 0;
|
1242
1239
|
}
|
1243
1240
|
FunctionType.isStaticMethod = isStaticMethod;
|
1244
1241
|
function isClassMethod(type) {
|
1245
|
-
return (type.details.flags & 2 /* ClassMethod */) !== 0;
|
1242
|
+
return (type.details.flags & 2 /* FunctionTypeFlags.ClassMethod */) !== 0;
|
1246
1243
|
}
|
1247
1244
|
FunctionType.isClassMethod = isClassMethod;
|
1248
1245
|
function isAbstractMethod(type) {
|
1249
|
-
return (type.details.flags & 8 /* AbstractMethod */) !== 0;
|
1246
|
+
return (type.details.flags & 8 /* FunctionTypeFlags.AbstractMethod */) !== 0;
|
1250
1247
|
}
|
1251
1248
|
FunctionType.isAbstractMethod = isAbstractMethod;
|
1252
1249
|
function isGenerator(type) {
|
1253
|
-
return (type.details.flags & 16 /* Generator */) !== 0;
|
1250
|
+
return (type.details.flags & 16 /* FunctionTypeFlags.Generator */) !== 0;
|
1254
1251
|
}
|
1255
1252
|
FunctionType.isGenerator = isGenerator;
|
1256
1253
|
function isSynthesizedMethod(type) {
|
1257
|
-
return (type.details.flags & 64 /* SynthesizedMethod */) !== 0;
|
1254
|
+
return (type.details.flags & 64 /* FunctionTypeFlags.SynthesizedMethod */) !== 0;
|
1258
1255
|
}
|
1259
1256
|
FunctionType.isSynthesizedMethod = isSynthesizedMethod;
|
1260
1257
|
function isTypeCheckOnly(type) {
|
1261
|
-
return (type.details.flags & 128 /* TypeCheckOnly */) !== 0;
|
1258
|
+
return (type.details.flags & 128 /* FunctionTypeFlags.TypeCheckOnly */) !== 0;
|
1262
1259
|
}
|
1263
1260
|
FunctionType.isTypeCheckOnly = isTypeCheckOnly;
|
1264
1261
|
function isOverloaded(type) {
|
1265
|
-
return (type.details.flags & 256 /* Overloaded */) !== 0;
|
1262
|
+
return (type.details.flags & 256 /* FunctionTypeFlags.Overloaded */) !== 0;
|
1266
1263
|
}
|
1267
1264
|
FunctionType.isOverloaded = isOverloaded;
|
1268
1265
|
function isDefaultParameterCheckDisabled(type) {
|
1269
|
-
return (type.details.flags & 32 /* DisableDefaultChecks */) !== 0;
|
1266
|
+
return (type.details.flags & 32 /* FunctionTypeFlags.DisableDefaultChecks */) !== 0;
|
1270
1267
|
}
|
1271
1268
|
FunctionType.isDefaultParameterCheckDisabled = isDefaultParameterCheckDisabled;
|
1272
1269
|
function isAsync(type) {
|
1273
|
-
return (type.details.flags & 512 /* Async */) !== 0;
|
1270
|
+
return (type.details.flags & 512 /* FunctionTypeFlags.Async */) !== 0;
|
1274
1271
|
}
|
1275
1272
|
FunctionType.isAsync = isAsync;
|
1276
1273
|
function isStubDefinition(type) {
|
1277
|
-
return (type.details.flags & 2048 /* StubDefinition */) !== 0;
|
1274
|
+
return (type.details.flags & 2048 /* FunctionTypeFlags.StubDefinition */) !== 0;
|
1278
1275
|
}
|
1279
1276
|
FunctionType.isStubDefinition = isStubDefinition;
|
1280
1277
|
function isPyTypedDefinition(type) {
|
1281
|
-
return (type.details.flags & 4096 /* PyTypedDefinition */) !== 0;
|
1278
|
+
return (type.details.flags & 4096 /* FunctionTypeFlags.PyTypedDefinition */) !== 0;
|
1282
1279
|
}
|
1283
1280
|
FunctionType.isPyTypedDefinition = isPyTypedDefinition;
|
1284
1281
|
function isFinal(type) {
|
1285
|
-
return (type.details.flags & 8192 /* Final */) !== 0;
|
1282
|
+
return (type.details.flags & 8192 /* FunctionTypeFlags.Final */) !== 0;
|
1286
1283
|
}
|
1287
1284
|
FunctionType.isFinal = isFinal;
|
1288
1285
|
function hasUnannotatedParams(type) {
|
1289
|
-
return (type.details.flags & 16384 /* UnannotatedParams */) !== 0;
|
1286
|
+
return (type.details.flags & 16384 /* FunctionTypeFlags.UnannotatedParams */) !== 0;
|
1290
1287
|
}
|
1291
1288
|
FunctionType.hasUnannotatedParams = hasUnannotatedParams;
|
1292
1289
|
function shouldSkipArgsKwargsCompatibilityCheck(type) {
|
1293
|
-
return (type.details.flags & 32768 /* SkipArgsKwargsCompatibilityCheck */) !== 0;
|
1290
|
+
return (type.details.flags & 32768 /* FunctionTypeFlags.SkipArgsKwargsCompatibilityCheck */) !== 0;
|
1294
1291
|
}
|
1295
1292
|
FunctionType.shouldSkipArgsKwargsCompatibilityCheck = shouldSkipArgsKwargsCompatibilityCheck;
|
1296
1293
|
function isParamSpecValue(type) {
|
1297
|
-
return (type.details.flags & 65536 /* ParamSpecValue */) !== 0;
|
1294
|
+
return (type.details.flags & 65536 /* FunctionTypeFlags.ParamSpecValue */) !== 0;
|
1298
1295
|
}
|
1299
1296
|
FunctionType.isParamSpecValue = isParamSpecValue;
|
1300
1297
|
function isPartiallyEvaluated(type) {
|
1301
|
-
return !!(type.details.flags & 131072 /* PartiallyEvaluated */);
|
1298
|
+
return !!(type.details.flags & 131072 /* FunctionTypeFlags.PartiallyEvaluated */);
|
1302
1299
|
}
|
1303
1300
|
FunctionType.isPartiallyEvaluated = isPartiallyEvaluated;
|
1304
1301
|
function isOverridden(type) {
|
1305
|
-
return !!(type.details.flags & 262144 /* Overridden */);
|
1302
|
+
return !!(type.details.flags & 262144 /* FunctionTypeFlags.Overridden */);
|
1306
1303
|
}
|
1307
1304
|
FunctionType.isOverridden = isOverridden;
|
1308
1305
|
function getEffectiveParameterType(type, index) {
|
@@ -1346,14 +1343,14 @@ var FunctionType;
|
|
1346
1343
|
return undefined;
|
1347
1344
|
}
|
1348
1345
|
FunctionType.getSpecializedReturnType = getSpecializedReturnType;
|
1349
|
-
})(FunctionType
|
1346
|
+
})(FunctionType || (exports.FunctionType = FunctionType = {}));
|
1350
1347
|
var OverloadedFunctionType;
|
1351
1348
|
(function (OverloadedFunctionType) {
|
1352
1349
|
function create(overloads) {
|
1353
1350
|
const newType = {
|
1354
|
-
category: 5 /* OverloadedFunction */,
|
1351
|
+
category: 5 /* TypeCategory.OverloadedFunction */,
|
1355
1352
|
overloads: [],
|
1356
|
-
flags: 2 /* Instance */,
|
1353
|
+
flags: 2 /* TypeFlags.Instance */,
|
1357
1354
|
};
|
1358
1355
|
overloads.forEach((overload) => {
|
1359
1356
|
OverloadedFunctionType.addOverload(newType, overload);
|
@@ -1375,17 +1372,17 @@ var OverloadedFunctionType;
|
|
1375
1372
|
return type.overloads.find((func) => !FunctionType.isOverloaded(func));
|
1376
1373
|
}
|
1377
1374
|
OverloadedFunctionType.getImplementation = getImplementation;
|
1378
|
-
})(OverloadedFunctionType
|
1375
|
+
})(OverloadedFunctionType || (exports.OverloadedFunctionType = OverloadedFunctionType = {}));
|
1379
1376
|
var NeverType;
|
1380
1377
|
(function (NeverType) {
|
1381
1378
|
const _neverInstance = {
|
1382
|
-
category: 3 /* Never */,
|
1383
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1379
|
+
category: 3 /* TypeCategory.Never */,
|
1380
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1384
1381
|
isNoReturn: false,
|
1385
1382
|
};
|
1386
1383
|
const _noReturnInstance = {
|
1387
|
-
category: 3 /* Never */,
|
1388
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1384
|
+
category: 3 /* TypeCategory.Never */,
|
1385
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1389
1386
|
isNoReturn: true,
|
1390
1387
|
};
|
1391
1388
|
function createNever() {
|
@@ -1396,23 +1393,23 @@ var NeverType;
|
|
1396
1393
|
return _noReturnInstance;
|
1397
1394
|
}
|
1398
1395
|
NeverType.createNoReturn = createNoReturn;
|
1399
|
-
})(NeverType
|
1396
|
+
})(NeverType || (exports.NeverType = NeverType = {}));
|
1400
1397
|
var AnyType;
|
1401
1398
|
(function (AnyType) {
|
1402
1399
|
const _anyInstanceSpecialForm = {
|
1403
|
-
category: 2 /* Any */,
|
1400
|
+
category: 2 /* TypeCategory.Any */,
|
1404
1401
|
isEllipsis: false,
|
1405
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */ | 8 /* SpecialForm */,
|
1402
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */ | 8 /* TypeFlags.SpecialForm */,
|
1406
1403
|
};
|
1407
1404
|
const _anyInstance = {
|
1408
|
-
category: 2 /* Any */,
|
1405
|
+
category: 2 /* TypeCategory.Any */,
|
1409
1406
|
isEllipsis: false,
|
1410
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1407
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1411
1408
|
};
|
1412
1409
|
const _ellipsisInstance = {
|
1413
|
-
category: 2 /* Any */,
|
1410
|
+
category: 2 /* TypeCategory.Any */,
|
1414
1411
|
isEllipsis: true,
|
1415
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1412
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1416
1413
|
};
|
1417
1414
|
function create(isEllipsis = false) {
|
1418
1415
|
return isEllipsis ? _ellipsisInstance : _anyInstance;
|
@@ -1422,7 +1419,7 @@ var AnyType;
|
|
1422
1419
|
return _anyInstanceSpecialForm;
|
1423
1420
|
}
|
1424
1421
|
AnyType.createSpecialForm = createSpecialForm;
|
1425
|
-
})(AnyType
|
1422
|
+
})(AnyType || (exports.AnyType = AnyType = {}));
|
1426
1423
|
(function (AnyType) {
|
1427
1424
|
function convertToInstance(type) {
|
1428
1425
|
// Remove the "special form" flag if it's set. Otherwise
|
@@ -1433,7 +1430,7 @@ var AnyType;
|
|
1433
1430
|
return type;
|
1434
1431
|
}
|
1435
1432
|
AnyType.convertToInstance = convertToInstance;
|
1436
|
-
})(AnyType
|
1433
|
+
})(AnyType || (exports.AnyType = AnyType = {}));
|
1437
1434
|
var TypeCondition;
|
1438
1435
|
(function (TypeCondition) {
|
1439
1436
|
function combine(conditions1, conditions2) {
|
@@ -1504,14 +1501,14 @@ var TypeCondition;
|
|
1504
1501
|
return true;
|
1505
1502
|
}
|
1506
1503
|
TypeCondition.isCompatible = isCompatible;
|
1507
|
-
})(TypeCondition
|
1504
|
+
})(TypeCondition || (exports.TypeCondition = TypeCondition = {}));
|
1508
1505
|
var UnionType;
|
1509
1506
|
(function (UnionType) {
|
1510
1507
|
function create() {
|
1511
1508
|
const newUnionType = {
|
1512
|
-
category: 8 /* Union */,
|
1509
|
+
category: 8 /* TypeCategory.Union */,
|
1513
1510
|
subtypes: [],
|
1514
|
-
flags: 2 /* Instance */ | 1 /* Instantiable */,
|
1511
|
+
flags: 2 /* TypeFlags.Instance */ | 1 /* TypeFlags.Instantiable */,
|
1515
1512
|
};
|
1516
1513
|
return newUnionType;
|
1517
1514
|
}
|
@@ -1582,7 +1579,7 @@ var UnionType;
|
|
1582
1579
|
}
|
1583
1580
|
UnionType.containsType = containsType;
|
1584
1581
|
function addTypeAliasSource(unionType, typeAliasSource) {
|
1585
|
-
if (typeAliasSource.category === 8 /* Union */) {
|
1582
|
+
if (typeAliasSource.category === 8 /* TypeCategory.Union */) {
|
1586
1583
|
const sourcesToAdd = typeAliasSource.typeAliasInfo ? [typeAliasSource] : typeAliasSource.typeAliasSources;
|
1587
1584
|
if (sourcesToAdd) {
|
1588
1585
|
if (!unionType.typeAliasSources) {
|
@@ -1595,7 +1592,7 @@ var UnionType;
|
|
1595
1592
|
}
|
1596
1593
|
}
|
1597
1594
|
UnionType.addTypeAliasSource = addTypeAliasSource;
|
1598
|
-
})(UnionType
|
1595
|
+
})(UnionType || (exports.UnionType = UnionType = {}));
|
1599
1596
|
var Variance;
|
1600
1597
|
(function (Variance) {
|
1601
1598
|
Variance[Variance["Auto"] = 0] = "Auto";
|
@@ -1603,21 +1600,21 @@ var Variance;
|
|
1603
1600
|
Variance[Variance["Invariant"] = 2] = "Invariant";
|
1604
1601
|
Variance[Variance["Covariant"] = 3] = "Covariant";
|
1605
1602
|
Variance[Variance["Contravariant"] = 4] = "Contravariant";
|
1606
|
-
})(Variance
|
1603
|
+
})(Variance || (exports.Variance = Variance = {}));
|
1607
1604
|
var TypeVarScopeType;
|
1608
1605
|
(function (TypeVarScopeType) {
|
1609
1606
|
TypeVarScopeType[TypeVarScopeType["Class"] = 0] = "Class";
|
1610
1607
|
TypeVarScopeType[TypeVarScopeType["Function"] = 1] = "Function";
|
1611
1608
|
TypeVarScopeType[TypeVarScopeType["TypeAlias"] = 2] = "TypeAlias";
|
1612
|
-
})(TypeVarScopeType
|
1609
|
+
})(TypeVarScopeType || (exports.TypeVarScopeType = TypeVarScopeType = {}));
|
1613
1610
|
var TypeVarType;
|
1614
1611
|
(function (TypeVarType) {
|
1615
1612
|
function createInstance(name) {
|
1616
|
-
return create(name, /* isParamSpec */ false, 2 /* Instance */);
|
1613
|
+
return create(name, /* isParamSpec */ false, 2 /* TypeFlags.Instance */);
|
1617
1614
|
}
|
1618
1615
|
TypeVarType.createInstance = createInstance;
|
1619
1616
|
function createInstantiable(name, isParamSpec = false, runtimeClass) {
|
1620
|
-
return create(name, isParamSpec, 1 /* Instantiable */, runtimeClass);
|
1617
|
+
return create(name, isParamSpec, 1 /* TypeFlags.Instantiable */, runtimeClass);
|
1621
1618
|
}
|
1622
1619
|
TypeVarType.createInstantiable = createInstantiable;
|
1623
1620
|
function cloneAsInstance(type) {
|
@@ -1627,7 +1624,7 @@ var TypeVarType;
|
|
1627
1624
|
return type.cached.typeBaseInstanceType;
|
1628
1625
|
}
|
1629
1626
|
const newInstance = TypeBase.cloneTypeAsInstance(type, /* cache */ true);
|
1630
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
1627
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
1631
1628
|
return newInstance;
|
1632
1629
|
}
|
1633
1630
|
TypeVarType.cloneAsInstance = cloneAsInstance;
|
@@ -1637,7 +1634,7 @@ var TypeVarType;
|
|
1637
1634
|
return type.cached.typeBaseInstantiableType;
|
1638
1635
|
}
|
1639
1636
|
const newInstance = TypeBase.cloneTypeAsInstantiable(type, /* cache */ true);
|
1640
|
-
newInstance.flags &= ~8 /* SpecialForm */;
|
1637
|
+
newInstance.flags &= ~8 /* TypeFlags.SpecialForm */;
|
1641
1638
|
return newInstance;
|
1642
1639
|
}
|
1643
1640
|
TypeVarType.cloneAsInstantiable = cloneAsInstantiable;
|
@@ -1683,17 +1680,17 @@ var TypeVarType;
|
|
1683
1680
|
if (type.details.isParamSpec || type.details.isVariadic) {
|
1684
1681
|
return type;
|
1685
1682
|
}
|
1686
|
-
if (type.details.declaredVariance === 0 /* Auto */) {
|
1683
|
+
if (type.details.declaredVariance === 0 /* Variance.Auto */) {
|
1687
1684
|
return type;
|
1688
1685
|
}
|
1689
|
-
if (type.details.declaredVariance === 2 /* Invariant */) {
|
1686
|
+
if (type.details.declaredVariance === 2 /* Variance.Invariant */) {
|
1690
1687
|
if (type.details.boundType === undefined && type.details.constraints.length === 0) {
|
1691
1688
|
return type;
|
1692
1689
|
}
|
1693
1690
|
}
|
1694
1691
|
const newInstance = TypeBase.cloneType(type);
|
1695
1692
|
newInstance.details = { ...newInstance.details };
|
1696
|
-
newInstance.details.declaredVariance = 2 /* Invariant */;
|
1693
|
+
newInstance.details.declaredVariance = 2 /* Variance.Invariant */;
|
1697
1694
|
newInstance.details.boundType = undefined;
|
1698
1695
|
newInstance.details.constraints = [];
|
1699
1696
|
return newInstance;
|
@@ -1738,11 +1735,11 @@ var TypeVarType;
|
|
1738
1735
|
TypeVarType.makeNameWithScope = makeNameWithScope;
|
1739
1736
|
function create(name, isParamSpec, typeFlags, runtimeClass) {
|
1740
1737
|
const newTypeVarType = {
|
1741
|
-
category: 9 /* TypeVar */,
|
1738
|
+
category: 9 /* TypeCategory.TypeVar */,
|
1742
1739
|
details: {
|
1743
1740
|
name,
|
1744
1741
|
constraints: [],
|
1745
|
-
declaredVariance: 2 /* Invariant */,
|
1742
|
+
declaredVariance: 2 /* Variance.Invariant */,
|
1746
1743
|
isParamSpec,
|
1747
1744
|
isVariadic: false,
|
1748
1745
|
isSynthesized: false,
|
@@ -1772,11 +1769,11 @@ var TypeVarType;
|
|
1772
1769
|
var _a;
|
1773
1770
|
const variance = (_a = type.computedVariance) !== null && _a !== void 0 ? _a : type.details.declaredVariance;
|
1774
1771
|
// By this point, the variance should have been inferred.
|
1775
|
-
(0, debug_1.assert)(variance !== 0 /* Auto */, 'Expected variance to be inferred');
|
1772
|
+
(0, debug_1.assert)(variance !== 0 /* Variance.Auto */, 'Expected variance to be inferred');
|
1776
1773
|
// If we're in the process of computing variance, it will still be
|
1777
1774
|
// unknown. Default to covariant in this case.
|
1778
|
-
if (variance === 1 /* Unknown */) {
|
1779
|
-
return 3 /* Covariant */;
|
1775
|
+
if (variance === 1 /* Variance.Unknown */) {
|
1776
|
+
return 3 /* Variance.Covariant */;
|
1780
1777
|
}
|
1781
1778
|
return variance;
|
1782
1779
|
}
|
@@ -1787,21 +1784,21 @@ var TypeVarType;
|
|
1787
1784
|
return !!type.details.recursiveTypeAliasName && !type.details.boundType;
|
1788
1785
|
}
|
1789
1786
|
TypeVarType.isTypeAliasPlaceholder = isTypeAliasPlaceholder;
|
1790
|
-
})(TypeVarType
|
1787
|
+
})(TypeVarType || (exports.TypeVarType = TypeVarType = {}));
|
1791
1788
|
function isNever(type) {
|
1792
|
-
return type.category === 3 /* Never */;
|
1789
|
+
return type.category === 3 /* TypeCategory.Never */;
|
1793
1790
|
}
|
1794
1791
|
exports.isNever = isNever;
|
1795
1792
|
function isAny(type) {
|
1796
|
-
return type.category === 2 /* Any */;
|
1793
|
+
return type.category === 2 /* TypeCategory.Any */;
|
1797
1794
|
}
|
1798
1795
|
exports.isAny = isAny;
|
1799
1796
|
function isUnknown(type) {
|
1800
|
-
return type.category === 1 /* Unknown */;
|
1797
|
+
return type.category === 1 /* TypeCategory.Unknown */;
|
1801
1798
|
}
|
1802
1799
|
exports.isUnknown = isUnknown;
|
1803
1800
|
function isAnyOrUnknown(type) {
|
1804
|
-
if (type.category === 2 /* Any */ || type.category === 1 /* Unknown */) {
|
1801
|
+
if (type.category === 2 /* TypeCategory.Any */ || type.category === 1 /* TypeCategory.Unknown */) {
|
1805
1802
|
return true;
|
1806
1803
|
}
|
1807
1804
|
if (isUnion(type)) {
|
@@ -1811,11 +1808,11 @@ function isAnyOrUnknown(type) {
|
|
1811
1808
|
}
|
1812
1809
|
exports.isAnyOrUnknown = isAnyOrUnknown;
|
1813
1810
|
function isUnbound(type) {
|
1814
|
-
return type.category === 0 /* Unbound */;
|
1811
|
+
return type.category === 0 /* TypeCategory.Unbound */;
|
1815
1812
|
}
|
1816
1813
|
exports.isUnbound = isUnbound;
|
1817
1814
|
function isUnion(type) {
|
1818
|
-
return type.category === 8 /* Union */;
|
1815
|
+
return type.category === 8 /* TypeCategory.Union */;
|
1819
1816
|
}
|
1820
1817
|
exports.isUnion = isUnion;
|
1821
1818
|
function isPossiblyUnbound(type) {
|
@@ -1829,31 +1826,31 @@ function isPossiblyUnbound(type) {
|
|
1829
1826
|
}
|
1830
1827
|
exports.isPossiblyUnbound = isPossiblyUnbound;
|
1831
1828
|
function isClass(type) {
|
1832
|
-
return type.category === 6 /* Class */;
|
1829
|
+
return type.category === 6 /* TypeCategory.Class */;
|
1833
1830
|
}
|
1834
1831
|
exports.isClass = isClass;
|
1835
1832
|
function isInstantiableClass(type) {
|
1836
|
-
return type.category === 6 /* Class */ && TypeBase.isInstantiable(type);
|
1833
|
+
return type.category === 6 /* TypeCategory.Class */ && TypeBase.isInstantiable(type);
|
1837
1834
|
}
|
1838
1835
|
exports.isInstantiableClass = isInstantiableClass;
|
1839
1836
|
function isClassInstance(type) {
|
1840
|
-
return type.category === 6 /* Class */ && TypeBase.isInstance(type);
|
1837
|
+
return type.category === 6 /* TypeCategory.Class */ && TypeBase.isInstance(type);
|
1841
1838
|
}
|
1842
1839
|
exports.isClassInstance = isClassInstance;
|
1843
1840
|
function isModule(type) {
|
1844
|
-
return type.category === 7 /* Module */;
|
1841
|
+
return type.category === 7 /* TypeCategory.Module */;
|
1845
1842
|
}
|
1846
1843
|
exports.isModule = isModule;
|
1847
1844
|
function isTypeVar(type) {
|
1848
|
-
return type.category === 9 /* TypeVar */;
|
1845
|
+
return type.category === 9 /* TypeCategory.TypeVar */;
|
1849
1846
|
}
|
1850
1847
|
exports.isTypeVar = isTypeVar;
|
1851
1848
|
function isVariadicTypeVar(type) {
|
1852
|
-
return type.category === 9 /* TypeVar */ && type.details.isVariadic;
|
1849
|
+
return type.category === 9 /* TypeCategory.TypeVar */ && type.details.isVariadic;
|
1853
1850
|
}
|
1854
1851
|
exports.isVariadicTypeVar = isVariadicTypeVar;
|
1855
1852
|
function isUnpackedVariadicTypeVar(type) {
|
1856
|
-
return (type.category === 9 /* TypeVar */ &&
|
1853
|
+
return (type.category === 9 /* TypeCategory.TypeVar */ &&
|
1857
1854
|
type.details.isVariadic &&
|
1858
1855
|
!!type.isVariadicUnpacked &&
|
1859
1856
|
!type.isVariadicInUnion);
|
@@ -1871,15 +1868,15 @@ function isUnpacked(type) {
|
|
1871
1868
|
}
|
1872
1869
|
exports.isUnpacked = isUnpacked;
|
1873
1870
|
function isParamSpec(type) {
|
1874
|
-
return type.category === 9 /* TypeVar */ && type.details.isParamSpec;
|
1871
|
+
return type.category === 9 /* TypeCategory.TypeVar */ && type.details.isParamSpec;
|
1875
1872
|
}
|
1876
1873
|
exports.isParamSpec = isParamSpec;
|
1877
1874
|
function isFunction(type) {
|
1878
|
-
return type.category === 4 /* Function */;
|
1875
|
+
return type.category === 4 /* TypeCategory.Function */;
|
1879
1876
|
}
|
1880
1877
|
exports.isFunction = isFunction;
|
1881
1878
|
function isOverloadedFunction(type) {
|
1882
|
-
return type.category === 5 /* OverloadedFunction */;
|
1879
|
+
return type.category === 5 /* TypeCategory.OverloadedFunction */;
|
1883
1880
|
}
|
1884
1881
|
exports.isOverloadedFunction = isOverloadedFunction;
|
1885
1882
|
function getTypeAliasInfo(type) {
|
@@ -1905,10 +1902,10 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1905
1902
|
}
|
1906
1903
|
if (type1.category !== type2.category) {
|
1907
1904
|
if (options.treatAnySameAsUnknown) {
|
1908
|
-
if (type1.category === 2 /* Any */ && type2.category === 1 /* Unknown */) {
|
1905
|
+
if (type1.category === 2 /* TypeCategory.Any */ && type2.category === 1 /* TypeCategory.Unknown */) {
|
1909
1906
|
return true;
|
1910
1907
|
}
|
1911
|
-
if (type1.category === 1 /* Unknown */ && type2.category === 2 /* Any */) {
|
1908
|
+
if (type1.category === 1 /* TypeCategory.Unknown */ && type2.category === 2 /* TypeCategory.Any */) {
|
1912
1909
|
return true;
|
1913
1910
|
}
|
1914
1911
|
}
|
@@ -1924,8 +1921,8 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1924
1921
|
}
|
1925
1922
|
else {
|
1926
1923
|
// By default, we don't care about the Annotated flag.
|
1927
|
-
type1Flags &= ~4 /* Annotated */;
|
1928
|
-
type2Flags &= ~4 /* Annotated */;
|
1924
|
+
type1Flags &= ~4 /* TypeFlags.Annotated */;
|
1925
|
+
type2Flags &= ~4 /* TypeFlags.Annotated */;
|
1929
1926
|
}
|
1930
1927
|
if (type1Flags !== type2Flags) {
|
1931
1928
|
return false;
|
@@ -1936,7 +1933,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1936
1933
|
}
|
1937
1934
|
recursionCount++;
|
1938
1935
|
switch (type1.category) {
|
1939
|
-
case 6 /* Class */: {
|
1936
|
+
case 6 /* TypeCategory.Class */: {
|
1940
1937
|
const classType2 = type2;
|
1941
1938
|
// If the details are not the same it's not the same class.
|
1942
1939
|
if (!ClassType.isSameGenericClass(type1, classType2, recursionCount)) {
|
@@ -1987,7 +1984,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
1987
1984
|
}
|
1988
1985
|
return true;
|
1989
1986
|
}
|
1990
|
-
case 4 /* Function */: {
|
1987
|
+
case 4 /* TypeCategory.Function */: {
|
1991
1988
|
// Make sure the parameter counts match.
|
1992
1989
|
const functionType2 = type2;
|
1993
1990
|
const params1 = type1.details.parameters;
|
@@ -2058,7 +2055,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2058
2055
|
}
|
2059
2056
|
return true;
|
2060
2057
|
}
|
2061
|
-
case 5 /* OverloadedFunction */: {
|
2058
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
2062
2059
|
// Make sure the overload counts match.
|
2063
2060
|
const functionType2 = type2;
|
2064
2061
|
if (type1.overloads.length !== functionType2.overloads.length) {
|
@@ -2073,7 +2070,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2073
2070
|
}
|
2074
2071
|
return true;
|
2075
2072
|
}
|
2076
|
-
case 8 /* Union */: {
|
2073
|
+
case 8 /* TypeCategory.Union */: {
|
2077
2074
|
const unionType2 = type2;
|
2078
2075
|
const subtypes1 = type1.subtypes;
|
2079
2076
|
const subtypes2 = unionType2.subtypes;
|
@@ -2085,7 +2082,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2085
2082
|
const exclusionSet = new Set();
|
2086
2083
|
return (findSubtype(type1, (subtype) => !UnionType.containsType(unionType2, subtype, exclusionSet, recursionCount)) === undefined);
|
2087
2084
|
}
|
2088
|
-
case 9 /* TypeVar */: {
|
2085
|
+
case 9 /* TypeCategory.TypeVar */: {
|
2089
2086
|
const type2TypeVar = type2;
|
2090
2087
|
if (type1.scopeId !== type2TypeVar.scopeId) {
|
2091
2088
|
return false;
|
@@ -2144,7 +2141,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2144
2141
|
}
|
2145
2142
|
return true;
|
2146
2143
|
}
|
2147
|
-
case 7 /* Module */: {
|
2144
|
+
case 7 /* TypeCategory.Module */: {
|
2148
2145
|
const type2Module = type2;
|
2149
2146
|
// Module types are the same if they share the same
|
2150
2147
|
// module symbol table.
|
@@ -2158,7 +2155,7 @@ function isTypeSame(type1, type2, options = {}, recursionCount = 0) {
|
|
2158
2155
|
}
|
2159
2156
|
return false;
|
2160
2157
|
}
|
2161
|
-
case 1 /* Unknown */: {
|
2158
|
+
case 1 /* TypeCategory.Unknown */: {
|
2162
2159
|
const type2Unknown = type2;
|
2163
2160
|
return type1.isIncomplete === type2Unknown.isIncomplete;
|
2164
2161
|
}
|
@@ -2214,12 +2211,12 @@ exports.findSubtype = findSubtype;
|
|
2214
2211
|
function combineTypes(subtypes, maxSubtypeCount) {
|
2215
2212
|
// Filter out any "Never" and "NoReturn" types.
|
2216
2213
|
let sawNoReturn = false;
|
2217
|
-
if (subtypes.some((subtype) => subtype.category === 3 /* Never */))
|
2214
|
+
if (subtypes.some((subtype) => subtype.category === 3 /* TypeCategory.Never */))
|
2218
2215
|
subtypes = subtypes.filter((subtype) => {
|
2219
|
-
if (subtype.category === 3 /* Never */ && subtype.isNoReturn) {
|
2216
|
+
if (subtype.category === 3 /* TypeCategory.Never */ && subtype.isNoReturn) {
|
2220
2217
|
sawNoReturn = true;
|
2221
2218
|
}
|
2222
|
-
return subtype.category !== 3 /* Never */;
|
2219
|
+
return subtype.category !== 3 /* TypeCategory.Never */;
|
2223
2220
|
});
|
2224
2221
|
if (subtypes.length === 0) {
|
2225
2222
|
return sawNoReturn ? NeverType.createNoReturn() : NeverType.createNever();
|
@@ -2259,12 +2256,10 @@ function combineTypes(subtypes, maxSubtypeCount) {
|
|
2259
2256
|
}
|
2260
2257
|
// Sort all of the literal and empty types to the end.
|
2261
2258
|
expandedTypes = expandedTypes.sort((type1, type2) => {
|
2262
|
-
if ((
|
2263
|
-
(isInstantiableClass(type1) && type1.literalValue !== undefined)) {
|
2259
|
+
if (isClass(type1) && type1.literalValue !== undefined) {
|
2264
2260
|
return 1;
|
2265
2261
|
}
|
2266
|
-
|
2267
|
-
(isInstantiableClass(type2) && type2.literalValue !== undefined)) {
|
2262
|
+
if (isClass(type2) && type2.literalValue !== undefined) {
|
2268
2263
|
return -1;
|
2269
2264
|
}
|
2270
2265
|
if (isClassInstance(type1) && type1.isEmptyContainer) {
|