@zzzen/pyright-internal 1.2.0-dev.20231119 → 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.js +257 -239
- 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 +40 -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 +23 -25
- 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 +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 +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 +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 +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 +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 +1233 -1153
- 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 +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.js +123 -123
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.js +9 -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 +16 -11
- package/dist/analyzer/types.js +179 -177
- 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.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 +8 -8
- 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.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 +7 -9
- package/dist/localization/localize.js +5 -4
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +0 -3
- package/dist/localization/package.nls.de.json +0 -3
- package/dist/localization/package.nls.en-us.json +4 -3
- package/dist/localization/package.nls.es.json +0 -3
- package/dist/localization/package.nls.fr.json +0 -3
- package/dist/localization/package.nls.it.json +0 -3
- package/dist/localization/package.nls.ja.json +0 -3
- package/dist/localization/package.nls.ko.json +0 -3
- package/dist/localization/package.nls.pl.json +0 -3
- package/dist/localization/package.nls.pt-br.json +0 -3
- package/dist/localization/package.nls.qps-ploc.json +0 -3
- package/dist/localization/package.nls.ru.json +0 -3
- package/dist/localization/package.nls.tr.json +0 -3
- package/dist/localization/package.nls.zh-cn.json +0 -3
- package/dist/localization/package.nls.zh-tw.json +0 -3
- 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 +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/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/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 +14 -2
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +11 -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 +10 -2
- 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
@@ -56,10 +56,10 @@ class PackageTypeVerifier {
|
|
56
56
|
const commonDiagnostics = report.generalDiagnostics;
|
57
57
|
try {
|
58
58
|
if (!trimmedModuleName) {
|
59
|
-
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `Module name "${trimmedModuleName}" is invalid`, (0, textRange_1.getEmptyRange)()));
|
59
|
+
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `Module name "${trimmedModuleName}" is invalid`, (0, textRange_1.getEmptyRange)()));
|
60
60
|
}
|
61
61
|
else if (!report.moduleRootDirectory) {
|
62
|
-
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `Module "${trimmedModuleName}" cannot be resolved`, (0, textRange_1.getEmptyRange)()));
|
62
|
+
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `Module "${trimmedModuleName}" cannot be resolved`, (0, textRange_1.getEmptyRange)()));
|
63
63
|
}
|
64
64
|
else {
|
65
65
|
let pyTypedInfo;
|
@@ -72,14 +72,14 @@ class PackageTypeVerifier {
|
|
72
72
|
pyTypedInfo = this._getDeepestPyTypedInfo(report.packageRootDirectory, moduleNameParts);
|
73
73
|
}
|
74
74
|
if (!pyTypedInfo) {
|
75
|
-
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, 'No py.typed file found', (0, textRange_1.getEmptyRange)()));
|
75
|
+
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, 'No py.typed file found', (0, textRange_1.getEmptyRange)()));
|
76
76
|
}
|
77
77
|
else {
|
78
78
|
report.pyTypedPath = pyTypedInfo.pyTypedPath;
|
79
79
|
const publicModules = this._getListOfPublicModules(report.moduleRootDirectory, report.isModuleSingleFile, trimmedModuleName);
|
80
80
|
// If the filter eliminated all modules, report an error.
|
81
81
|
if (publicModules.length === 0) {
|
82
|
-
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `Module "${trimmedModuleName}" cannot be resolved`, (0, textRange_1.getEmptyRange)()));
|
82
|
+
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `Module "${trimmedModuleName}" cannot be resolved`, (0, textRange_1.getEmptyRange)()));
|
83
83
|
}
|
84
84
|
// Build a set of all public symbols exported by this package. We'll
|
85
85
|
// use this map to determine which diagnostics to report. We don't want
|
@@ -98,7 +98,7 @@ class PackageTypeVerifier {
|
|
98
98
|
const message = (e.stack ? e.stack.toString() : undefined) ||
|
99
99
|
(typeof e.message === 'string' ? e.message : undefined) ||
|
100
100
|
JSON.stringify(e);
|
101
|
-
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `An internal error occurred while verifying types: "${message}"`, (0, textRange_1.getEmptyRange)()));
|
101
|
+
commonDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `An internal error occurred while verifying types: "${message}"`, (0, textRange_1.getEmptyRange)()));
|
102
102
|
}
|
103
103
|
return report;
|
104
104
|
}
|
@@ -154,7 +154,7 @@ class PackageTypeVerifier {
|
|
154
154
|
};
|
155
155
|
const parseTree = sourceFile.getParseResults().parseTree;
|
156
156
|
const moduleScope = (0, scopeUtils_1.getScopeForNode)(parseTree);
|
157
|
-
this._getPublicSymbolsInSymbolTable(publicSymbols, alternateSymbolNames, module, module.name, moduleScope.symbolTable, 3 /* Module */);
|
157
|
+
this._getPublicSymbolsInSymbolTable(publicSymbols, alternateSymbolNames, module, module.name, moduleScope.symbolTable, 3 /* ScopeType.Module */);
|
158
158
|
}
|
159
159
|
}
|
160
160
|
}
|
@@ -171,16 +171,16 @@ class PackageTypeVerifier {
|
|
171
171
|
if (typedDecls.length > 0) {
|
172
172
|
// Is this a class declared within this module or class?
|
173
173
|
// If so, add the symbols declared within it.
|
174
|
-
const classDecl = typedDecls.find((decl) => decl.type === 6 /* Class */);
|
174
|
+
const classDecl = typedDecls.find((decl) => decl.type === 6 /* DeclarationType.Class */);
|
175
175
|
if (classDecl) {
|
176
176
|
if ((0, types_1.isInstantiableClass)(symbolType)) {
|
177
|
-
this._getPublicSymbolsInSymbolTable(publicSymbols, alternateSymbolNames, module, fullName, symbolType.details.fields, 2 /* Class */);
|
177
|
+
this._getPublicSymbolsInSymbolTable(publicSymbols, alternateSymbolNames, module, fullName, symbolType.details.fields, 2 /* ScopeType.Class */);
|
178
178
|
}
|
179
179
|
}
|
180
180
|
}
|
181
181
|
// Is this the re-export of an import? If so, record the alternate name.
|
182
|
-
const importDecl = symbol.getDeclarations().find((decl) => decl.type === 8 /* Alias */);
|
183
|
-
if (importDecl && importDecl.type === 8 /* Alias */) {
|
182
|
+
const importDecl = symbol.getDeclarations().find((decl) => decl.type === 8 /* DeclarationType.Alias */);
|
183
|
+
if (importDecl && importDecl.type === 8 /* DeclarationType.Alias */) {
|
184
184
|
const typeName = (0, typeUtils_1.getFullNameOfType)(this._program.getTypeOfSymbol(symbol));
|
185
185
|
if (typeName) {
|
186
186
|
this._addAlternateSymbolName(alternateSymbolNames, typeName, fullName);
|
@@ -206,10 +206,10 @@ class PackageTypeVerifier {
|
|
206
206
|
_verifyTypesOfModule(moduleName, publicSymbols, report) {
|
207
207
|
const importResult = this._resolveImport(moduleName);
|
208
208
|
if (!importResult.isImportFound) {
|
209
|
-
report.generalDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `Could not resolve module "${moduleName}"`, (0, textRange_1.getEmptyRange)()));
|
209
|
+
report.generalDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `Could not resolve module "${moduleName}"`, (0, textRange_1.getEmptyRange)()));
|
210
210
|
}
|
211
211
|
else if (importResult.isStubPackage) {
|
212
|
-
report.generalDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `No inlined types found for module "${moduleName}" because stub package was present`, (0, textRange_1.getEmptyRange)()));
|
212
|
+
report.generalDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `No inlined types found for module "${moduleName}" because stub package was present`, (0, textRange_1.getEmptyRange)()));
|
213
213
|
}
|
214
214
|
else {
|
215
215
|
const modulePath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
|
@@ -224,10 +224,10 @@ class PackageTypeVerifier {
|
|
224
224
|
if (sourceFile) {
|
225
225
|
const parseTree = sourceFile.getParseResults().parseTree;
|
226
226
|
const moduleScope = (0, scopeUtils_1.getScopeForNode)(parseTree);
|
227
|
-
this._getTypeKnownStatusForSymbolTable(report, module.name, moduleScope.symbolTable, 3 /* Module */, publicSymbols);
|
227
|
+
this._getTypeKnownStatusForSymbolTable(report, module.name, moduleScope.symbolTable, 3 /* ScopeType.Module */, publicSymbols);
|
228
228
|
}
|
229
229
|
else {
|
230
|
-
report.generalDiagnostics.push(new diagnostic_1.Diagnostic(0 /* Error */, `Could not bind file "${modulePath}"`, (0, textRange_1.getEmptyRange)()));
|
230
|
+
report.generalDiagnostics.push(new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, `Could not bind file "${modulePath}"`, (0, textRange_1.getEmptyRange)()));
|
231
231
|
}
|
232
232
|
}
|
233
233
|
}
|
@@ -301,9 +301,9 @@ class PackageTypeVerifier {
|
|
301
301
|
}
|
302
302
|
_getTypeKnownStatusForSymbolTable(report, scopeName, symbolTable, scopeType, publicSymbols, overrideSymbolCallback) {
|
303
303
|
if (this._shouldIgnoreType(report, scopeName)) {
|
304
|
-
return 0 /* Known */;
|
304
|
+
return 0 /* TypeKnownStatus.Known */;
|
305
305
|
}
|
306
|
-
let knownStatus = 0 /* Known */;
|
306
|
+
let knownStatus = 0 /* TypeKnownStatus.Known */;
|
307
307
|
symbolTable.forEach((symbol, name) => {
|
308
308
|
if (!(0, symbolNameUtils_1.isPrivateOrProtectedName)(name) &&
|
309
309
|
!symbol.isExternallyHidden() &&
|
@@ -344,10 +344,10 @@ class PackageTypeVerifier {
|
|
344
344
|
const typedDecls = symbol.getTypedDeclarations();
|
345
345
|
const primaryDecl = typedDecls.length > 0 ? typedDecls[typedDecls.length - 1] : undefined;
|
346
346
|
let symbolInfo;
|
347
|
-
if ((primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 6 /* Class */ && (0, types_1.isInstantiableClass)(symbolType)) {
|
347
|
+
if ((primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 6 /* DeclarationType.Class */ && (0, types_1.isInstantiableClass)(symbolType)) {
|
348
348
|
symbolInfo = this._getSymbolForClass(report, symbolType, publicSymbols);
|
349
349
|
}
|
350
|
-
else if ((primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 8 /* Alias */ && (0, types_1.isModule)(symbolType)) {
|
350
|
+
else if ((primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 8 /* DeclarationType.Alias */ && (0, types_1.isModule)(symbolType)) {
|
351
351
|
symbolInfo = this._getSymbolForModule(report, symbolType, publicSymbols);
|
352
352
|
}
|
353
353
|
else {
|
@@ -360,7 +360,7 @@ class PackageTypeVerifier {
|
|
360
360
|
// If the only reference to this symbol is a "__slots__" entry, we will
|
361
361
|
// skip it when considering type completeness.
|
362
362
|
if (decls.length === 1 &&
|
363
|
-
(primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 1 /* Variable */ &&
|
363
|
+
(primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 1 /* DeclarationType.Variable */ &&
|
364
364
|
primaryDecl.isDefinedBySlots) {
|
365
365
|
return;
|
366
366
|
}
|
@@ -370,7 +370,7 @@ class PackageTypeVerifier {
|
|
370
370
|
fullName,
|
371
371
|
filePath: module.path,
|
372
372
|
isExported,
|
373
|
-
typeKnownStatus: 0 /* Known */,
|
373
|
+
typeKnownStatus: 0 /* TypeKnownStatus.Known */,
|
374
374
|
referenceCount: 1,
|
375
375
|
diagnostics: [],
|
376
376
|
scopeType,
|
@@ -396,7 +396,7 @@ class PackageTypeVerifier {
|
|
396
396
|
}
|
397
397
|
}
|
398
398
|
this._addSymbolError(symbolInfo, `Ambiguous base class override` + extraInfo.getString(), declRange, declPath);
|
399
|
-
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, 1 /* Ambiguous */);
|
399
|
+
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, 1 /* TypeKnownStatus.Ambiguous */);
|
400
400
|
}
|
401
401
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, symbolInfo.typeKnownStatus);
|
402
402
|
}
|
@@ -407,16 +407,16 @@ class PackageTypeVerifier {
|
|
407
407
|
// If not, it adds diagnostics to the symbol information and updates the
|
408
408
|
// typeKnownStatus field.
|
409
409
|
_getSymbolTypeKnownStatus(report, symbolInfo, type, declRange, declFilePath, publicSymbols, skipDocStringCheck = false) {
|
410
|
-
let knownStatus = 0 /* Known */;
|
410
|
+
let knownStatus = 0 /* TypeKnownStatus.Known */;
|
411
411
|
if (type.typeAliasInfo && type.typeAliasInfo.typeArguments) {
|
412
412
|
type.typeAliasInfo.typeArguments.forEach((typeArg, index) => {
|
413
413
|
if ((0, types_1.isUnknown)(typeArg)) {
|
414
414
|
this._addSymbolError(symbolInfo, `Type argument ${index + 1} for type alias "${type.typeAliasInfo.name}" has unknown type`, declRange, declFilePath);
|
415
|
-
knownStatus = 3 /* Unknown */;
|
415
|
+
knownStatus = 3 /* TypeKnownStatus.Unknown */;
|
416
416
|
}
|
417
417
|
else if ((0, typeUtils_1.isPartlyUnknown)(typeArg)) {
|
418
418
|
this._addSymbolError(symbolInfo, `Type argument ${index + 1} for type alias "${type.typeAliasInfo.name}" has partially unknown type`, declRange, declFilePath);
|
419
|
-
knownStatus = 2 /* PartiallyUnknown */;
|
419
|
+
knownStatus = 2 /* TypeKnownStatus.PartiallyUnknown */;
|
420
420
|
}
|
421
421
|
});
|
422
422
|
}
|
@@ -425,44 +425,44 @@ class PackageTypeVerifier {
|
|
425
425
|
ambiguousDiag.addMessage(`Inferred type is "${this._program.printType(type)}"`);
|
426
426
|
this._addSymbolError(symbolInfo, 'Type is missing type annotation and could be inferred differently by type checkers' +
|
427
427
|
ambiguousDiag.getString(), declRange, declFilePath);
|
428
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 1 /* Ambiguous */);
|
428
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 1 /* TypeKnownStatus.Ambiguous */);
|
429
429
|
}
|
430
430
|
switch (type.category) {
|
431
|
-
case 0 /* Unbound */:
|
432
|
-
case 2 /* Any */:
|
433
|
-
case 3 /* Never */:
|
434
|
-
case 9 /* TypeVar */:
|
431
|
+
case 0 /* TypeCategory.Unbound */:
|
432
|
+
case 2 /* TypeCategory.Any */:
|
433
|
+
case 3 /* TypeCategory.Never */:
|
434
|
+
case 9 /* TypeCategory.TypeVar */:
|
435
435
|
break;
|
436
|
-
case 1 /* Unknown */: {
|
436
|
+
case 1 /* TypeCategory.Unknown */: {
|
437
437
|
this._addSymbolError(symbolInfo, `Type unknown for ${PackageTypeVerifier.getSymbolCategoryString(symbolInfo.category)} "${symbolInfo.fullName}"`, declRange, declFilePath);
|
438
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
438
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
439
439
|
break;
|
440
440
|
}
|
441
|
-
case 8 /* Union */: {
|
441
|
+
case 8 /* TypeCategory.Union */: {
|
442
442
|
(0, typeUtils_1.doForEachSubtype)(type, (subtype) => {
|
443
443
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, this._getSymbolTypeKnownStatus(report, symbolInfo, subtype, declRange, declFilePath, publicSymbols));
|
444
444
|
});
|
445
445
|
break;
|
446
446
|
}
|
447
|
-
case 5 /* OverloadedFunction */: {
|
447
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
448
448
|
for (const overload of type.overloads) {
|
449
449
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, this._getSymbolTypeKnownStatus(report, symbolInfo, overload, declRange, declFilePath, publicSymbols));
|
450
450
|
}
|
451
451
|
break;
|
452
452
|
}
|
453
|
-
case 4 /* Function */: {
|
453
|
+
case 4 /* TypeCategory.Function */: {
|
454
454
|
if (!this._shouldIgnoreType(report, type.details.fullName)) {
|
455
455
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, this._getFunctionTypeKnownStatus(report, type, publicSymbols, symbolInfo, declRange, declFilePath, undefined /* diag */, skipDocStringCheck));
|
456
456
|
}
|
457
457
|
break;
|
458
458
|
}
|
459
|
-
case 6 /* Class */: {
|
459
|
+
case 6 /* TypeCategory.Class */: {
|
460
460
|
// Properties require special handling.
|
461
461
|
if (types_1.TypeBase.isInstance(type) && types_1.ClassType.isPropertyClass(type)) {
|
462
462
|
const propMethodInfo = [
|
463
|
-
['fget', (c) => c.
|
464
|
-
['fset', (c) => c.
|
465
|
-
['fdel', (c) => c.
|
463
|
+
['fget', (c) => { var _a; return (_a = c.fgetInfo) === null || _a === void 0 ? void 0 : _a.methodType; }],
|
464
|
+
['fset', (c) => { var _a; return (_a = c.fsetInfo) === null || _a === void 0 ? void 0 : _a.methodType; }],
|
465
|
+
['fdel', (c) => { var _a; return (_a = c.fdelInfo) === null || _a === void 0 ? void 0 : _a.methodType; }],
|
466
466
|
];
|
467
467
|
const propertyClass = type;
|
468
468
|
propMethodInfo.forEach((info) => {
|
@@ -476,7 +476,7 @@ class PackageTypeVerifier {
|
|
476
476
|
// work properly when accessed directly from the property object. We need
|
477
477
|
// to remove this flag here so the method is seen as an instance method rather than
|
478
478
|
// static. Otherwise we'll incorrectly report that "self" is not annotated.
|
479
|
-
accessType = types_1.FunctionType.cloneWithNewFlags(accessType, accessType.details.flags & ~4 /* StaticMethod */);
|
479
|
+
accessType = types_1.FunctionType.cloneWithNewFlags(accessType, accessType.details.flags & ~4 /* FunctionTypeFlags.StaticMethod */);
|
480
480
|
}
|
481
481
|
// Don't require docstrings for setters or deleters.
|
482
482
|
const skipDocStringCheck = methodName !== 'fget';
|
@@ -496,22 +496,22 @@ class PackageTypeVerifier {
|
|
496
496
|
type.typeArguments.forEach((typeArg, index) => {
|
497
497
|
if ((0, types_1.isUnknown)(typeArg)) {
|
498
498
|
this._addSymbolError(symbolInfo, `Type argument ${index + 1} for class "${type.details.name}" has unknown type`, declRange, declFilePath);
|
499
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
499
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
500
500
|
}
|
501
501
|
else if ((0, typeUtils_1.isPartlyUnknown)(typeArg)) {
|
502
502
|
const diag = new diagnostic_1.DiagnosticAddendum();
|
503
503
|
diag.addMessage(`Type is ${this._program.printType(typeArg)}`);
|
504
504
|
this._addSymbolError(symbolInfo, `Type argument ${index + 1} for class "${type.details.name}" has partially unknown type` + diag.getString(), declRange, declFilePath);
|
505
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 2 /* PartiallyUnknown */);
|
505
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 2 /* TypeKnownStatus.PartiallyUnknown */);
|
506
506
|
}
|
507
507
|
});
|
508
508
|
}
|
509
509
|
break;
|
510
510
|
}
|
511
|
-
case 7 /* Module */: {
|
511
|
+
case 7 /* TypeCategory.Module */: {
|
512
512
|
if (!this._shouldIgnoreType(report, type.moduleName)) {
|
513
513
|
const moduleSymbol = this._getSymbolForModule(report, type, publicSymbols);
|
514
|
-
if (moduleSymbol.typeKnownStatus !== 0 /* Known */) {
|
514
|
+
if (moduleSymbol.typeKnownStatus !== 0 /* TypeKnownStatus.Known */) {
|
515
515
|
this._addSymbolError(symbolInfo, `Module "${moduleSymbol.fullName}" is partially unknown`, declRange, declFilePath);
|
516
516
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, moduleSymbol.typeKnownStatus);
|
517
517
|
}
|
@@ -524,7 +524,7 @@ class PackageTypeVerifier {
|
|
524
524
|
return knownStatus;
|
525
525
|
}
|
526
526
|
_getFunctionTypeKnownStatus(report, type, publicSymbols, symbolInfo, declRange, declFilePath, diag, skipDocStringCheck = false) {
|
527
|
-
let knownStatus = 0 /* Known */;
|
527
|
+
let knownStatus = 0 /* TypeKnownStatus.Known */;
|
528
528
|
// If the file path wasn't provided, try to get it from the type.
|
529
529
|
if (type.details.declaration && !declFilePath) {
|
530
530
|
declFilePath = type.details.declaration.path;
|
@@ -536,7 +536,7 @@ class PackageTypeVerifier {
|
|
536
536
|
// Allow params (like "self" and "cls") to skip declarations because
|
537
537
|
// we're able to synthesize these.
|
538
538
|
const isSynthesized = index === 0 &&
|
539
|
-
(symbolInfo === null || symbolInfo === void 0 ? void 0 : symbolInfo.scopeType) === 2 /* Class */ &&
|
539
|
+
(symbolInfo === null || symbolInfo === void 0 ? void 0 : symbolInfo.scopeType) === 2 /* ScopeType.Class */ &&
|
540
540
|
(types_1.FunctionType.isClassMethod(type) ||
|
541
541
|
types_1.FunctionType.isInstanceMethod(type) ||
|
542
542
|
types_1.FunctionType.isConstructorMethod(type));
|
@@ -545,7 +545,7 @@ class PackageTypeVerifier {
|
|
545
545
|
this._addSymbolError(symbolInfo, `Type annotation for parameter "${param.name}" is missing`, declRange !== null && declRange !== void 0 ? declRange : (0, textRange_1.getEmptyRange)(), declFilePath !== null && declFilePath !== void 0 ? declFilePath : '');
|
546
546
|
}
|
547
547
|
diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(`Type annotation for parameter "${param.name}" is missing`);
|
548
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
548
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
549
549
|
}
|
550
550
|
}
|
551
551
|
else if ((0, types_1.isUnknown)(param.type)) {
|
@@ -553,12 +553,12 @@ class PackageTypeVerifier {
|
|
553
553
|
this._addSymbolError(symbolInfo, `Type of parameter "${param.name}" is unknown`, declRange !== null && declRange !== void 0 ? declRange : (0, textRange_1.getEmptyRange)(), declFilePath !== null && declFilePath !== void 0 ? declFilePath : '');
|
554
554
|
diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(`Type of parameter "${param.name}" is unknown`);
|
555
555
|
}
|
556
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
556
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
557
557
|
}
|
558
558
|
else {
|
559
559
|
const extraInfo = new diagnostic_1.DiagnosticAddendum();
|
560
560
|
const paramKnownStatus = this._getTypeKnownStatus(report, param.type, publicSymbols, extraInfo.createAddendum());
|
561
|
-
if (paramKnownStatus !== 0 /* Known */) {
|
561
|
+
if (paramKnownStatus !== 0 /* TypeKnownStatus.Known */) {
|
562
562
|
extraInfo.addMessage(`Parameter type is "${this._program.printType(param.type)}"`);
|
563
563
|
if (symbolInfo) {
|
564
564
|
this._addSymbolError(symbolInfo, `Type of parameter "${param.name}" is partially unknown` + extraInfo.getString(), declRange !== null && declRange !== void 0 ? declRange : (0, textRange_1.getEmptyRange)(), declFilePath !== null && declFilePath !== void 0 ? declFilePath : '');
|
@@ -578,12 +578,12 @@ class PackageTypeVerifier {
|
|
578
578
|
if (symbolInfo) {
|
579
579
|
this._addSymbolError(symbolInfo, `Return type is unknown`, declRange !== null && declRange !== void 0 ? declRange : (0, textRange_1.getEmptyRange)(), declFilePath !== null && declFilePath !== void 0 ? declFilePath : '');
|
580
580
|
}
|
581
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
581
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
582
582
|
}
|
583
583
|
else {
|
584
584
|
const extraInfo = new diagnostic_1.DiagnosticAddendum();
|
585
585
|
const returnTypeKnownStatus = this._getTypeKnownStatus(report, type.details.declaredReturnType, publicSymbols, extraInfo.createAddendum());
|
586
|
-
if (returnTypeKnownStatus !== 0 /* Known */) {
|
586
|
+
if (returnTypeKnownStatus !== 0 /* TypeKnownStatus.Known */) {
|
587
587
|
extraInfo.addMessage(`Return type is "${this._program.printType(type.details.declaredReturnType)}"`);
|
588
588
|
if (symbolInfo) {
|
589
589
|
this._addSymbolError(symbolInfo, `Return type is partially unknown` + extraInfo.getString(), declRange !== null && declRange !== void 0 ? declRange : (0, textRange_1.getEmptyRange)(), declFilePath !== null && declFilePath !== void 0 ? declFilePath : '');
|
@@ -604,7 +604,7 @@ class PackageTypeVerifier {
|
|
604
604
|
this._addSymbolError(symbolInfo, `Return type annotation is missing`, declRange !== null && declRange !== void 0 ? declRange : (0, textRange_1.getEmptyRange)(), declFilePath !== null && declFilePath !== void 0 ? declFilePath : '');
|
605
605
|
}
|
606
606
|
diag === null || diag === void 0 ? void 0 : diag.createAddendum().addMessage(`Return type annotation is missing`);
|
607
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
607
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
608
608
|
}
|
609
609
|
}
|
610
610
|
if (!type.details.docString) {
|
@@ -651,10 +651,10 @@ class PackageTypeVerifier {
|
|
651
651
|
fullName: type.details.fullName,
|
652
652
|
filePath: type.details.filePath,
|
653
653
|
isExported: publicSymbols.has(type.details.fullName),
|
654
|
-
typeKnownStatus: 0 /* Known */,
|
654
|
+
typeKnownStatus: 0 /* TypeKnownStatus.Known */,
|
655
655
|
referenceCount: 1,
|
656
656
|
diagnostics: [],
|
657
|
-
scopeType: 2 /* Class */,
|
657
|
+
scopeType: 2 /* ScopeType.Class */,
|
658
658
|
};
|
659
659
|
this._addSymbol(report, symbolInfo);
|
660
660
|
// Determine whether the class has a proper doc string.
|
@@ -662,7 +662,7 @@ class PackageTypeVerifier {
|
|
662
662
|
this._addSymbolWarning(symbolInfo, `No docstring found for class "${type.details.fullName}"`, (0, textRange_1.getEmptyRange)(), '');
|
663
663
|
report.missingClassDocStringCount++;
|
664
664
|
}
|
665
|
-
const symbolTableTypeKnownStatus = this._getTypeKnownStatusForSymbolTable(report, type.details.fullName, type.details.fields, 2 /* Class */, publicSymbols, (name, symbol) => {
|
665
|
+
const symbolTableTypeKnownStatus = this._getTypeKnownStatusForSymbolTable(report, type.details.fullName, type.details.fields, 2 /* ScopeType.Class */, publicSymbols, (name, symbol) => {
|
666
666
|
// If the symbol within this class is lacking a type declaration,
|
667
667
|
// see if we can find a same-named symbol in a parent class with
|
668
668
|
// a type declaration.
|
@@ -683,12 +683,12 @@ class PackageTypeVerifier {
|
|
683
683
|
if (type.details.effectiveMetaclass) {
|
684
684
|
if (!(0, types_1.isInstantiableClass)(type.details.effectiveMetaclass)) {
|
685
685
|
this._addSymbolError(symbolInfo, `Type of metaclass unknown`, (0, textRange_1.getEmptyRange)(), '');
|
686
|
-
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, 2 /* PartiallyUnknown */);
|
686
|
+
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, 2 /* TypeKnownStatus.PartiallyUnknown */);
|
687
687
|
}
|
688
688
|
else {
|
689
689
|
const diag = new diagnostic_1.DiagnosticAddendum();
|
690
690
|
const metaclassKnownStatus = this._getTypeKnownStatus(report, type.details.effectiveMetaclass, publicSymbols, diag);
|
691
|
-
if (metaclassKnownStatus !== 0 /* Known */) {
|
691
|
+
if (metaclassKnownStatus !== 0 /* TypeKnownStatus.Known */) {
|
692
692
|
this._addSymbolError(symbolInfo, `Type of metaclass "${type.details.effectiveMetaclass}" is partially unknown` +
|
693
693
|
diag.getString(), (0, textRange_1.getEmptyRange)(), '');
|
694
694
|
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, metaclassKnownStatus);
|
@@ -699,7 +699,7 @@ class PackageTypeVerifier {
|
|
699
699
|
type.details.baseClasses.forEach((baseClass) => {
|
700
700
|
if (!(0, types_1.isInstantiableClass)(baseClass)) {
|
701
701
|
this._addSymbolError(symbolInfo, `Type of base class unknown`, (0, textRange_1.getEmptyRange)(), '');
|
702
|
-
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, 2 /* PartiallyUnknown */);
|
702
|
+
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, 2 /* TypeKnownStatus.PartiallyUnknown */);
|
703
703
|
}
|
704
704
|
else {
|
705
705
|
// Handle "tuple" specially. Even though it's a generic class, it
|
@@ -709,7 +709,7 @@ class PackageTypeVerifier {
|
|
709
709
|
}
|
710
710
|
const diag = new diagnostic_1.DiagnosticAddendum();
|
711
711
|
const baseClassTypeStatus = this._getTypeKnownStatus(report, baseClass, publicSymbols, diag);
|
712
|
-
if (baseClassTypeStatus !== 0 /* Known */) {
|
712
|
+
if (baseClassTypeStatus !== 0 /* TypeKnownStatus.Known */) {
|
713
713
|
this._addSymbolError(symbolInfo, `Type of base class "${baseClass.details.fullName}" is partially unknown` + diag.getString(), (0, textRange_1.getEmptyRange)(), '');
|
714
714
|
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, baseClassTypeStatus);
|
715
715
|
}
|
@@ -730,56 +730,56 @@ class PackageTypeVerifier {
|
|
730
730
|
fullName: type.moduleName,
|
731
731
|
filePath: type.filePath,
|
732
732
|
isExported: publicSymbols.has(type.moduleName),
|
733
|
-
typeKnownStatus: 0 /* Known */,
|
733
|
+
typeKnownStatus: 0 /* TypeKnownStatus.Known */,
|
734
734
|
referenceCount: 1,
|
735
735
|
diagnostics: [],
|
736
|
-
scopeType: 3 /* Module */,
|
736
|
+
scopeType: 3 /* ScopeType.Module */,
|
737
737
|
};
|
738
738
|
this._addSymbol(report, symbolInfo);
|
739
|
-
const symbolTableTypeKnownStatus = this._getTypeKnownStatusForSymbolTable(report, type.moduleName, type.fields, 3 /* Module */, publicSymbols);
|
739
|
+
const symbolTableTypeKnownStatus = this._getTypeKnownStatusForSymbolTable(report, type.moduleName, type.fields, 3 /* ScopeType.Module */, publicSymbols);
|
740
740
|
symbolInfo.typeKnownStatus = this._updateKnownStatusIfWorse(symbolInfo.typeKnownStatus, symbolTableTypeKnownStatus);
|
741
741
|
return symbolInfo;
|
742
742
|
}
|
743
743
|
_getTypeKnownStatus(report, type, publicSymbols, diag) {
|
744
|
-
let knownStatus = 0 /* Known */;
|
744
|
+
let knownStatus = 0 /* TypeKnownStatus.Known */;
|
745
745
|
if (type.typeAliasInfo && type.typeAliasInfo.typeArguments) {
|
746
746
|
type.typeAliasInfo.typeArguments.forEach((typeArg, index) => {
|
747
747
|
if ((0, types_1.isUnknown)(typeArg)) {
|
748
748
|
diag.addMessage(`Type argument ${index + 1} for type alias "${type.typeAliasInfo.name}" has unknown type`);
|
749
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
749
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
750
750
|
}
|
751
751
|
else if ((0, typeUtils_1.isPartlyUnknown)(typeArg)) {
|
752
752
|
diag.addMessage(`Type argument ${index + 1} for type alias "${type.typeAliasInfo.name}" has partially unknown type`);
|
753
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 2 /* PartiallyUnknown */);
|
753
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 2 /* TypeKnownStatus.PartiallyUnknown */);
|
754
754
|
}
|
755
755
|
});
|
756
756
|
}
|
757
757
|
if (types_1.TypeBase.isAmbiguous(type)) {
|
758
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 1 /* Ambiguous */);
|
758
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 1 /* TypeKnownStatus.Ambiguous */);
|
759
759
|
}
|
760
760
|
switch (type.category) {
|
761
|
-
case 0 /* Unbound */:
|
762
|
-
case 2 /* Any */:
|
763
|
-
case 3 /* Never */:
|
764
|
-
case 9 /* TypeVar */:
|
761
|
+
case 0 /* TypeCategory.Unbound */:
|
762
|
+
case 2 /* TypeCategory.Any */:
|
763
|
+
case 3 /* TypeCategory.Never */:
|
764
|
+
case 9 /* TypeCategory.TypeVar */:
|
765
765
|
break;
|
766
|
-
case 1 /* Unknown */: {
|
767
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
766
|
+
case 1 /* TypeCategory.Unknown */: {
|
767
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
768
768
|
break;
|
769
769
|
}
|
770
|
-
case 8 /* Union */: {
|
770
|
+
case 8 /* TypeCategory.Union */: {
|
771
771
|
(0, typeUtils_1.doForEachSubtype)(type, (subtype) => {
|
772
772
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, this._getTypeKnownStatus(report, subtype, publicSymbols, diag.createAddendum()));
|
773
773
|
});
|
774
774
|
break;
|
775
775
|
}
|
776
|
-
case 5 /* OverloadedFunction */: {
|
776
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
777
777
|
for (const overload of type.overloads) {
|
778
778
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, this._getTypeKnownStatus(report, overload, publicSymbols, diag.createAddendum()));
|
779
779
|
}
|
780
780
|
break;
|
781
781
|
}
|
782
|
-
case 4 /* Function */: {
|
782
|
+
case 4 /* TypeCategory.Function */: {
|
783
783
|
if (!this._shouldIgnoreType(report, type.details.fullName)) {
|
784
784
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, this._getFunctionTypeKnownStatus(report, type, publicSymbols,
|
785
785
|
/* symbolInfo */ undefined,
|
@@ -788,7 +788,7 @@ class PackageTypeVerifier {
|
|
788
788
|
}
|
789
789
|
break;
|
790
790
|
}
|
791
|
-
case 6 /* Class */: {
|
791
|
+
case 6 /* TypeCategory.Class */: {
|
792
792
|
if (!this._shouldIgnoreType(report, type.details.fullName)) {
|
793
793
|
// Don't bother type-checking built-in types.
|
794
794
|
if (!types_1.ClassType.isBuiltIn(type)) {
|
@@ -801,17 +801,17 @@ class PackageTypeVerifier {
|
|
801
801
|
type.typeArguments.forEach((typeArg, index) => {
|
802
802
|
if ((0, types_1.isUnknown)(typeArg)) {
|
803
803
|
diag.addMessage(`Type argument ${index + 1} for class "${type.details.name}" has unknown type`);
|
804
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* Unknown */);
|
804
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 3 /* TypeKnownStatus.Unknown */);
|
805
805
|
}
|
806
806
|
else if ((0, typeUtils_1.isPartlyUnknown)(typeArg)) {
|
807
807
|
diag.addMessage(`Type argument ${index + 1} for class "${type.details.name}" has partially unknown type`);
|
808
|
-
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 2 /* PartiallyUnknown */);
|
808
|
+
knownStatus = this._updateKnownStatusIfWorse(knownStatus, 2 /* TypeKnownStatus.PartiallyUnknown */);
|
809
809
|
}
|
810
810
|
});
|
811
811
|
}
|
812
812
|
break;
|
813
813
|
}
|
814
|
-
case 7 /* Module */: {
|
814
|
+
case 7 /* TypeCategory.Module */: {
|
815
815
|
if (!this._shouldIgnoreType(report, type.moduleName)) {
|
816
816
|
const moduleSymbol = this._getSymbolForModule(report, type, publicSymbols);
|
817
817
|
knownStatus = this._updateKnownStatusIfWorse(knownStatus, moduleSymbol.typeKnownStatus);
|
@@ -826,38 +826,38 @@ class PackageTypeVerifier {
|
|
826
826
|
return packageTypeReport_1.SymbolCategory.TypeAlias;
|
827
827
|
}
|
828
828
|
switch (type.category) {
|
829
|
-
case 4 /* Function */:
|
830
|
-
case 5 /* OverloadedFunction */: {
|
829
|
+
case 4 /* TypeCategory.Function */:
|
830
|
+
case 5 /* TypeCategory.OverloadedFunction */: {
|
831
831
|
const funcDecl = symbol
|
832
832
|
.getDeclarations()
|
833
|
-
.find((decl) => decl.type === 5 /* Function */);
|
833
|
+
.find((decl) => decl.type === 5 /* DeclarationType.Function */);
|
834
834
|
if (funcDecl && funcDecl.isMethod) {
|
835
835
|
return packageTypeReport_1.SymbolCategory.Method;
|
836
836
|
}
|
837
837
|
return packageTypeReport_1.SymbolCategory.Function;
|
838
838
|
}
|
839
|
-
case 6 /* Class */: {
|
839
|
+
case 6 /* TypeCategory.Class */: {
|
840
840
|
if (types_1.TypeBase.isInstantiable(type)) {
|
841
841
|
return packageTypeReport_1.SymbolCategory.Class;
|
842
842
|
}
|
843
843
|
const varDecl = symbol
|
844
844
|
.getDeclarations()
|
845
|
-
.find((decl) => decl.type === 1 /* Variable */);
|
845
|
+
.find((decl) => decl.type === 1 /* DeclarationType.Variable */);
|
846
846
|
if (varDecl && (varDecl.isConstant || varDecl.isFinal)) {
|
847
847
|
return packageTypeReport_1.SymbolCategory.Constant;
|
848
848
|
}
|
849
849
|
return packageTypeReport_1.SymbolCategory.Variable;
|
850
850
|
}
|
851
|
-
case 7 /* Module */: {
|
851
|
+
case 7 /* TypeCategory.Module */: {
|
852
852
|
return packageTypeReport_1.SymbolCategory.Module;
|
853
853
|
}
|
854
|
-
case 9 /* TypeVar */: {
|
854
|
+
case 9 /* TypeCategory.TypeVar */: {
|
855
855
|
return packageTypeReport_1.SymbolCategory.TypeVar;
|
856
856
|
}
|
857
857
|
default: {
|
858
858
|
const varDecl = symbol
|
859
859
|
.getDeclarations()
|
860
|
-
.find((decl) => decl.type === 1 /* Variable */);
|
860
|
+
.find((decl) => decl.type === 1 /* DeclarationType.Variable */);
|
861
861
|
if (varDecl) {
|
862
862
|
if (varDecl.isConstant || varDecl.isFinal) {
|
863
863
|
return packageTypeReport_1.SymbolCategory.Constant;
|
@@ -890,7 +890,7 @@ class PackageTypeVerifier {
|
|
890
890
|
return undefined;
|
891
891
|
}
|
892
892
|
_isSymbolTypeImplied(scopeType, name) {
|
893
|
-
if (scopeType === 2 /* Class */) {
|
893
|
+
if (scopeType === 2 /* ScopeType.Class */) {
|
894
894
|
const knownClassSymbols = [
|
895
895
|
'__class__',
|
896
896
|
'__dict__',
|
@@ -903,7 +903,7 @@ class PackageTypeVerifier {
|
|
903
903
|
];
|
904
904
|
return knownClassSymbols.some((sym) => sym === name);
|
905
905
|
}
|
906
|
-
else if (scopeType === 3 /* Module */) {
|
906
|
+
else if (scopeType === 3 /* ScopeType.Module */) {
|
907
907
|
const knownModuleSymbols = [
|
908
908
|
'__all__',
|
909
909
|
'__author__',
|
@@ -924,13 +924,13 @@ class PackageTypeVerifier {
|
|
924
924
|
}
|
925
925
|
_addSymbolError(symbolInfo, message, declRange, declFilePath) {
|
926
926
|
symbolInfo.diagnostics.push({
|
927
|
-
diagnostic: new diagnostic_1.Diagnostic(0 /* Error */, message, declRange),
|
927
|
+
diagnostic: new diagnostic_1.Diagnostic(0 /* DiagnosticCategory.Error */, message, declRange),
|
928
928
|
filePath: declFilePath,
|
929
929
|
});
|
930
930
|
}
|
931
931
|
_addSymbolWarning(symbolInfo, message, declRange, declFilePath) {
|
932
932
|
symbolInfo.diagnostics.push({
|
933
|
-
diagnostic: new diagnostic_1.Diagnostic(1 /* Warning */, message, declRange),
|
933
|
+
diagnostic: new diagnostic_1.Diagnostic(1 /* DiagnosticCategory.Warning */, message, declRange),
|
934
934
|
filePath: declFilePath,
|
935
935
|
});
|
936
936
|
}
|