@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
@@ -23,41 +23,41 @@ var DeclarationType;
|
|
23
23
|
DeclarationType[DeclarationType["Class"] = 6] = "Class";
|
24
24
|
DeclarationType[DeclarationType["SpecialBuiltInClass"] = 7] = "SpecialBuiltInClass";
|
25
25
|
DeclarationType[DeclarationType["Alias"] = 8] = "Alias";
|
26
|
-
})(DeclarationType
|
26
|
+
})(DeclarationType || (exports.DeclarationType = DeclarationType = {}));
|
27
27
|
function isFunctionDeclaration(decl) {
|
28
|
-
return decl.type === 5 /* Function */;
|
28
|
+
return decl.type === 5 /* DeclarationType.Function */;
|
29
29
|
}
|
30
30
|
exports.isFunctionDeclaration = isFunctionDeclaration;
|
31
31
|
function isClassDeclaration(decl) {
|
32
|
-
return decl.type === 6 /* Class */;
|
32
|
+
return decl.type === 6 /* DeclarationType.Class */;
|
33
33
|
}
|
34
34
|
exports.isClassDeclaration = isClassDeclaration;
|
35
35
|
function isParameterDeclaration(decl) {
|
36
|
-
return decl.type === 2 /* Parameter */;
|
36
|
+
return decl.type === 2 /* DeclarationType.Parameter */;
|
37
37
|
}
|
38
38
|
exports.isParameterDeclaration = isParameterDeclaration;
|
39
39
|
function isTypeParameterDeclaration(decl) {
|
40
|
-
return decl.type === 3 /* TypeParameter */;
|
40
|
+
return decl.type === 3 /* DeclarationType.TypeParameter */;
|
41
41
|
}
|
42
42
|
exports.isTypeParameterDeclaration = isTypeParameterDeclaration;
|
43
43
|
function isTypeAliasDeclaration(decl) {
|
44
|
-
return decl.type === 4 /* TypeAlias */;
|
44
|
+
return decl.type === 4 /* DeclarationType.TypeAlias */;
|
45
45
|
}
|
46
46
|
exports.isTypeAliasDeclaration = isTypeAliasDeclaration;
|
47
47
|
function isVariableDeclaration(decl) {
|
48
|
-
return decl.type === 1 /* Variable */;
|
48
|
+
return decl.type === 1 /* DeclarationType.Variable */;
|
49
49
|
}
|
50
50
|
exports.isVariableDeclaration = isVariableDeclaration;
|
51
51
|
function isAliasDeclaration(decl) {
|
52
|
-
return decl.type === 8 /* Alias */;
|
52
|
+
return decl.type === 8 /* DeclarationType.Alias */;
|
53
53
|
}
|
54
54
|
exports.isAliasDeclaration = isAliasDeclaration;
|
55
55
|
function isSpecialBuiltInClassDeclaration(decl) {
|
56
|
-
return decl.type === 7 /* SpecialBuiltInClass */;
|
56
|
+
return decl.type === 7 /* DeclarationType.SpecialBuiltInClass */;
|
57
57
|
}
|
58
58
|
exports.isSpecialBuiltInClassDeclaration = isSpecialBuiltInClassDeclaration;
|
59
59
|
function isIntrinsicDeclaration(decl) {
|
60
|
-
return decl.type === 0 /* Intrinsic */;
|
60
|
+
return decl.type === 0 /* DeclarationType.Intrinsic */;
|
61
61
|
}
|
62
62
|
exports.isIntrinsicDeclaration = isIntrinsicDeclaration;
|
63
63
|
function isUnresolvedAliasDeclaration(decl) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/analyzer/declaration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAwBU,QAAA,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,IAAkB,eAUjB;AAVD,WAAkB,eAAe;IAC7B,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,+DAAS,CAAA;IACT,uEAAa,CAAA;IACb,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,uDAAK,CAAA;IACL,mFAAmB,CAAA;IACnB,uDAAK,CAAA;AACT,CAAC,EAViB,eAAe,
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/analyzer/declaration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAwBU,QAAA,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,IAAkB,eAUjB;AAVD,WAAkB,eAAe;IAC7B,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,+DAAS,CAAA;IACT,uEAAa,CAAA;IACb,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,uDAAK,CAAA;IACL,mFAAmB,CAAA;IACnB,uDAAK,CAAA;AACT,CAAC,EAViB,eAAe,+BAAf,eAAe,QAUhC;AA0MD,SAAgB,qBAAqB,CAAC,IAAiB;IACnD,OAAO,IAAI,CAAC,IAAI,qCAA6B,CAAC;AAClD,CAAC;AAFD,sDAEC;AAED,SAAgB,kBAAkB,CAAC,IAAiB;IAChD,OAAO,IAAI,CAAC,IAAI,kCAA0B,CAAC;AAC/C,CAAC;AAFD,gDAEC;AAED,SAAgB,sBAAsB,CAAC,IAAiB;IACpD,OAAO,IAAI,CAAC,IAAI,sCAA8B,CAAC;AACnD,CAAC;AAFD,wDAEC;AAED,SAAgB,0BAA0B,CAAC,IAAiB;IACxD,OAAO,IAAI,CAAC,IAAI,0CAAkC,CAAC;AACvD,CAAC;AAFD,gEAEC;AAED,SAAgB,sBAAsB,CAAC,IAAiB;IACpD,OAAO,IAAI,CAAC,IAAI,sCAA8B,CAAC;AACnD,CAAC;AAFD,wDAEC;AAED,SAAgB,qBAAqB,CAAC,IAAiB;IACnD,OAAO,IAAI,CAAC,IAAI,qCAA6B,CAAC;AAClD,CAAC;AAFD,sDAEC;AAED,SAAgB,kBAAkB,CAAC,IAAiB;IAChD,OAAO,IAAI,CAAC,IAAI,kCAA0B,CAAC;AAC/C,CAAC;AAFD,gDAEC;AAED,SAAgB,gCAAgC,CAAC,IAAiB;IAC9D,OAAO,IAAI,CAAC,IAAI,gDAAwC,CAAC;AAC7D,CAAC;AAFD,4EAEC;AAED,SAAgB,sBAAsB,CAAC,IAAiB;IACpD,OAAO,IAAI,CAAC,IAAI,sCAA8B,CAAC;AACnD,CAAC;AAFD,wDAEC;AAED,SAAgB,4BAA4B,CAAC,IAAiB;IAC1D,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,8BAAsB,CAAC;AAC5E,CAAC;AAFD,oEAEC"}
|
@@ -14,20 +14,20 @@ const declaration_1 = require("./declaration");
|
|
14
14
|
const parseTreeUtils_1 = require("./parseTreeUtils");
|
15
15
|
function hasTypeForDeclaration(declaration) {
|
16
16
|
switch (declaration.type) {
|
17
|
-
case 0 /* Intrinsic */:
|
18
|
-
case 6 /* Class */:
|
19
|
-
case 7 /* SpecialBuiltInClass */:
|
20
|
-
case 5 /* Function */:
|
21
|
-
case 3 /* TypeParameter */:
|
22
|
-
case 4 /* TypeAlias */:
|
17
|
+
case 0 /* DeclarationType.Intrinsic */:
|
18
|
+
case 6 /* DeclarationType.Class */:
|
19
|
+
case 7 /* DeclarationType.SpecialBuiltInClass */:
|
20
|
+
case 5 /* DeclarationType.Function */:
|
21
|
+
case 3 /* DeclarationType.TypeParameter */:
|
22
|
+
case 4 /* DeclarationType.TypeAlias */:
|
23
23
|
return true;
|
24
|
-
case 2 /* Parameter */: {
|
24
|
+
case 2 /* DeclarationType.Parameter */: {
|
25
25
|
if (declaration.node.typeAnnotation || declaration.node.typeAnnotationComment) {
|
26
26
|
return true;
|
27
27
|
}
|
28
28
|
// Handle function type comments.
|
29
29
|
const parameterParent = declaration.node.parent;
|
30
|
-
if ((parameterParent === null || parameterParent === void 0 ? void 0 : parameterParent.nodeType) === 28 /* Function */) {
|
30
|
+
if ((parameterParent === null || parameterParent === void 0 ? void 0 : parameterParent.nodeType) === 28 /* ParseNodeType.Function */) {
|
31
31
|
if (parameterParent.functionAnnotationComment &&
|
32
32
|
!parameterParent.functionAnnotationComment.isParamListEllipsis) {
|
33
33
|
const paramAnnotations = parameterParent.functionAnnotationComment.paramTypeAnnotations;
|
@@ -42,9 +42,9 @@ function hasTypeForDeclaration(declaration) {
|
|
42
42
|
}
|
43
43
|
return false;
|
44
44
|
}
|
45
|
-
case 1 /* Variable */:
|
45
|
+
case 1 /* DeclarationType.Variable */:
|
46
46
|
return !!declaration.typeAnnotationNode;
|
47
|
-
case 8 /* Alias */:
|
47
|
+
case 8 /* DeclarationType.Alias */:
|
48
48
|
return false;
|
49
49
|
}
|
50
50
|
}
|
@@ -56,7 +56,7 @@ function areDeclarationsSame(decl1, decl2, treatModuleInImportAndFromImportSame
|
|
56
56
|
if (decl1.path !== decl2.path) {
|
57
57
|
return false;
|
58
58
|
}
|
59
|
-
if (!skipRangeForAliases || decl1.type !== 8 /* Alias */) {
|
59
|
+
if (!skipRangeForAliases || decl1.type !== 8 /* DeclarationType.Alias */) {
|
60
60
|
if (decl1.range.start.line !== decl2.range.start.line ||
|
61
61
|
decl1.range.start.character !== decl2.range.start.character) {
|
62
62
|
return false;
|
@@ -64,7 +64,7 @@ function areDeclarationsSame(decl1, decl2, treatModuleInImportAndFromImportSame
|
|
64
64
|
}
|
65
65
|
// Alias declarations refer to the entire import statement.
|
66
66
|
// We need to further differentiate.
|
67
|
-
if (decl1.type === 8 /* Alias */ && decl2.type === 8 /* Alias */) {
|
67
|
+
if (decl1.type === 8 /* DeclarationType.Alias */ && decl2.type === 8 /* DeclarationType.Alias */) {
|
68
68
|
if (decl1.symbolName !== decl2.symbolName || decl1.usesLocalName !== decl2.usesLocalName) {
|
69
69
|
return false;
|
70
70
|
}
|
@@ -88,20 +88,23 @@ exports.areDeclarationsSame = areDeclarationsSame;
|
|
88
88
|
function getNameFromDeclaration(declaration) {
|
89
89
|
var _a;
|
90
90
|
switch (declaration.type) {
|
91
|
-
case 8 /* Alias */:
|
91
|
+
case 8 /* DeclarationType.Alias */:
|
92
92
|
return declaration.symbolName;
|
93
|
-
case 6 /* Class */:
|
94
|
-
case 5 /* Function */:
|
95
|
-
case 3 /* TypeParameter */:
|
96
|
-
case 4 /* TypeAlias */:
|
93
|
+
case 6 /* DeclarationType.Class */:
|
94
|
+
case 5 /* DeclarationType.Function */:
|
95
|
+
case 3 /* DeclarationType.TypeParameter */:
|
96
|
+
case 4 /* DeclarationType.TypeAlias */:
|
97
97
|
return declaration.node.name.value;
|
98
|
-
case 2 /* Parameter */:
|
98
|
+
case 2 /* DeclarationType.Parameter */:
|
99
99
|
return (_a = declaration.node.name) === null || _a === void 0 ? void 0 : _a.value;
|
100
|
-
case 1 /* Variable */:
|
101
|
-
return declaration.node.nodeType === 38 /* Name */ ? declaration.node.value : undefined;
|
102
|
-
case 0 /* Intrinsic */:
|
103
|
-
case 7 /* SpecialBuiltInClass */:
|
104
|
-
return
|
100
|
+
case 1 /* DeclarationType.Variable */:
|
101
|
+
return declaration.node.nodeType === 38 /* ParseNodeType.Name */ ? declaration.node.value : undefined;
|
102
|
+
case 0 /* DeclarationType.Intrinsic */:
|
103
|
+
case 7 /* DeclarationType.SpecialBuiltInClass */:
|
104
|
+
return declaration.node.nodeType === 54 /* ParseNodeType.TypeAnnotation */ &&
|
105
|
+
declaration.node.valueExpression.nodeType === 38 /* ParseNodeType.Name */
|
106
|
+
? declaration.node.valueExpression.value
|
107
|
+
: undefined;
|
105
108
|
}
|
106
109
|
throw new Error(`Shouldn't reach here`);
|
107
110
|
}
|
@@ -109,26 +112,26 @@ exports.getNameFromDeclaration = getNameFromDeclaration;
|
|
109
112
|
function getNameNodeForDeclaration(declaration) {
|
110
113
|
var _a, _b;
|
111
114
|
switch (declaration.type) {
|
112
|
-
case 8 /* Alias */:
|
113
|
-
if (declaration.node.nodeType === 21 /* ImportAs */) {
|
115
|
+
case 8 /* DeclarationType.Alias */:
|
116
|
+
if (declaration.node.nodeType === 21 /* ParseNodeType.ImportAs */) {
|
114
117
|
return (_a = declaration.node.alias) !== null && _a !== void 0 ? _a : declaration.node.module.nameParts[0];
|
115
118
|
}
|
116
|
-
else if (declaration.node.nodeType === 23 /* ImportFromAs */) {
|
119
|
+
else if (declaration.node.nodeType === 23 /* ParseNodeType.ImportFromAs */) {
|
117
120
|
return (_b = declaration.node.alias) !== null && _b !== void 0 ? _b : declaration.node.name;
|
118
121
|
}
|
119
122
|
else {
|
120
123
|
return declaration.node.module.nameParts[0];
|
121
124
|
}
|
122
|
-
case 6 /* Class */:
|
123
|
-
case 5 /* Function */:
|
124
|
-
case 3 /* TypeParameter */:
|
125
|
-
case 2 /* Parameter */:
|
126
|
-
case 4 /* TypeAlias */:
|
125
|
+
case 6 /* DeclarationType.Class */:
|
126
|
+
case 5 /* DeclarationType.Function */:
|
127
|
+
case 3 /* DeclarationType.TypeParameter */:
|
128
|
+
case 2 /* DeclarationType.Parameter */:
|
129
|
+
case 4 /* DeclarationType.TypeAlias */:
|
127
130
|
return declaration.node.name;
|
128
|
-
case 1 /* Variable */:
|
129
|
-
return declaration.node.nodeType === 38 /* Name */ ? declaration.node : undefined;
|
130
|
-
case 0 /* Intrinsic */:
|
131
|
-
case 7 /* SpecialBuiltInClass */:
|
131
|
+
case 1 /* DeclarationType.Variable */:
|
132
|
+
return declaration.node.nodeType === 38 /* ParseNodeType.Name */ ? declaration.node : undefined;
|
133
|
+
case 0 /* DeclarationType.Intrinsic */:
|
134
|
+
case 7 /* DeclarationType.SpecialBuiltInClass */:
|
132
135
|
return undefined;
|
133
136
|
}
|
134
137
|
throw new Error(`Shouldn't reach here`);
|
@@ -149,7 +152,7 @@ exports.isDefinedInFile = isDefinedInFile;
|
|
149
152
|
function getDeclarationsWithUsesLocalNameRemoved(decls) {
|
150
153
|
// Make a shallow copy and clear the "usesLocalName" field.
|
151
154
|
return decls.map((localDecl) => {
|
152
|
-
if (localDecl.type !== 8 /* Alias */) {
|
155
|
+
if (localDecl.type !== 8 /* DeclarationType.Alias */) {
|
153
156
|
return localDecl;
|
154
157
|
}
|
155
158
|
const nonLocalDecl = { ...localDecl };
|
@@ -162,7 +165,7 @@ function createSynthesizedAliasDeclaration(path) {
|
|
162
165
|
// The only time this decl is used is for IDE services such as
|
163
166
|
// the find all references, hover provider and etc.
|
164
167
|
return {
|
165
|
-
type: 8 /* Alias */,
|
168
|
+
type: 8 /* DeclarationType.Alias */,
|
166
169
|
node: undefined,
|
167
170
|
path,
|
168
171
|
loadSymbolsFromPath: false,
|
@@ -193,7 +196,7 @@ function resolveAliasDeclaration(importLookup, declaration, options) {
|
|
193
196
|
let privatePyTypedImported;
|
194
197
|
let privatePyTypedImporter;
|
195
198
|
while (true) {
|
196
|
-
if (curDeclaration.type !== 8 /* Alias */ || !curDeclaration.symbolName) {
|
199
|
+
if (curDeclaration.type !== 8 /* DeclarationType.Alias */ || !curDeclaration.symbolName) {
|
197
200
|
return {
|
198
201
|
declaration: curDeclaration,
|
199
202
|
isPrivate,
|
@@ -228,7 +231,7 @@ function resolveAliasDeclaration(importLookup, declaration, options) {
|
|
228
231
|
// when useLibraryCodeForTypes is disabled), b should be evaluated as Unknown,
|
229
232
|
// not as a module.
|
230
233
|
if (curDeclaration.path &&
|
231
|
-
curDeclaration.submoduleFallback.type === 8 /* Alias */ &&
|
234
|
+
curDeclaration.submoduleFallback.type === 8 /* DeclarationType.Alias */ &&
|
232
235
|
curDeclaration.submoduleFallback.path) {
|
233
236
|
const lookupResult = importLookup(curDeclaration.submoduleFallback.path, {
|
234
237
|
skipFileNeededCheck: options.skipFileNeededCheck,
|
@@ -260,7 +263,7 @@ function resolveAliasDeclaration(importLookup, declaration, options) {
|
|
260
263
|
}
|
261
264
|
return undefined;
|
262
265
|
}
|
263
|
-
if (symbol.isPrivateMember()) {
|
266
|
+
if (symbol.isPrivateMember() && !sawPyTypedTransition) {
|
264
267
|
isPrivate = true;
|
265
268
|
}
|
266
269
|
if (symbol.isExternallyHidden() && !options.allowExternallyHiddenAccess) {
|
@@ -319,7 +322,7 @@ function resolveAliasDeclaration(importLookup, declaration, options) {
|
|
319
322
|
// the module is foo, and the foo.__init__.py file contains the statement
|
320
323
|
// "from foo import bar", we want to import the foo/bar.py submodule.
|
321
324
|
if (curDeclaration.path === declaration.path &&
|
322
|
-
curDeclaration.type === 8 /* Alias */ &&
|
325
|
+
curDeclaration.type === 8 /* DeclarationType.Alias */ &&
|
323
326
|
curDeclaration.submoduleFallback) {
|
324
327
|
return resolveAliasDeclaration(importLookup, curDeclaration.submoduleFallback, options);
|
325
328
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"declarationUtils.js","sourceRoot":"","sources":["../../../src/analyzer/declarationUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,mDAAoD;AAGpD,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CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC1D;QAED,IAAI,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,kBAAkB,EAAE;YAClC,IAAI,CAAC,oBAAoB,EAAE;gBACvB,IAAI,MAAM,CAAC,sBAAsB,EAAE,EAAE;oBACjC,sBAAsB,GAAG,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,UAAU,CAAC;iBACxD;gBAED,sEAAsE;gBACtE,sCAAsC;gBACtC,oBAAoB,GAAG,IAAI,CAAC;aAC/B;iBAAM;gBACH,qEAAqE;gBACrE,sEAAsE;gBACtE,oBAAoB;gBACpB,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,EAAE;oBAClC,sBAAsB,GAAG,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,CAAC;iBACjF;aACJ;SACJ;QAED,0DAA0D;QAC1D,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,cAAc,CAAC,EAAE;YACxD,oFAAoF;YACpF,+EAA+E;YAC/E,yEAAyE;YACzE,yEAAyE;YACzE,qEAAqE;YACrE,IACI,cAAc,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;gBACxC,cAAc,CAAC,IAAI,kCAA0B;gBAC7C,cAAc,CAAC,iBAAiB,EAClC;gBACE,OAAO,uBAAuB,CAAC,YAAY,EAAE,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;aAC3F;YACD,OAAO;gBACH,WAAW;gBACX,SAAS;gBACT,sBAAsB;gBACtB,sBAAsB;aACzB,CAAC;SACL;QACD,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;KACvC;AACL,CAAC;AArLD,0DAqLC"}
|
@@ -23,30 +23,30 @@ const types_1 = require("./types");
|
|
23
23
|
// that affect the function flags.
|
24
24
|
function getFunctionInfoFromDecorators(evaluator, node, isInClass) {
|
25
25
|
const fileInfo = (0, analyzerNodeInfo_1.getFileInfo)(node);
|
26
|
-
let flags = 0 /* None */;
|
26
|
+
let flags = 0 /* FunctionTypeFlags.None */;
|
27
27
|
let deprecationMessage;
|
28
28
|
if (isInClass) {
|
29
29
|
// The "__new__" magic method is not an instance method.
|
30
30
|
// It acts as a static method instead.
|
31
31
|
if (node.name.value === '__new__') {
|
32
|
-
flags |= 1 /* ConstructorMethod */;
|
32
|
+
flags |= 1 /* FunctionTypeFlags.ConstructorMethod */;
|
33
33
|
}
|
34
34
|
// Several magic methods are treated as class methods implicitly
|
35
35
|
// by the runtime. Check for these here.
|
36
36
|
const implicitClassMethods = ['__init_subclass__', '__class_getitem__'];
|
37
37
|
if (implicitClassMethods.some((name) => node.name.value === name)) {
|
38
|
-
flags |= 2 /* ClassMethod */;
|
38
|
+
flags |= 2 /* FunctionTypeFlags.ClassMethod */;
|
39
39
|
}
|
40
40
|
}
|
41
41
|
for (const decoratorNode of node.decorators) {
|
42
42
|
// Some stub files (e.g. builtins.pyi) rely on forward declarations of decorators.
|
43
|
-
let evaluatorFlags = fileInfo.isStubFile ? 4 /* AllowForwardReferences */ : 0 /* None */;
|
44
|
-
if (decoratorNode.expression.nodeType !== 9 /* Call */) {
|
45
|
-
evaluatorFlags |= 16777218 /* CallBaseDefaults */;
|
43
|
+
let evaluatorFlags = fileInfo.isStubFile ? 4 /* EvaluatorFlags.AllowForwardReferences */ : 0 /* EvaluatorFlags.None */;
|
44
|
+
if (decoratorNode.expression.nodeType !== 9 /* ParseNodeType.Call */) {
|
45
|
+
evaluatorFlags |= 16777218 /* EvaluatorFlags.CallBaseDefaults */;
|
46
46
|
}
|
47
47
|
else {
|
48
|
-
if (decoratorNode.expression.nodeType === 9 /* Call */) {
|
49
|
-
const decoratorCallType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, evaluatorFlags | 16777218 /* CallBaseDefaults */).type;
|
48
|
+
if (decoratorNode.expression.nodeType === 9 /* ParseNodeType.Call */) {
|
49
|
+
const decoratorCallType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, evaluatorFlags | 16777218 /* EvaluatorFlags.CallBaseDefaults */).type;
|
50
50
|
if ((0, types_1.isFunction)(decoratorCallType)) {
|
51
51
|
if (decoratorCallType.details.builtInName === 'deprecated') {
|
52
52
|
deprecationMessage = getCustomDeprecationMessage(decoratorNode);
|
@@ -65,20 +65,20 @@ function getFunctionInfoFromDecorators(evaluator, node, isInClass) {
|
|
65
65
|
if ((0, types_1.isFunction)(decoratorType)) {
|
66
66
|
if (decoratorType.details.builtInName === 'abstractmethod') {
|
67
67
|
if (isInClass) {
|
68
|
-
flags |= 8 /* AbstractMethod */;
|
68
|
+
flags |= 8 /* FunctionTypeFlags.AbstractMethod */;
|
69
69
|
}
|
70
70
|
}
|
71
71
|
else if (decoratorType.details.builtInName === 'final') {
|
72
|
-
flags |= 8192 /* Final */;
|
72
|
+
flags |= 8192 /* FunctionTypeFlags.Final */;
|
73
73
|
}
|
74
74
|
else if (decoratorType.details.builtInName === 'override') {
|
75
|
-
flags |= 262144 /* Overridden */;
|
75
|
+
flags |= 262144 /* FunctionTypeFlags.Overridden */;
|
76
76
|
}
|
77
77
|
else if (decoratorType.details.builtInName === 'type_check_only') {
|
78
|
-
flags |= 128 /* TypeCheckOnly */;
|
78
|
+
flags |= 128 /* FunctionTypeFlags.TypeCheckOnly */;
|
79
79
|
}
|
80
80
|
else if (decoratorType.details.builtInName === 'overload') {
|
81
|
-
flags |= 256 /* Overloaded */;
|
81
|
+
flags |= 256 /* FunctionTypeFlags.Overloaded */;
|
82
82
|
}
|
83
83
|
else if (decoratorType.details.builtInName === 'deprecated') {
|
84
84
|
deprecationMessage = getCustomDeprecationMessage(decoratorNode);
|
@@ -92,12 +92,12 @@ function getFunctionInfoFromDecorators(evaluator, node, isInClass) {
|
|
92
92
|
else if ((0, types_1.isInstantiableClass)(decoratorType)) {
|
93
93
|
if (types_1.ClassType.isBuiltIn(decoratorType, 'staticmethod')) {
|
94
94
|
if (isInClass) {
|
95
|
-
flags |= 4 /* StaticMethod */;
|
95
|
+
flags |= 4 /* FunctionTypeFlags.StaticMethod */;
|
96
96
|
}
|
97
97
|
}
|
98
98
|
else if (types_1.ClassType.isBuiltIn(decoratorType, 'classmethod')) {
|
99
99
|
if (isInClass) {
|
100
|
-
flags |= 2 /* ClassMethod */;
|
100
|
+
flags |= 2 /* FunctionTypeFlags.ClassMethod */;
|
101
101
|
}
|
102
102
|
}
|
103
103
|
}
|
@@ -110,9 +110,9 @@ exports.getFunctionInfoFromDecorators = getFunctionInfoFromDecorators;
|
|
110
110
|
function applyFunctionDecorator(evaluator, inputFunctionType, undecoratedType, decoratorNode, functionNode) {
|
111
111
|
const fileInfo = (0, analyzerNodeInfo_1.getFileInfo)(decoratorNode);
|
112
112
|
// Some stub files (e.g. builtins.pyi) rely on forward declarations of decorators.
|
113
|
-
let evaluatorFlags = fileInfo.isStubFile ? 4 /* AllowForwardReferences */ : 0 /* None */;
|
114
|
-
if (decoratorNode.expression.nodeType !== 9 /* Call */) {
|
115
|
-
evaluatorFlags |= 16777218 /* CallBaseDefaults */;
|
113
|
+
let evaluatorFlags = fileInfo.isStubFile ? 4 /* EvaluatorFlags.AllowForwardReferences */ : 0 /* EvaluatorFlags.None */;
|
114
|
+
if (decoratorNode.expression.nodeType !== 9 /* ParseNodeType.Call */) {
|
115
|
+
evaluatorFlags |= 16777218 /* EvaluatorFlags.CallBaseDefaults */;
|
116
116
|
}
|
117
117
|
const decoratorTypeResult = evaluator.getTypeOfExpression(decoratorNode.expression, evaluatorFlags);
|
118
118
|
const decoratorType = decoratorTypeResult.type;
|
@@ -121,13 +121,13 @@ function applyFunctionDecorator(evaluator, inputFunctionType, undecoratedType, d
|
|
121
121
|
if (((0, types_1.isInstantiableClass)(decoratorType) && types_1.ClassType.isSpecialBuiltIn(decoratorType, 'overload')) ||
|
122
122
|
((0, types_1.isFunction)(decoratorType) && decoratorType.details.builtInName === 'overload')) {
|
123
123
|
if ((0, types_1.isFunction)(inputFunctionType)) {
|
124
|
-
inputFunctionType.details.flags |= 256 /* Overloaded */;
|
125
|
-
undecoratedType.details.flags |= 256 /* Overloaded */;
|
124
|
+
inputFunctionType.details.flags |= 256 /* FunctionTypeFlags.Overloaded */;
|
125
|
+
undecoratedType.details.flags |= 256 /* FunctionTypeFlags.Overloaded */;
|
126
126
|
return inputFunctionType;
|
127
127
|
}
|
128
128
|
}
|
129
|
-
if (decoratorNode.expression.nodeType === 9 /* Call */) {
|
130
|
-
const decoratorCallType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, evaluatorFlags | 16777218 /* CallBaseDefaults */).type;
|
129
|
+
if (decoratorNode.expression.nodeType === 9 /* ParseNodeType.Call */) {
|
130
|
+
const decoratorCallType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, evaluatorFlags | 16777218 /* EvaluatorFlags.CallBaseDefaults */).type;
|
131
131
|
if ((0, types_1.isFunction)(decoratorCallType)) {
|
132
132
|
if (decoratorCallType.details.name === '__dataclass_transform__' ||
|
133
133
|
decoratorCallType.details.builtInName === 'dataclass_transform') {
|
@@ -153,12 +153,12 @@ function applyFunctionDecorator(evaluator, inputFunctionType, undecoratedType, d
|
|
153
153
|
return inputFunctionType;
|
154
154
|
}
|
155
155
|
if (decoratorType.details.builtInName === 'type_check_only') {
|
156
|
-
undecoratedType.details.flags |= 128 /* TypeCheckOnly */;
|
156
|
+
undecoratedType.details.flags |= 128 /* FunctionTypeFlags.TypeCheckOnly */;
|
157
157
|
return inputFunctionType;
|
158
158
|
}
|
159
159
|
// Handle property setters and deleters.
|
160
|
-
if (decoratorNode.expression.nodeType === 35 /* MemberAccess */) {
|
161
|
-
const baseType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, evaluatorFlags | 16777218 /* MemberAccessBaseDefaults */).type;
|
160
|
+
if (decoratorNode.expression.nodeType === 35 /* ParseNodeType.MemberAccess */) {
|
161
|
+
const baseType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, evaluatorFlags | 16777218 /* EvaluatorFlags.MemberAccessBaseDefaults */).type;
|
162
162
|
if ((0, typeUtils_1.isProperty)(baseType)) {
|
163
163
|
const memberName = decoratorNode.expression.memberName.value;
|
164
164
|
if (memberName === 'setter') {
|
@@ -193,16 +193,16 @@ function applyFunctionDecorator(evaluator, inputFunctionType, undecoratedType, d
|
|
193
193
|
case 'classmethod':
|
194
194
|
case 'staticmethod': {
|
195
195
|
const requiredFlag = decoratorType.details.name === 'classmethod'
|
196
|
-
? 2 /* ClassMethod */
|
197
|
-
: 4 /* StaticMethod */;
|
196
|
+
? 2 /* FunctionTypeFlags.ClassMethod */
|
197
|
+
: 4 /* FunctionTypeFlags.StaticMethod */;
|
198
198
|
// If the function isn't currently a class method or static method
|
199
199
|
// (which can happen if the function was wrapped in a decorator),
|
200
200
|
// add the appropriate flag.
|
201
201
|
if ((0, types_1.isFunction)(inputFunctionType) && (inputFunctionType.details.flags & requiredFlag) === 0) {
|
202
202
|
const newFunction = types_1.FunctionType.clone(inputFunctionType);
|
203
|
-
newFunction.details.flags &= ~(1 /* ConstructorMethod */ |
|
204
|
-
4 /* StaticMethod */ |
|
205
|
-
2 /* ClassMethod */);
|
203
|
+
newFunction.details.flags &= ~(1 /* FunctionTypeFlags.ConstructorMethod */ |
|
204
|
+
4 /* FunctionTypeFlags.StaticMethod */ |
|
205
|
+
2 /* FunctionTypeFlags.ClassMethod */);
|
206
206
|
newFunction.details.flags |= requiredFlag;
|
207
207
|
return newFunction;
|
208
208
|
}
|
@@ -229,7 +229,7 @@ function applyFunctionDecorator(evaluator, inputFunctionType, undecoratedType, d
|
|
229
229
|
returnType = types_1.FunctionType.clone(returnType);
|
230
230
|
// Copy the overload flag from the input function type.
|
231
231
|
if (types_1.FunctionType.isOverloaded(inputFunctionType)) {
|
232
|
-
returnType.details.flags |= 256 /* Overloaded */;
|
232
|
+
returnType.details.flags |= 256 /* FunctionTypeFlags.Overloaded */;
|
233
233
|
}
|
234
234
|
// Copy the docstrings from the input function type if the
|
235
235
|
// decorator didn't have its own docstring.
|
@@ -242,13 +242,13 @@ function applyFunctionDecorator(evaluator, inputFunctionType, undecoratedType, d
|
|
242
242
|
exports.applyFunctionDecorator = applyFunctionDecorator;
|
243
243
|
function applyClassDecorator(evaluator, inputClassType, originalClassType, decoratorNode) {
|
244
244
|
const fileInfo = (0, analyzerNodeInfo_1.getFileInfo)(decoratorNode);
|
245
|
-
let flags = fileInfo.isStubFile ? 4 /* AllowForwardReferences */ : 0 /* None */;
|
246
|
-
if (decoratorNode.expression.nodeType !== 9 /* Call */) {
|
247
|
-
flags |= 16777218 /* CallBaseDefaults */;
|
245
|
+
let flags = fileInfo.isStubFile ? 4 /* EvaluatorFlags.AllowForwardReferences */ : 0 /* EvaluatorFlags.None */;
|
246
|
+
if (decoratorNode.expression.nodeType !== 9 /* ParseNodeType.Call */) {
|
247
|
+
flags |= 16777218 /* EvaluatorFlags.CallBaseDefaults */;
|
248
248
|
}
|
249
249
|
const decoratorType = evaluator.getTypeOfExpression(decoratorNode.expression, flags).type;
|
250
|
-
if (decoratorNode.expression.nodeType === 9 /* Call */) {
|
251
|
-
const decoratorCallType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, flags | 16777218 /* CallBaseDefaults */).type;
|
250
|
+
if (decoratorNode.expression.nodeType === 9 /* ParseNodeType.Call */) {
|
251
|
+
const decoratorCallType = evaluator.getTypeOfExpression(decoratorNode.expression.leftExpression, flags | 16777218 /* EvaluatorFlags.CallBaseDefaults */).type;
|
252
252
|
if ((0, types_1.isFunction)(decoratorCallType)) {
|
253
253
|
if (decoratorCallType.details.name === '__dataclass_transform__' ||
|
254
254
|
decoratorCallType.details.builtInName === 'dataclass_transform') {
|
@@ -277,18 +277,18 @@ function applyClassDecorator(evaluator, inputClassType, originalClassType, decor
|
|
277
277
|
}
|
278
278
|
else if ((0, types_1.isFunction)(decoratorType)) {
|
279
279
|
if (decoratorType.details.builtInName === 'final') {
|
280
|
-
originalClassType.details.flags |= 4096 /* Final */;
|
280
|
+
originalClassType.details.flags |= 4096 /* ClassTypeFlags.Final */;
|
281
281
|
// Don't call getTypeOfDecorator for final. We'll hard-code its
|
282
282
|
// behavior because its function definition results in a cyclical
|
283
283
|
// dependency between builtins, typing and _typeshed stubs.
|
284
284
|
return inputClassType;
|
285
285
|
}
|
286
286
|
if (decoratorType.details.builtInName === 'type_check_only') {
|
287
|
-
originalClassType.details.flags |= 134217728 /* TypeCheckOnly */;
|
287
|
+
originalClassType.details.flags |= 134217728 /* ClassTypeFlags.TypeCheckOnly */;
|
288
288
|
return inputClassType;
|
289
289
|
}
|
290
290
|
if (decoratorType.details.builtInName === 'runtime_checkable') {
|
291
|
-
originalClassType.details.flags |= 32768 /* RuntimeCheckable */;
|
291
|
+
originalClassType.details.flags |= 32768 /* ClassTypeFlags.RuntimeCheckable */;
|
292
292
|
// Don't call getTypeOfDecorator for runtime_checkable. It appears
|
293
293
|
// frequently in stubs, and it's a waste of time to validate its
|
294
294
|
// parameters.
|
@@ -297,9 +297,9 @@ function applyClassDecorator(evaluator, inputClassType, originalClassType, decor
|
|
297
297
|
// Is this a dataclass decorator?
|
298
298
|
let dataclassBehaviors;
|
299
299
|
let callNode;
|
300
|
-
if (decoratorNode.expression.nodeType === 9 /* Call */) {
|
300
|
+
if (decoratorNode.expression.nodeType === 9 /* ParseNodeType.Call */) {
|
301
301
|
callNode = decoratorNode.expression;
|
302
|
-
const decoratorCallType = evaluator.getTypeOfExpression(callNode.leftExpression, flags | 16777218 /* CallBaseDefaults */).type;
|
302
|
+
const decoratorCallType = evaluator.getTypeOfExpression(callNode.leftExpression, flags | 16777218 /* EvaluatorFlags.CallBaseDefaults */).type;
|
303
303
|
dataclassBehaviors = (0, dataClasses_1.getDataclassDecoratorBehaviors)(decoratorCallType);
|
304
304
|
}
|
305
305
|
else {
|
@@ -317,9 +317,9 @@ exports.applyClassDecorator = applyClassDecorator;
|
|
317
317
|
function getTypeOfDecorator(evaluator, node, functionOrClassType) {
|
318
318
|
var _a, _b;
|
319
319
|
// Evaluate the type of the decorator expression.
|
320
|
-
let flags = (0, analyzerNodeInfo_1.getFileInfo)(node).isStubFile ? 4 /* AllowForwardReferences */ : 0 /* None */;
|
321
|
-
if (node.expression.nodeType !== 9 /* Call */) {
|
322
|
-
flags |= 16777218 /* CallBaseDefaults */;
|
320
|
+
let flags = (0, analyzerNodeInfo_1.getFileInfo)(node).isStubFile ? 4 /* EvaluatorFlags.AllowForwardReferences */ : 0 /* EvaluatorFlags.None */;
|
321
|
+
if (node.expression.nodeType !== 9 /* ParseNodeType.Call */) {
|
322
|
+
flags |= 16777218 /* EvaluatorFlags.CallBaseDefaults */;
|
323
323
|
}
|
324
324
|
const decoratorTypeResult = evaluator.getTypeOfExpression(node.expression, flags);
|
325
325
|
// Special-case the combination of a classmethod decorator applied
|
@@ -332,7 +332,7 @@ function getTypeOfDecorator(evaluator, node, functionOrClassType) {
|
|
332
332
|
}
|
333
333
|
const argList = [
|
334
334
|
{
|
335
|
-
argumentCategory: 0 /* Simple */,
|
335
|
+
argumentCategory: 0 /* ArgumentCategory.Simple */,
|
336
336
|
typeResult: { type: functionOrClassType },
|
337
337
|
},
|
338
338
|
];
|
@@ -355,7 +355,7 @@ function getTypeOfDecorator(evaluator, node, functionOrClassType) {
|
|
355
355
|
return true;
|
356
356
|
}
|
357
357
|
// Allow *args or **kwargs parameters.
|
358
|
-
if (param.category !== 0 /* Simple */) {
|
358
|
+
if (param.category !== 0 /* ParameterCategory.Simple */) {
|
359
359
|
return false;
|
360
360
|
}
|
361
361
|
// Allow inferred "self" or "cls" parameters.
|
@@ -398,14 +398,14 @@ function addOverloadsToFunctionType(evaluator, node, type) {
|
|
398
398
|
// to recursion if there is a large number (1000's) of overloads.
|
399
399
|
for (let i = 0; i < declIndex; i++) {
|
400
400
|
const decl = decls[i];
|
401
|
-
if (decl.type === 5 /* Function */) {
|
401
|
+
if (decl.type === 5 /* DeclarationType.Function */) {
|
402
402
|
evaluator.getTypeOfFunction(decl.node);
|
403
403
|
}
|
404
404
|
}
|
405
405
|
let overloadedTypes = [];
|
406
406
|
// Look at the previous declaration's type.
|
407
407
|
const prevDecl = decls[declIndex - 1];
|
408
|
-
if (prevDecl.type === 5 /* Function */) {
|
408
|
+
if (prevDecl.type === 5 /* DeclarationType.Function */) {
|
409
409
|
const prevDeclDeclTypeInfo = evaluator.getTypeOfFunction(prevDecl.node);
|
410
410
|
if (prevDeclDeclTypeInfo) {
|
411
411
|
if ((0, types_1.isFunction)(prevDeclDeclTypeInfo.decoratedType)) {
|
@@ -464,10 +464,10 @@ exports.addOverloadsToFunctionType = addOverloadsToFunctionType;
|
|
464
464
|
// Given a @typing.deprecated decorator node, returns either '' or a custom
|
465
465
|
// deprecation message if one is provided.
|
466
466
|
function getCustomDeprecationMessage(decorator) {
|
467
|
-
if (decorator.expression.nodeType === 9 /* Call */ &&
|
467
|
+
if (decorator.expression.nodeType === 9 /* ParseNodeType.Call */ &&
|
468
468
|
decorator.expression.arguments.length > 0 &&
|
469
|
-
decorator.expression.arguments[0].argumentCategory === 0 /* Simple */ &&
|
470
|
-
decorator.expression.arguments[0].valueExpression.nodeType === 48 /* StringList */ &&
|
469
|
+
decorator.expression.arguments[0].argumentCategory === 0 /* ArgumentCategory.Simple */ &&
|
470
|
+
decorator.expression.arguments[0].valueExpression.nodeType === 48 /* ParseNodeType.StringList */ &&
|
471
471
|
decorator.expression.arguments[0].valueExpression.strings.length === 1) {
|
472
472
|
const message = decorator.expression.arguments[0].valueExpression.strings[0].value;
|
473
473
|
return (0, docStringConversion_1.convertDocStringToPlainText)(message);
|