@zzzen/pyright-internal 1.2.0-dev.20240121 → 1.2.0-dev.20240218
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.js +4 -1
- package/dist/analyzer/analysis.js.map +1 -1
- package/dist/analyzer/analyzerFileInfo.js.map +1 -1
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +2 -2
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/cacheManager.js.map +1 -1
- package/dist/analyzer/checker.js +139 -98
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/circularDependency.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.js +29 -3
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowTypes.js.map +1 -1
- package/dist/analyzer/codeFlowUtils.js.map +1 -1
- package/dist/analyzer/commentUtils.js.map +1 -1
- package/dist/analyzer/constraintSolver.d.ts +2 -2
- package/dist/analyzer/constraintSolver.js +28 -6
- 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 +1 -1
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +1 -1
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.js +1 -1
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/deprecatedSymbols.js.map +1 -1
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/docStringUtils.js.map +1 -1
- package/dist/analyzer/enums.d.ts +4 -1
- package/dist/analyzer/enums.js +29 -25
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/functionTransform.js.map +1 -1
- package/dist/analyzer/importResolver.js +1 -1
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.js.map +1 -1
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +4 -4
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +14 -8
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeReport.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parameterUtils.d.ts +1 -0
- package/dist/analyzer/parameterUtils.js +5 -1
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parentDirectoryCache.js.map +1 -1
- package/dist/analyzer/parseTreeCleaner.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -0
- package/dist/analyzer/parseTreeUtils.js +4 -3
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/patternMatching.js +87 -58
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +1 -1
- package/dist/analyzer/program.js +2 -2
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pyTypedUtils.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/regions.js.map +1 -1
- package/dist/analyzer/scope.js.map +1 -1
- package/dist/analyzer/scopeUtils.js.map +1 -1
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceFileInfo.js +1 -1
- package/dist/analyzer/sourceFileInfo.js.map +1 -1
- package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/sourceMapperUtils.js.map +1 -1
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/symbolNameUtils.js.map +1 -1
- package/dist/analyzer/symbolUtils.js.map +1 -1
- package/dist/analyzer/testWalker.js.map +1 -1
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeCacheUtils.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +352 -310
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
- package/dist/analyzer/typeGuards.js +5 -0
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +0 -1
- package/dist/analyzer/typeUtils.js +25 -11
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +2 -2
- package/dist/analyzer/typeVarContext.js +10 -4
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typeWalker.js.map +1 -1
- package/dist/analyzer/typedDicts.js +5 -5
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +7 -3
- package/dist/analyzer/types.js +40 -28
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysis.js.map +1 -1
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/commandResult.js.map +1 -1
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/createTypeStub.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/commands/restartServer.js.map +1 -1
- package/dist/common/cancellationUtils.d.ts +2 -1
- package/dist/common/cancellationUtils.js +17 -4
- package/dist/common/cancellationUtils.js.map +1 -1
- package/dist/common/charCodes.js.map +1 -1
- package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
- package/dist/common/collectionUtils.js.map +1 -1
- package/dist/common/commandLineOptions.js.map +1 -1
- package/dist/common/commandUtils.js.map +1 -1
- package/dist/common/configOptions.d.ts +16 -0
- package/dist/common/configOptions.js +80 -0
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/console.js.map +1 -1
- package/dist/common/core.js.map +1 -1
- package/dist/common/crypto.js.map +1 -1
- package/dist/common/debug.js.map +1 -1
- package/dist/common/deferred.js.map +1 -1
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticRules.d.ts +16 -0
- package/dist/common/diagnosticRules.js +16 -0
- package/dist/common/diagnosticRules.js.map +1 -1
- package/dist/common/diagnosticSink.js.map +1 -1
- package/dist/common/editAction.js.map +1 -1
- package/dist/common/envVarUtils.d.ts +2 -1
- package/dist/common/envVarUtils.js +5 -1
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/extensions.js.map +1 -1
- package/dist/common/fileBasedCancellationUtils.js.map +1 -1
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/fileWatcher.js.map +1 -1
- package/dist/common/fullAccessHost.js +1 -1
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/host.js.map +1 -1
- package/dist/common/logTracker.js.map +1 -1
- package/dist/common/lspUtils.js.map +1 -1
- package/dist/common/memUtils.js.map +1 -1
- package/dist/common/pathConsts.js.map +1 -1
- package/dist/common/pathUtils.js.map +1 -1
- package/dist/common/positionUtils.js.map +1 -1
- package/dist/common/progressReporter.js.map +1 -1
- package/dist/common/pythonVersion.js.map +1 -1
- package/dist/common/realFileSystem.js +1 -1
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/serviceProvider.js.map +1 -1
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/stringUtils.js.map +1 -1
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/textRange.js.map +1 -1
- package/dist/common/textRangeCollection.js.map +1 -1
- package/dist/common/timing.js.map +1 -1
- package/dist/common/uri/baseUri.d.ts +2 -0
- package/dist/common/uri/baseUri.js +7 -7
- package/dist/common/uri/baseUri.js.map +1 -1
- package/dist/common/uri/emptyUri.d.ts +2 -0
- package/dist/common/uri/emptyUri.js +6 -0
- package/dist/common/uri/emptyUri.js.map +1 -1
- package/dist/common/uri/fileUri.d.ts +6 -4
- package/dist/common/uri/fileUri.js +18 -9
- package/dist/common/uri/fileUri.js.map +1 -1
- package/dist/common/uri/memoization.js.map +1 -1
- package/dist/common/uri/uri.d.ts +8 -0
- package/dist/common/uri/uri.js +16 -7
- package/dist/common/uri/uri.js.map +1 -1
- package/dist/common/uri/uriUtils.js.map +1 -1
- package/dist/common/uri/webUri.d.ts +3 -1
- package/dist/common/uri/webUri.js +21 -8
- package/dist/common/uri/webUri.js.map +1 -1
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +9 -1
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentHighlightProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importSorter.js.map +1 -1
- package/dist/languageService/navigationUtils.js.map +1 -1
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/referencesProvider.js +11 -1
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/renameProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +15 -2
- package/dist/localization/localize.js +7 -2
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +15 -7
- package/dist/localization/package.nls.de.json +17 -9
- package/dist/localization/package.nls.en-us.json +7 -2
- package/dist/localization/package.nls.es.json +16 -8
- package/dist/localization/package.nls.fr.json +16 -8
- package/dist/localization/package.nls.it.json +16 -8
- package/dist/localization/package.nls.ja.json +17 -9
- package/dist/localization/package.nls.ko.json +14 -6
- package/dist/localization/package.nls.pl.json +14 -6
- package/dist/localization/package.nls.pt-br.json +17 -9
- package/dist/localization/package.nls.qps-ploc.json +12 -4
- package/dist/localization/package.nls.ru.json +17 -9
- package/dist/localization/package.nls.tr.json +16 -8
- package/dist/localization/package.nls.zh-cn.json +17 -9
- package/dist/localization/package.nls.zh-tw.json +17 -9
- package/dist/nodeMain.js.map +1 -1
- package/dist/nodeServer.js.map +1 -1
- package/dist/parser/characterStream.js.map +1 -1
- package/dist/parser/characters.js.map +1 -1
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/stringTokenUtils.js.map +1 -1
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/tokenizerTypes.js.map +1 -1
- package/dist/parser/unicode.js.map +1 -1
- package/dist/pprof/profiler.js.map +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.d.ts +2 -1
- package/dist/server.js +9 -7
- package/dist/server.js.map +1 -1
- package/dist/tests/cacheManager.test.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/classDeclaration.test.js.map +1 -1
- package/dist/tests/collectionUtils.test.js.map +1 -1
- package/dist/tests/common.test.js.map +1 -1
- package/dist/tests/completions.test.js +23 -0
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/config.test.js +1 -2
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/debug.test.js.map +1 -1
- package/dist/tests/deferred.test.js.map +1 -1
- package/dist/tests/diagnosticOverrides.test.js.map +1 -1
- package/dist/tests/diagnostics.test.js.map +1 -1
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/docStringUtils.test.js.map +1 -1
- package/dist/tests/documentSymbolCollector.test.js.map +1 -1
- package/dist/tests/envVarUtils.test.d.ts +1 -0
- package/dist/tests/envVarUtils.test.js +130 -0
- package/dist/tests/envVarUtils.test.js.map +1 -0
- package/dist/tests/filesystem.test.js.map +1 -1
- package/dist/tests/fourSlashParser.test.js.map +1 -1
- package/dist/tests/fourSlashRunner.test.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.lib.alias.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.comment.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.enums.members.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.excluded.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.fstring.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.importInterimFile.fourslash.disabled.js.map +1 -1
- package/dist/tests/fourslash/completions.importPrivateNoPytyped.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.importPytyped.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.importPytypedLocal.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.included.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.default.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.default.importStub.js.map +1 -1
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.property.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override.stub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.parameters.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.parentFolder.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.property.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.triggers.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.typeAlias.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.typeshed.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.with.fourslash.js.map +1 -1
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -1
- package/dist/tests/fourslash/fourslash.js.map +1 -1
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.async.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.class.docString.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.stringFormat.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.parameter.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.formatted.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.import.django.view.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.import.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inferred.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.overloadedFunction.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.unpackedTypedDict.key.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.multipart.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.wildcard.fourslash.js.map +1 -1
- package/dist/tests/fourslash/importnotresolved.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingModuleSource.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.command.trycatchImport.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js.map +1 -1
- package/dist/tests/fourslash/noerrors.fourslash.js.map +1 -1
- package/dist/tests/fourslash/orderImports1.command.fourslash.js.map +1 -1
- package/dist/tests/fourslash/orderImports2.command.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.function.untitledFile.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.init.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.library.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +1 -1
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.parens.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -1
- package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedFunction.fourslash.js.map +1 -1
- package/dist/tests/fourslash/showcallhierarchy.incomingCalls.aliasedVariable.fourslash.js.map +1 -1
- package/dist/tests/fourslash/showcallhierarchy.incomingCalls.function.fourslash.js.map +1 -1
- package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.aliasedFunction2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/showcallhierarchy.outgoingCalls.function.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -1
- package/dist/tests/fourslash/typeVerifier.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
- package/dist/tests/harness/fourslash/runner.js +1 -1
- package/dist/tests/harness/fourslash/runner.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +0 -13
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
- package/dist/tests/harness/testAccessHost.js.map +1 -1
- package/dist/tests/harness/testHost.js.map +1 -1
- package/dist/tests/harness/utils.js.map +1 -1
- package/dist/tests/harness/vfs/factory.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
- package/dist/tests/hoverProvider.test.js.map +1 -1
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/languageServer.test.d.ts +1 -0
- package/dist/tests/languageServer.test.js +137 -0
- package/dist/tests/languageServer.test.js.map +1 -0
- package/dist/tests/localizer.test.js.map +1 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/lsp/customLsp.d.ts +112 -0
- package/dist/tests/lsp/customLsp.js +67 -0
- package/dist/tests/lsp/customLsp.js.map +1 -0
- package/dist/tests/lsp/languageServer.d.ts +1 -0
- package/dist/tests/lsp/languageServer.js +326 -0
- package/dist/tests/lsp/languageServer.js.map +1 -0
- package/dist/tests/lsp/languageServerTestUtils.d.ts +100 -0
- package/dist/tests/lsp/languageServerTestUtils.js +803 -0
- package/dist/tests/lsp/languageServerTestUtils.js.map +1 -0
- package/dist/tests/lsp/main.d.ts +1 -0
- package/dist/tests/lsp/main.js +12 -0
- package/dist/tests/lsp/main.js.map +1 -0
- package/dist/tests/lsp/webpack.testserver.config.d.ts +4 -0
- package/dist/tests/lsp/webpack.testserver.config.js +64 -0
- package/dist/tests/lsp/webpack.testserver.config.js.map +1 -0
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/positionUtils.test.js.map +1 -1
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/serialization.test.js.map +1 -1
- package/dist/tests/service.test.js.map +1 -1
- package/dist/tests/signatureHelp.test.js.map +1 -1
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/stringUtils.test.js.map +1 -1
- package/dist/tests/symbolNameUtils.test.js.map +1 -1
- package/dist/tests/testState.test.js.map +1 -1
- package/dist/tests/testStateUtils.js.map +1 -1
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/textEditUtil.test.js.map +1 -1
- package/dist/tests/textRange.test.js.map +1 -1
- package/dist/tests/tokenizer.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +12 -8
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +7 -3
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +2 -2
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +2 -2
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +1 -1
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/tests/uri.test.js +74 -26
- package/dist/tests/uri.test.js.map +1 -1
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/tests/zipfs.test.js.map +1 -1
- package/dist/workspaceFactory.js +2 -1
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +20 -12
package/dist/analyzer/checker.js
CHANGED
@@ -494,7 +494,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
494
494
|
visitFor(node) {
|
495
495
|
this._evaluator.evaluateTypesForStatement(node);
|
496
496
|
if (node.typeComment) {
|
497
|
-
this._evaluator.addDiagnosticForTextRange(this._fileInfo, this._fileInfo.diagnosticRuleSet.
|
497
|
+
this._evaluator.addDiagnosticForTextRange(this._fileInfo, this._fileInfo.diagnosticRuleSet.reportInvalidTypeForm, diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.annotationNotSupported(), node.typeComment);
|
498
498
|
}
|
499
499
|
return true;
|
500
500
|
}
|
@@ -534,7 +534,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
534
534
|
this._evaluator.evaluateTypesForStatement(item);
|
535
535
|
});
|
536
536
|
if (node.typeComment) {
|
537
|
-
this._evaluator.addDiagnosticForTextRange(this._fileInfo, this._fileInfo.diagnosticRuleSet.
|
537
|
+
this._evaluator.addDiagnosticForTextRange(this._fileInfo, this._fileInfo.diagnosticRuleSet.reportInvalidTypeForm, diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, localize_1.LocMessage.annotationNotSupported(), node.typeComment);
|
538
538
|
}
|
539
539
|
return true;
|
540
540
|
}
|
@@ -611,7 +611,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
611
611
|
if (returnTypeResult.expectedTypeDiagAddendum) {
|
612
612
|
diagAddendum = returnTypeResult.expectedTypeDiagAddendum;
|
613
613
|
}
|
614
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
614
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportReturnType, localize_1.LocMessage.returnTypeMismatch().format({
|
615
615
|
exprType: this._evaluator.printType(returnType),
|
616
616
|
returnType: this._evaluator.printType(declaredReturnType),
|
617
617
|
}) + diagAddendum.getString(), (_b = node.returnExpression) !== null && _b !== void 0 ? _b : node, (_c = returnTypeResult.expectedTypeDiagAddendum) === null || _c === void 0 ? void 0 : _c.getEffectiveTextRange());
|
@@ -767,11 +767,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
767
767
|
const baseType = this._evaluator.getType(node.baseExpression);
|
768
768
|
if (baseType) {
|
769
769
|
(0, typeUtils_1.doForEachSubtype)(baseType, (subtype) => {
|
770
|
+
const tupleType = (0, typeUtils_1.getSpecializedTupleType)(subtype);
|
770
771
|
if ((0, types_1.isClassInstance)(subtype) &&
|
771
|
-
|
772
|
-
!(0, typeUtils_1.isUnboundedTupleClass)(
|
773
|
-
!this._evaluator.isTypeSubsumedByOtherType(
|
774
|
-
const tupleLength =
|
772
|
+
(tupleType === null || tupleType === void 0 ? void 0 : tupleType.tupleTypeArguments) &&
|
773
|
+
!(0, typeUtils_1.isUnboundedTupleClass)(tupleType) &&
|
774
|
+
!this._evaluator.isTypeSubsumedByOtherType(tupleType, baseType, /* allowAnyToSubsume */ false)) {
|
775
|
+
const tupleLength = tupleType.tupleTypeArguments.length;
|
775
776
|
if (node.items.length === 1 &&
|
776
777
|
!node.trailingComma &&
|
777
778
|
node.items[0].argumentCategory === 0 /* ArgumentCategory.Simple */ &&
|
@@ -1513,7 +1514,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
1513
1514
|
const errorMessage = node.isAsync
|
1514
1515
|
? localize_1.LocMessage.generatorAsyncReturnType()
|
1515
1516
|
: localize_1.LocMessage.generatorSyncReturnType();
|
1516
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
1517
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInvalidTypeForm, errorMessage.format({ yieldType: this._evaluator.printType(types_1.AnyType.create()) }) +
|
1517
1518
|
diagAddendum.getString(), (_a = node.returnTypeAnnotation) !== null && _a !== void 0 ? _a : node.name);
|
1518
1519
|
}
|
1519
1520
|
}
|
@@ -1729,12 +1730,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
1729
1730
|
}
|
1730
1731
|
});
|
1731
1732
|
if (staticMethodCount > 0 && staticMethodCount < functionType.overloads.length) {
|
1732
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
1733
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInconsistentOverload, localize_1.LocMessage.overloadStaticMethodInconsistent().format({
|
1733
1734
|
name: node.name.value,
|
1734
1735
|
}), (_c = (_b = (_a = functionType.overloads[0]) === null || _a === void 0 ? void 0 : _a.details.declaration) === null || _b === void 0 ? void 0 : _b.node.name) !== null && _c !== void 0 ? _c : node.name);
|
1735
1736
|
}
|
1736
1737
|
if (classMethodCount > 0 && classMethodCount < functionType.overloads.length) {
|
1737
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
1738
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInconsistentOverload, localize_1.LocMessage.overloadClassMethodInconsistent().format({
|
1738
1739
|
name: node.name.value,
|
1739
1740
|
}), (_f = (_e = (_d = functionType.overloads[0]) === null || _d === void 0 ? void 0 : _d.details.declaration) === null || _e === void 0 ? void 0 : _e.node.name) !== null && _f !== void 0 ? _f : node.name);
|
1740
1741
|
}
|
@@ -2047,20 +2048,27 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2047
2048
|
: [];
|
2048
2049
|
if (overloadedFunctions.length === 1) {
|
2049
2050
|
// There should never be a single overload.
|
2050
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2051
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInconsistentOverload, localize_1.LocMessage.singleOverload().format({ name }), primaryDecl.node.name);
|
2051
2052
|
}
|
2052
2053
|
// If the file is not a stub and this is the first overload,
|
2053
2054
|
// verify that there is an implementation.
|
2054
2055
|
if (!this._fileInfo.isStubFile && overloadedFunctions.length > 0) {
|
2055
2056
|
let implementationFunction;
|
2056
|
-
|
2057
|
+
let exemptMissingImplementation = false;
|
2058
|
+
if ((0, types_1.isOverloadedFunction)(type)) {
|
2057
2059
|
implementationFunction = types_1.OverloadedFunctionType.getImplementation(type);
|
2060
|
+
// If the implementation has no name, it was synthesized probably by a
|
2061
|
+
// decorator that used a callable with a ParamSpec that captured the
|
2062
|
+
// overloaded signature. We'll exempt it from this check.
|
2063
|
+
const overloads = types_1.OverloadedFunctionType.getOverloads(type);
|
2064
|
+
if (overloads.length > 0 && overloads[0].details.name === '') {
|
2065
|
+
exemptMissingImplementation = true;
|
2066
|
+
}
|
2058
2067
|
}
|
2059
2068
|
else if ((0, types_1.isFunction)(type) && !types_1.FunctionType.isOverloaded(type)) {
|
2060
2069
|
implementationFunction = type;
|
2061
2070
|
}
|
2062
2071
|
if (!implementationFunction) {
|
2063
|
-
let exemptMissingImplementation = false;
|
2064
2072
|
const containingClassNode = ParseTreeUtils.getEnclosingClassOrFunction(primaryDecl.node);
|
2065
2073
|
if (containingClassNode && containingClassNode.nodeType === 10 /* ParseNodeType.Class */) {
|
2066
2074
|
const classType = this._evaluator.getTypeOfClass(containingClassNode);
|
@@ -2079,7 +2087,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2079
2087
|
// If this is a method within a protocol class, don't require that
|
2080
2088
|
// there is an implementation.
|
2081
2089
|
if (!exemptMissingImplementation) {
|
2082
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2090
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportNoOverloadImplementation, localize_1.LocMessage.overloadWithoutImplementation().format({
|
2083
2091
|
name: primaryDecl.node.name.value,
|
2084
2092
|
}), primaryDecl.node.name);
|
2085
2093
|
}
|
@@ -2091,7 +2099,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2091
2099
|
const diag = new diagnostic_1.DiagnosticAddendum();
|
2092
2100
|
if (!this._isLegalOverloadImplementation(overload, implementationFunction, diag)) {
|
2093
2101
|
if (implementationFunction.details.declaration) {
|
2094
|
-
const diagnostic = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2102
|
+
const diagnostic = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInconsistentOverload, localize_1.LocMessage.overloadImplementationMismatch().format({
|
2095
2103
|
name,
|
2096
2104
|
index: index + 1,
|
2097
2105
|
}) + diag.getString(), implementationFunction.details.declaration.node.name);
|
@@ -2171,7 +2179,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2171
2179
|
if (typeAliasDecl && decls.length > 1) {
|
2172
2180
|
decls.forEach((decl) => {
|
2173
2181
|
if (decl !== typeAliasDecl) {
|
2174
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2182
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportRedeclaration, localize_1.LocMessage.typeAliasRedeclared().format({ name }), decl.node);
|
2175
2183
|
}
|
2176
2184
|
});
|
2177
2185
|
}
|
@@ -2279,7 +2287,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2279
2287
|
duplicateIsOk = true;
|
2280
2288
|
}
|
2281
2289
|
if (!duplicateIsOk) {
|
2282
|
-
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2290
|
+
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportRedeclaration, localize_1.LocMessage.obscuredClassDeclaration().format({ name }), otherDecl.node.name);
|
2283
2291
|
addPrimaryDeclInfo(diag);
|
2284
2292
|
}
|
2285
2293
|
}
|
@@ -2312,7 +2320,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2312
2320
|
duplicateIsOk = true;
|
2313
2321
|
}
|
2314
2322
|
if (!duplicateIsOk) {
|
2315
|
-
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2323
|
+
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportRedeclaration, otherDecl.isMethod
|
2316
2324
|
? localize_1.LocMessage.obscuredMethodDeclaration().format({ name })
|
2317
2325
|
: localize_1.LocMessage.obscuredFunctionDeclaration().format({ name }), otherDecl.node.name);
|
2318
2326
|
addPrimaryDeclInfo(diag);
|
@@ -2328,7 +2336,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2328
2336
|
}
|
2329
2337
|
if (!duplicateIsOk) {
|
2330
2338
|
const message = localize_1.LocMessage.obscuredParameterDeclaration();
|
2331
|
-
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2339
|
+
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportRedeclaration, message.format({ name }), otherDecl.node.name);
|
2332
2340
|
addPrimaryDeclInfo(diag);
|
2333
2341
|
}
|
2334
2342
|
}
|
@@ -2349,14 +2357,14 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2349
2357
|
duplicateIsOk = true;
|
2350
2358
|
}
|
2351
2359
|
if (!duplicateIsOk) {
|
2352
|
-
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2360
|
+
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportRedeclaration, localize_1.LocMessage.obscuredVariableDeclaration().format({ name }), otherDecl.node);
|
2353
2361
|
addPrimaryDeclInfo(diag);
|
2354
2362
|
}
|
2355
2363
|
}
|
2356
2364
|
}
|
2357
2365
|
}
|
2358
2366
|
else if (otherDecl.type === 4 /* DeclarationType.TypeAlias */) {
|
2359
|
-
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2367
|
+
const diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportRedeclaration, localize_1.LocMessage.obscuredTypeAliasDeclaration().format({ name }), otherDecl.node.name);
|
2360
2368
|
addPrimaryDeclInfo(diag);
|
2361
2369
|
}
|
2362
2370
|
}
|
@@ -2547,7 +2555,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2547
2555
|
}
|
2548
2556
|
});
|
2549
2557
|
if (!isValidType) {
|
2550
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
2558
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportArgumentType, isInstanceCheck
|
2551
2559
|
? localize_1.LocMessage.isInstanceInvalidType().format({
|
2552
2560
|
type: this._evaluator.printType(arg1Type),
|
2553
2561
|
}) + diag.getString()
|
@@ -2782,7 +2790,15 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2782
2790
|
case 0 /* TypeCategory.Unbound */:
|
2783
2791
|
break;
|
2784
2792
|
case 6 /* TypeCategory.Class */:
|
2785
|
-
if ((
|
2793
|
+
if (types_1.ClassType.isBuiltIn(subtype, 'TypedDict')) {
|
2794
|
+
diag.addMessage(localize_1.LocAddendum.typedDictNotAllowed());
|
2795
|
+
isSupported = false;
|
2796
|
+
}
|
2797
|
+
else if (types_1.ClassType.isBuiltIn(subtype, 'NamedTuple')) {
|
2798
|
+
diag.addMessage(localize_1.LocAddendum.namedTupleNotAllowed());
|
2799
|
+
isSupported = false;
|
2800
|
+
}
|
2801
|
+
else if ((0, typeUtils_1.isNoneInstance)(subtype)) {
|
2786
2802
|
diag.addMessage(localize_1.LocAddendum.noneNotAllowed());
|
2787
2803
|
isSupported = false;
|
2788
2804
|
}
|
@@ -2809,6 +2825,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
2809
2825
|
diag.addMessage(localize_1.LocAddendum.newTypeClassNotAllowed());
|
2810
2826
|
isSupported = false;
|
2811
2827
|
}
|
2828
|
+
else if (subtype.specialForm &&
|
2829
|
+
(0, types_1.isInstantiableClass)(subtype.specialForm) &&
|
2830
|
+
types_1.ClassType.isBuiltIn(subtype.specialForm, 'Annotated')) {
|
2831
|
+
diag.addMessage(localize_1.LocAddendum.annotatedNotAllowed());
|
2832
|
+
isSupported = false;
|
2833
|
+
}
|
2812
2834
|
break;
|
2813
2835
|
case 4 /* TypeCategory.Function */:
|
2814
2836
|
if (!types_1.TypeBase.isInstantiable(subtype) || subtype.isCallableWithTypeArgs) {
|
@@ -3027,10 +3049,12 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
3027
3049
|
const type = this._evaluator.getType(node);
|
3028
3050
|
if (type) {
|
3029
3051
|
if ((0, types_1.isUnbound)(type)) {
|
3030
|
-
this._evaluator.
|
3052
|
+
if (this._evaluator.isNodeReachable(node)) {
|
3053
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportUnboundVariable, localize_1.LocMessage.symbolIsUnbound().format({ name: node.value }), node);
|
3054
|
+
}
|
3031
3055
|
}
|
3032
3056
|
else if ((0, types_1.isPossiblyUnbound)(type)) {
|
3033
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
3057
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportPossiblyUnboundVariable, localize_1.LocMessage.symbolIsPossiblyUnbound().format({ name: node.value }), node);
|
3034
3058
|
}
|
3035
3059
|
}
|
3036
3060
|
}
|
@@ -3324,7 +3348,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
3324
3348
|
if (!ParseTreeUtils.isSuiteEmpty(node.suite) &&
|
3325
3349
|
!types_1.FunctionType.isOverloaded(functionType) &&
|
3326
3350
|
!types_1.FunctionType.isAsync(functionType)) {
|
3327
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
3351
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportReturnType, localize_1.LocMessage.noReturnReturnsNone(), returnAnnotation);
|
3328
3352
|
}
|
3329
3353
|
}
|
3330
3354
|
else if (!types_1.FunctionType.isAbstractMethod(functionType)) {
|
@@ -3337,7 +3361,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
3337
3361
|
// an abstract method or a protocol method and don't require that
|
3338
3362
|
// the return type matches. This check can also be skipped for an overload.
|
3339
3363
|
if (!ParseTreeUtils.isSuiteEmpty(node.suite) && !types_1.FunctionType.isOverloaded(functionType)) {
|
3340
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
3364
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportReturnType, localize_1.LocMessage.returnMissing().format({
|
3341
3365
|
returnType: this._evaluator.printType(declaredReturnType),
|
3342
3366
|
}) + diagAddendum.getString(), returnAnnotation);
|
3343
3367
|
}
|
@@ -3379,15 +3403,27 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
3379
3403
|
_validateFinalMemberOverrides(classType) {
|
3380
3404
|
classType.details.fields.forEach((localSymbol, name) => {
|
3381
3405
|
const parentSymbol = (0, typeUtils_1.lookUpClassMember)(classType, name, 1 /* MemberAccessFlags.SkipOriginalClass */);
|
3382
|
-
if (parentSymbol &&
|
3383
|
-
|
3384
|
-
this._evaluator.isFinalVariable(parentSymbol.symbol)
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3388
|
-
|
3389
|
-
|
3390
|
-
}
|
3406
|
+
if (parentSymbol && (0, types_1.isInstantiableClass)(parentSymbol.classType) && !SymbolNameUtils.isPrivateName(name)) {
|
3407
|
+
// Did the parent class explicitly declare the variable as final?
|
3408
|
+
if (this._evaluator.isFinalVariable(parentSymbol.symbol)) {
|
3409
|
+
const decl = localSymbol.getDeclarations()[0];
|
3410
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.LocMessage.finalRedeclarationBySubclass().format({
|
3411
|
+
name,
|
3412
|
+
className: parentSymbol.classType.details.name,
|
3413
|
+
}), decl.node);
|
3414
|
+
}
|
3415
|
+
else if (types_1.ClassType.isReadOnlyInstanceVariables(parentSymbol.classType) &&
|
3416
|
+
!SymbolNameUtils.isDunderName(name)) {
|
3417
|
+
// If the parent class is a named tuple, all instance variables
|
3418
|
+
// (other than dundered ones) are implicitly final.
|
3419
|
+
const decl = localSymbol.getDeclarations()[0];
|
3420
|
+
if (decl.type === 1 /* DeclarationType.Variable */) {
|
3421
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, localize_1.LocMessage.namedTupleEntryRedeclared().format({
|
3422
|
+
name,
|
3423
|
+
className: parentSymbol.classType.details.name,
|
3424
|
+
}), decl.node);
|
3425
|
+
}
|
3426
|
+
}
|
3391
3427
|
}
|
3392
3428
|
});
|
3393
3429
|
}
|
@@ -3401,8 +3437,20 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
3401
3437
|
const declaredValueType = (0, enums_1.getEnumDeclaredValueType)(this._evaluator, classType, /* declaredTypesOnly */ true);
|
3402
3438
|
// Is there a custom "__new__" and/or "__init__" method? If so, we'll
|
3403
3439
|
// verify that the signature of these calls is compatible with the values.
|
3404
|
-
|
3405
|
-
|
3440
|
+
let newMemberTypeResult = (0, constructors_1.getBoundNewMethod)(this._evaluator, node.name, classType, 4 /* MemberAccessFlags.SkipObjectBaseClass */);
|
3441
|
+
// If this __new__ comes from a built-in class like Enum, we'll ignore it.
|
3442
|
+
if (newMemberTypeResult === null || newMemberTypeResult === void 0 ? void 0 : newMemberTypeResult.classType) {
|
3443
|
+
if ((0, types_1.isClass)(newMemberTypeResult.classType) && types_1.ClassType.isBuiltIn(newMemberTypeResult.classType)) {
|
3444
|
+
newMemberTypeResult = undefined;
|
3445
|
+
}
|
3446
|
+
}
|
3447
|
+
let initMemberTypeResult = (0, constructors_1.getBoundInitMethod)(this._evaluator, node.name, types_1.ClassType.cloneAsInstance(classType), 4 /* MemberAccessFlags.SkipObjectBaseClass */);
|
3448
|
+
// If this __init__ comes from a built-in class like Enum, we'll ignore it.
|
3449
|
+
if (initMemberTypeResult === null || initMemberTypeResult === void 0 ? void 0 : initMemberTypeResult.classType) {
|
3450
|
+
if ((0, types_1.isClass)(initMemberTypeResult.classType) && types_1.ClassType.isBuiltIn(initMemberTypeResult.classType)) {
|
3451
|
+
initMemberTypeResult = undefined;
|
3452
|
+
}
|
3453
|
+
}
|
3406
3454
|
classType.details.fields.forEach((symbol, name) => {
|
3407
3455
|
var _a;
|
3408
3456
|
// Enum members don't have type annotations.
|
@@ -3456,7 +3504,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
3456
3504
|
if (!(0, types_1.isClassInstance)(assignedValueType) ||
|
3457
3505
|
!types_1.ClassType.isSameGenericClass(assignedValueType, classType)) {
|
3458
3506
|
if (!this._evaluator.assignType(declaredValueType, assignedValueType, diag)) {
|
3459
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
3507
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportAssignmentType, localize_1.LocMessage.typeAssignmentMismatch().format(this._evaluator.printSrcDestTypes(assignedValueType, declaredValueType)) + diag.getString(), errorNode);
|
3460
3508
|
}
|
3461
3509
|
}
|
3462
3510
|
}
|
@@ -4061,67 +4109,60 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
4061
4109
|
// This check can be expensive, so don't perform it if the corresponding
|
4062
4110
|
// rule is disabled.
|
4063
4111
|
if (this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride !== 'none') {
|
4064
|
-
|
4065
|
-
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
4070
|
-
const
|
4071
|
-
|
4072
|
-
|
4073
|
-
// so it does not need to be invariant.
|
4074
|
-
if (types_1.ClassType.isFrozenDataClass(overriddenClassAndSymbol.classType) &&
|
4075
|
-
overriddenClassAndSymbol.classType.details.dataClassEntries) {
|
4076
|
-
const dataclassEntry = overriddenClassAndSymbol.classType.details.dataClassEntries.find((entry) => entry.name === memberName);
|
4077
|
-
if (dataclassEntry) {
|
4078
|
-
isInvariant = false;
|
4079
|
-
}
|
4112
|
+
const primaryDecl = (0, symbolUtils_1.getLastTypedDeclaredForSymbol)(overriddenClassAndSymbol.symbol);
|
4113
|
+
let isInvariant = (primaryDecl === null || primaryDecl === void 0 ? void 0 : primaryDecl.type) === 1 /* DeclarationType.Variable */ && !primaryDecl.isFinal;
|
4114
|
+
// If the entry is a member of a frozen dataclass, it is immutable,
|
4115
|
+
// so it does not need to be invariant.
|
4116
|
+
if (types_1.ClassType.isFrozenDataClass(overriddenClassAndSymbol.classType) &&
|
4117
|
+
overriddenClassAndSymbol.classType.details.dataClassEntries) {
|
4118
|
+
const dataclassEntry = overriddenClassAndSymbol.classType.details.dataClassEntries.find((entry) => entry.name === memberName);
|
4119
|
+
if (dataclassEntry) {
|
4120
|
+
isInvariant = false;
|
4080
4121
|
}
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4085
|
-
|
4086
|
-
|
4122
|
+
}
|
4123
|
+
let overriddenTDEntry;
|
4124
|
+
if (overriddenClassAndSymbol.classType.details.typedDictEntries) {
|
4125
|
+
overriddenTDEntry = overriddenClassAndSymbol.classType.details.typedDictEntries.get(memberName);
|
4126
|
+
if (overriddenTDEntry === null || overriddenTDEntry === void 0 ? void 0 : overriddenTDEntry.isReadOnly) {
|
4127
|
+
isInvariant = false;
|
4087
4128
|
}
|
4088
|
-
|
4089
|
-
|
4090
|
-
|
4129
|
+
}
|
4130
|
+
let overrideTDEntry;
|
4131
|
+
if (overrideClassAndSymbol.classType.details.typedDictEntries) {
|
4132
|
+
overrideTDEntry = overrideClassAndSymbol.classType.details.typedDictEntries.get(memberName);
|
4133
|
+
}
|
4134
|
+
if (!this._evaluator.assignType(overriddenType, childOverrideType !== null && childOverrideType !== void 0 ? childOverrideType : overrideType,
|
4135
|
+
/* diag */ undefined,
|
4136
|
+
/* destTypeVarContext */ undefined,
|
4137
|
+
/* srcTypeVarContext */ undefined, isInvariant ? 1 /* AssignTypeFlags.EnforceInvariance */ : 0 /* AssignTypeFlags.Default */)) {
|
4138
|
+
diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, localize_1.LocMessage.baseClassVariableTypeIncompatible().format({
|
4139
|
+
classType: childClassType.details.name,
|
4140
|
+
name: memberName,
|
4141
|
+
}), errorNode);
|
4142
|
+
}
|
4143
|
+
else if (overriddenTDEntry && overrideTDEntry) {
|
4144
|
+
let isRequiredCompatible;
|
4145
|
+
let isReadOnlyCompatible = true;
|
4146
|
+
// If both classes are TypedDicts and they both define this field,
|
4147
|
+
// make sure the attributes are compatible.
|
4148
|
+
if (overriddenTDEntry.isReadOnly) {
|
4149
|
+
isRequiredCompatible = overrideTDEntry.isRequired || !overriddenTDEntry.isRequired;
|
4091
4150
|
}
|
4092
|
-
|
4093
|
-
|
4094
|
-
|
4095
|
-
|
4096
|
-
|
4097
|
-
|
4151
|
+
else {
|
4152
|
+
isReadOnlyCompatible = !overrideTDEntry.isReadOnly;
|
4153
|
+
isRequiredCompatible = overrideTDEntry.isRequired === overriddenTDEntry.isRequired;
|
4154
|
+
}
|
4155
|
+
if (!isRequiredCompatible) {
|
4156
|
+
const message = overrideTDEntry.isRequired
|
4157
|
+
? localize_1.LocMessage.typedDictFieldRequiredRedefinition
|
4158
|
+
: localize_1.LocMessage.typedDictFieldNotRequiredRedefinition;
|
4159
|
+
diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, message().format({ name: memberName }), errorNode);
|
4160
|
+
}
|
4161
|
+
else if (!isReadOnlyCompatible) {
|
4162
|
+
diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, localize_1.LocMessage.typedDictFieldReadOnlyRedefinition().format({
|
4098
4163
|
name: memberName,
|
4099
4164
|
}), errorNode);
|
4100
4165
|
}
|
4101
|
-
else if (overriddenTDEntry && overrideTDEntry) {
|
4102
|
-
let isRequiredCompatible;
|
4103
|
-
let isReadOnlyCompatible = true;
|
4104
|
-
// If both classes are TypedDicts and they both define this field,
|
4105
|
-
// make sure the attributes are compatible.
|
4106
|
-
if (overriddenTDEntry.isReadOnly) {
|
4107
|
-
isRequiredCompatible = overrideTDEntry.isRequired || !overriddenTDEntry.isRequired;
|
4108
|
-
}
|
4109
|
-
else {
|
4110
|
-
isReadOnlyCompatible = !overrideTDEntry.isReadOnly;
|
4111
|
-
isRequiredCompatible = overrideTDEntry.isRequired === overriddenTDEntry.isRequired;
|
4112
|
-
}
|
4113
|
-
if (!isRequiredCompatible) {
|
4114
|
-
const message = overrideTDEntry.isRequired
|
4115
|
-
? localize_1.LocMessage.typedDictFieldRequiredRedefinition
|
4116
|
-
: localize_1.LocMessage.typedDictFieldNotRequiredRedefinition;
|
4117
|
-
diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, message().format({ name: memberName }), errorNode);
|
4118
|
-
}
|
4119
|
-
else if (!isReadOnlyCompatible) {
|
4120
|
-
diag = this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportIncompatibleVariableOverride, localize_1.LocMessage.typedDictFieldReadOnlyRedefinition().format({
|
4121
|
-
name: memberName,
|
4122
|
-
}), errorNode);
|
4123
|
-
}
|
4124
|
-
}
|
4125
4166
|
}
|
4126
4167
|
}
|
4127
4168
|
}
|
@@ -4160,7 +4201,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
4160
4201
|
overloads.forEach((overload) => {
|
4161
4202
|
var _a, _b;
|
4162
4203
|
if (types_1.FunctionType.isFinal(overload) && ((_a = overload.details.declaration) === null || _a === void 0 ? void 0 : _a.node)) {
|
4163
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
4204
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInconsistentOverload, localize_1.LocMessage.overloadFinalInconsistencyImpl().format({
|
4164
4205
|
name: overload.details.name,
|
4165
4206
|
}), (_b = (0, declarationUtils_1.getNameNodeForDeclaration)(overload.details.declaration)) !== null && _b !== void 0 ? _b : overload.details.declaration.node);
|
4166
4207
|
}
|
@@ -4172,7 +4213,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
4172
4213
|
overloads.slice(1).forEach((overload, index) => {
|
4173
4214
|
var _a, _b;
|
4174
4215
|
if (types_1.FunctionType.isFinal(overload) && ((_a = overload.details.declaration) === null || _a === void 0 ? void 0 : _a.node)) {
|
4175
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
4216
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportInconsistentOverload, localize_1.LocMessage.overloadFinalInconsistencyNoImpl().format({
|
4176
4217
|
name: overload.details.name,
|
4177
4218
|
index: index + 2,
|
4178
4219
|
}), (_b = (0, declarationUtils_1.getNameNodeForDeclaration)(overload.details.declaration)) !== null && _b !== void 0 ? _b : overload.details.declaration.node);
|
@@ -4851,7 +4892,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
4851
4892
|
const errorMessage = enclosingFunctionNode.isAsync
|
4852
4893
|
? localize_1.LocMessage.generatorAsyncReturnType()
|
4853
4894
|
: localize_1.LocMessage.generatorSyncReturnType();
|
4854
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
4895
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportReturnType, errorMessage.format({ yieldType: this._evaluator.printType(yieldType) }) +
|
4855
4896
|
((_a = expectedDiagAddendum === null || expectedDiagAddendum === void 0 ? void 0 : expectedDiagAddendum.getString()) !== null && _a !== void 0 ? _a : diagAddendum.getString()), (_b = node.expression) !== null && _b !== void 0 ? _b : node, (_d = (_c = expectedDiagAddendum === null || expectedDiagAddendum === void 0 ? void 0 : expectedDiagAddendum.getEffectiveTextRange()) !== null && _c !== void 0 ? _c : node.expression) !== null && _d !== void 0 ? _d : node);
|
4856
4897
|
}
|
4857
4898
|
}
|
@@ -4918,7 +4959,7 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
|
|
4918
4959
|
});
|
4919
4960
|
// Were all of the exception types overridden?
|
4920
4961
|
if (typesOfThisExcept.length > 0 && typesOfThisExcept.length === overriddenExceptionCount) {
|
4921
|
-
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.
|
4962
|
+
this._evaluator.addDiagnostic(diagnosticRules_1.DiagnosticRule.reportUnusedExcept, localize_1.LocMessage.unreachableExcept() + diagAddendum.getString(), except.typeExpression);
|
4922
4963
|
this._evaluator.addUnreachableCode(except, except.exceptSuite);
|
4923
4964
|
}
|
4924
4965
|
}
|