@zzzen/pyright-internal 1.2.0-dev.20240128 → 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.map +1 -1
- package/dist/analyzer/cacheManager.js.map +1 -1
- package/dist/analyzer/checker.js +115 -74
- 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.map +1 -1
- package/dist/analyzer/constructors.js.map +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.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 -15
- 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.map +1 -1
- package/dist/analyzer/operations.js +6 -0
- 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 +274 -237
- 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 +18 -5
- 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.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.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.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 -1
- package/dist/localization/localize.js +7 -1
- 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 -1
- 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 +9 -5
- 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 +1 -1
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +1 -1
- 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
@@ -494,7 +494,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
494
494
|
(0, types_1.isInstantiableClass)(objectClass) &&
|
495
495
|
typeClassType &&
|
496
496
|
(0, types_1.isInstantiableClass)(typeClassType)) {
|
497
|
-
const anyClass = types_1.ClassType.createInstantiable('Any', 'typing.Any', 'typing', uri_1.Uri.empty(), 1 /* ClassTypeFlags.BuiltInClass */,
|
497
|
+
const anyClass = types_1.ClassType.createInstantiable('Any', 'typing.Any', 'typing', uri_1.Uri.empty(), 1 /* ClassTypeFlags.BuiltInClass */ | 1073741824 /* ClassTypeFlags.SpecialFormClass */,
|
498
498
|
/* typeSourceId */ -1,
|
499
499
|
/* declaredMetaclass */ undefined,
|
500
500
|
/* effectiveMetaclass */ typeClassType);
|
@@ -1002,11 +1002,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1002
1002
|
function stripLiteralValue(type) {
|
1003
1003
|
var _a, _b, _c;
|
1004
1004
|
// Handle the not-uncommon case where the type is a union that consists
|
1005
|
-
// only of literal
|
1005
|
+
// only of literal values.
|
1006
1006
|
if ((0, types_1.isUnion)(type) && type.subtypes.length > 0) {
|
1007
|
-
if (((_a = type.literalStrMap) === null || _a === void 0 ? void 0 : _a.size) === type.subtypes.length ||
|
1008
|
-
((_b = type.literalIntMap) === null || _b === void 0 ? void 0 : _b.size) === type.subtypes.length ||
|
1009
|
-
((_c = type.literalEnumMap) === null || _c === void 0 ? void 0 : _c.size) === type.subtypes.length) {
|
1007
|
+
if (((_a = type.literalInstances.literalStrMap) === null || _a === void 0 ? void 0 : _a.size) === type.subtypes.length ||
|
1008
|
+
((_b = type.literalInstances.literalIntMap) === null || _b === void 0 ? void 0 : _b.size) === type.subtypes.length ||
|
1009
|
+
((_c = type.literalInstances.literalEnumMap) === null || _c === void 0 ? void 0 : _c.size) === type.subtypes.length) {
|
1010
1010
|
return stripLiteralValue(type.subtypes[0]);
|
1011
1011
|
}
|
1012
1012
|
}
|
@@ -1392,7 +1392,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1392
1392
|
// an instance of a class. Limit access to metaclass instance members
|
1393
1393
|
// in this case.
|
1394
1394
|
if (!objectTypeIsInstantiable) {
|
1395
|
-
effectiveFlags |=
|
1395
|
+
effectiveFlags |=
|
1396
|
+
32 /* MemberAccessFlags.SkipClassMembers */ |
|
1397
|
+
512 /* MemberAccessFlags.SkipAttributeAccessOverride */ |
|
1398
|
+
8 /* MemberAccessFlags.SkipTypeBaseClass */;
|
1396
1399
|
effectiveFlags &= ~16 /* MemberAccessFlags.SkipInstanceMembers */;
|
1397
1400
|
}
|
1398
1401
|
const metaclassDiag = diag ? new diagnostic_1.DiagnosticAddendum() : undefined;
|
@@ -1779,8 +1782,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
1779
1782
|
let isValidIterator = true;
|
1780
1783
|
let type = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(typeResult.type);
|
1781
1784
|
type = makeTopLevelTypeVarsConcrete(type);
|
1782
|
-
|
1783
|
-
|
1785
|
+
type = (0, types_1.removeUnbound)(type);
|
1786
|
+
if ((0, typeUtils_1.isOptionalType)(type) && emitNotIterableError) {
|
1787
|
+
if (!typeResult.isIncomplete) {
|
1784
1788
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportOptionalIterable, localize_1.LocMessage.noneNotIterable(), errorNode);
|
1785
1789
|
}
|
1786
1790
|
type = (0, typeUtils_1.removeNoneFromUnion)(type);
|
@@ -2418,15 +2422,16 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2418
2422
|
});
|
2419
2423
|
// Have we accounted for all of the targets and sources? If not, we have a size mismatch.
|
2420
2424
|
if (sourceEntryTypes.length !== targetExpressions.length) {
|
2421
|
-
const expectedEntryCount = unpackIndex >= 0 ? targetExpressions.length - 1 : targetExpressions.length;
|
2422
2425
|
const subDiag = diagAddendum.createAddendum();
|
2423
2426
|
subDiag.addMessage((target.nodeType === 31 /* ParseNodeType.List */
|
2424
2427
|
? localize_1.LocAddendum.listAssignmentMismatch()
|
2425
2428
|
: localize_1.LocAddendum.tupleAssignmentMismatch()).format({
|
2426
2429
|
type: printType(subtype),
|
2427
2430
|
}));
|
2428
|
-
subDiag.createAddendum().addMessage(
|
2429
|
-
|
2431
|
+
subDiag.createAddendum().addMessage((unpackIndex >= 0
|
2432
|
+
? localize_1.LocAddendum.tupleSizeMismatchIndeterminateDest()
|
2433
|
+
: localize_1.LocAddendum.tupleSizeMismatch()).format({
|
2434
|
+
expected: unpackIndex >= 0 ? targetExpressions.length - 1 : targetExpressions.length,
|
2430
2435
|
received: sourceEntryTypes.length,
|
2431
2436
|
}));
|
2432
2437
|
}
|
@@ -2493,11 +2498,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
2493
2498
|
var _a, _b;
|
2494
2499
|
if ((0, types_1.isParamSpec)(subtype)) {
|
2495
2500
|
if (subtype.paramSpecAccess === 'args') {
|
2496
|
-
if (
|
2497
|
-
(
|
2498
|
-
objectType &&
|
2499
|
-
(0, types_1.isClassInstance)(objectType)) {
|
2500
|
-
return types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: objectType, isUnbounded: true }]));
|
2501
|
+
if (objectType && (0, types_1.isClassInstance)(objectType)) {
|
2502
|
+
return makeTupleObject([{ type: objectType, isUnbounded: true }]);
|
2501
2503
|
}
|
2502
2504
|
return types_1.UnknownType.create();
|
2503
2505
|
}
|
@@ -3282,9 +3284,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3282
3284
|
defaultType = (0, typeUtils_1.applySolvedTypeVars)(param, typeVarContext, { unknownIfNotFound: true });
|
3283
3285
|
}
|
3284
3286
|
else if (param.details.isVariadic && tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
|
3285
|
-
defaultType =
|
3286
|
-
|
3287
|
-
]));
|
3287
|
+
defaultType = makeTupleObject([{ type: types_1.UnknownType.create(), isUnbounded: true }],
|
3288
|
+
/* isUnpackedTuple */ true);
|
3288
3289
|
}
|
3289
3290
|
else {
|
3290
3291
|
defaultType = types_1.UnknownType.create();
|
@@ -3904,18 +3905,18 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3904
3905
|
else {
|
3905
3906
|
resultType = subtype;
|
3906
3907
|
}
|
3907
|
-
// If this is a "set" operation, we have a bit more work to do.
|
3908
|
-
if (usage.method
|
3908
|
+
// If this is a "set" or "delete" operation, we have a bit more work to do.
|
3909
|
+
if (usage.method === 'get') {
|
3909
3910
|
return resultType;
|
3910
3911
|
}
|
3911
|
-
// Check for an attempt to overwrite a ClassVar member from an instance.
|
3912
|
+
// Check for an attempt to overwrite or delete a ClassVar member from an instance.
|
3912
3913
|
if (!isDescriptorApplied &&
|
3913
3914
|
(memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.symbol.isClassVar()) &&
|
3914
3915
|
(flags & 128 /* MemberAccessFlags.DisallowClassVarWrites */) !== 0) {
|
3915
3916
|
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.memberSetClassVar().format({ name: memberName }));
|
3916
3917
|
isDescriptorError = true;
|
3917
3918
|
}
|
3918
|
-
// Check for an attempt to overwrite a final member variable.
|
3919
|
+
// Check for an attempt to overwrite or delete a final member variable.
|
3919
3920
|
const finalVarTypeDecl = memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.symbol.getDeclarations().find((decl) => isFinalVariableDeclaration(decl));
|
3920
3921
|
if (finalVarTypeDecl &&
|
3921
3922
|
errorNode &&
|
@@ -3928,7 +3929,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
3928
3929
|
isDescriptorError = true;
|
3929
3930
|
}
|
3930
3931
|
}
|
3931
|
-
// Check for an attempt to overwrite an instance variable that is
|
3932
|
+
// Check for an attempt to overwrite or delete an instance variable that is
|
3932
3933
|
// read-only (e.g. in a named tuple).
|
3933
3934
|
if ((memberInfo === null || memberInfo === void 0 ? void 0 : memberInfo.isInstanceMember) &&
|
3934
3935
|
(0, types_1.isClass)(memberInfo.classType) &&
|
@@ -4444,55 +4445,49 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
4444
4445
|
// param somewhere in the list?
|
4445
4446
|
if (variadicIndex >= 0) {
|
4446
4447
|
const variadicTypeVar = typeParameters[variadicIndex];
|
4447
|
-
if (
|
4448
|
-
|
4449
|
-
|
4450
|
-
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4458
|
-
|
4459
|
-
allowUnpackedTuples: true,
|
4460
|
-
});
|
4448
|
+
if (variadicIndex < typeArgs.length) {
|
4449
|
+
const variadicTypeResults = typeArgs.slice(variadicIndex, variadicIndex + 1 + typeArgs.length - typeParameters.length);
|
4450
|
+
// If the type args consist of a lone variadic type variable, don't wrap it in a tuple.
|
4451
|
+
if (variadicTypeResults.length === 1 && (0, types_1.isVariadicTypeVar)(variadicTypeResults[0].type)) {
|
4452
|
+
validateVariadicTypeVarIsUnpacked(variadicTypeResults[0].type, variadicTypeResults[0].node);
|
4453
|
+
}
|
4454
|
+
else {
|
4455
|
+
variadicTypeResults.forEach((arg, index) => {
|
4456
|
+
validateTypeArg(arg, {
|
4457
|
+
allowEmptyTuple: index === 0,
|
4458
|
+
allowVariadicTypeVar: true,
|
4459
|
+
allowUnpackedTuples: true,
|
4461
4460
|
});
|
4462
|
-
const variadicTypes = [];
|
4463
|
-
if (variadicTypeResults.length !== 1 || !variadicTypeResults[0].isEmptyTupleShorthand) {
|
4464
|
-
variadicTypeResults.forEach((typeResult) => {
|
4465
|
-
if ((0, types_1.isUnpackedClass)(typeResult.type) && typeResult.type.tupleTypeArguments) {
|
4466
|
-
(0, collectionUtils_1.appendArray)(variadicTypes, typeResult.type.tupleTypeArguments);
|
4467
|
-
}
|
4468
|
-
else {
|
4469
|
-
variadicTypes.push({
|
4470
|
-
type: (0, typeUtils_1.convertToInstance)(typeResult.type),
|
4471
|
-
isUnbounded: false,
|
4472
|
-
});
|
4473
|
-
}
|
4474
|
-
});
|
4475
|
-
}
|
4476
|
-
const tupleObject = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, variadicTypes,
|
4477
|
-
/* isTypeArgumentExplicit */ true,
|
4478
|
-
/* isUnpackedTuple */ true));
|
4479
|
-
typeArgs = [
|
4480
|
-
...typeArgs.slice(0, variadicIndex),
|
4481
|
-
{ node: typeArgs[variadicIndex].node, type: tupleObject },
|
4482
|
-
...typeArgs.slice(variadicIndex + 1 + typeArgs.length - typeParameters.length, typeArgs.length),
|
4483
|
-
];
|
4484
|
-
}
|
4485
|
-
}
|
4486
|
-
else if (!variadicTypeVar.details.defaultType) {
|
4487
|
-
// Add an empty tuple that maps to the TypeVarTuple type parameter.
|
4488
|
-
typeArgs.push({
|
4489
|
-
node: errorNode,
|
4490
|
-
type: (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, [],
|
4491
|
-
/* isTypeArgumentExplicit */ true,
|
4492
|
-
/* isUnpackedTuple */ true)),
|
4493
4461
|
});
|
4462
|
+
const variadicTypes = [];
|
4463
|
+
if (variadicTypeResults.length !== 1 || !variadicTypeResults[0].isEmptyTupleShorthand) {
|
4464
|
+
variadicTypeResults.forEach((typeResult) => {
|
4465
|
+
if ((0, types_1.isUnpackedClass)(typeResult.type) && typeResult.type.tupleTypeArguments) {
|
4466
|
+
(0, collectionUtils_1.appendArray)(variadicTypes, typeResult.type.tupleTypeArguments);
|
4467
|
+
}
|
4468
|
+
else {
|
4469
|
+
variadicTypes.push({
|
4470
|
+
type: (0, typeUtils_1.convertToInstance)(typeResult.type),
|
4471
|
+
isUnbounded: false,
|
4472
|
+
});
|
4473
|
+
}
|
4474
|
+
});
|
4475
|
+
}
|
4476
|
+
const tupleObject = makeTupleObject(variadicTypes, /* isUnpackedTuple */ true);
|
4477
|
+
typeArgs = [
|
4478
|
+
...typeArgs.slice(0, variadicIndex),
|
4479
|
+
{ node: typeArgs[variadicIndex].node, type: tupleObject },
|
4480
|
+
...typeArgs.slice(variadicIndex + 1 + typeArgs.length - typeParameters.length, typeArgs.length),
|
4481
|
+
];
|
4494
4482
|
}
|
4495
4483
|
}
|
4484
|
+
else if (!variadicTypeVar.details.defaultType) {
|
4485
|
+
// Add an empty tuple that maps to the TypeVarTuple type parameter.
|
4486
|
+
typeArgs.push({
|
4487
|
+
node: errorNode,
|
4488
|
+
type: makeTupleObject([], /* isUnpackedTuple */ true),
|
4489
|
+
});
|
4490
|
+
}
|
4496
4491
|
}
|
4497
4492
|
return typeArgs;
|
4498
4493
|
}
|
@@ -4936,11 +4931,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
4936
4931
|
}
|
4937
4932
|
});
|
4938
4933
|
}
|
4939
|
-
function makeTupleObject(
|
4934
|
+
function makeTupleObject(typeArgs, isUnpackedTuple = false) {
|
4940
4935
|
if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
|
4941
|
-
return (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType,
|
4942
|
-
return { type: t, isUnbounded: isUnspecifiedLength };
|
4943
|
-
})));
|
4936
|
+
return (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, typeArgs, /* isTypeArgumentExplicit */ true, isUnpackedTuple));
|
4944
4937
|
}
|
4945
4938
|
return types_1.UnknownType.create();
|
4946
4939
|
}
|
@@ -5032,17 +5025,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5032
5025
|
}
|
5033
5026
|
else if (positionalArgs.length === 0 && unpackedListArgs.length === 0) {
|
5034
5027
|
// Handle the case where there are no positionals provided but there are keywords.
|
5035
|
-
positionalIndexType =
|
5036
|
-
tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)
|
5037
|
-
? (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, []))
|
5038
|
-
: types_1.UnknownType.create();
|
5028
|
+
positionalIndexType = makeTupleObject([]);
|
5039
5029
|
}
|
5040
5030
|
else {
|
5041
5031
|
// Package up all of the positionals into a tuple.
|
5042
|
-
const
|
5032
|
+
const tupleTypeArgs = [];
|
5043
5033
|
positionalArgs.forEach((arg) => {
|
5044
5034
|
const typeResult = getTypeOfExpression(arg.valueExpression);
|
5045
|
-
|
5035
|
+
tupleTypeArgs.push({ type: typeResult.type, isUnbounded: false });
|
5046
5036
|
if (typeResult.isIncomplete) {
|
5047
5037
|
isPositionalIndexTypeIncomplete = true;
|
5048
5038
|
}
|
@@ -5054,9 +5044,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5054
5044
|
isPositionalIndexTypeIncomplete = true;
|
5055
5045
|
}
|
5056
5046
|
const iterableType = (_b = (_a = getTypeOfIterator(typeResult, /* isAsync */ false, arg.valueExpression)) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : types_1.UnknownType.create();
|
5057
|
-
|
5047
|
+
tupleTypeArgs.push({ type: iterableType, isUnbounded: true });
|
5058
5048
|
});
|
5059
|
-
positionalIndexType = makeTupleObject(
|
5049
|
+
positionalIndexType = makeTupleObject(tupleTypeArgs);
|
5060
5050
|
}
|
5061
5051
|
let argList = [
|
5062
5052
|
{
|
@@ -5101,7 +5091,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5101
5091
|
// which type to use.
|
5102
5092
|
if (keywordArgs.length === 0 && unpackedDictArgs.length === 0 && positionalArgs.length === 1) {
|
5103
5093
|
useSpeculativeMode(node, () => {
|
5104
|
-
callResult = validateCallArguments(node, argList, { type: itemMethodType }
|
5094
|
+
callResult = validateCallArguments(node, argList, { type: itemMethodType },
|
5095
|
+
/* typeVarContext */ undefined,
|
5096
|
+
/* skipUnknownArgCheck */ true);
|
5105
5097
|
if (callResult.argumentErrors) {
|
5106
5098
|
// If the object supports "__index__" magic method, convert
|
5107
5099
|
// the index to an int and try again.
|
@@ -5124,7 +5116,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5124
5116
|
}
|
5125
5117
|
});
|
5126
5118
|
}
|
5127
|
-
callResult = validateCallArguments(node, argList, { type: itemMethodType }
|
5119
|
+
callResult = validateCallArguments(node, argList, { type: itemMethodType },
|
5120
|
+
/* typeVarContext */ undefined,
|
5121
|
+
/* skipUnknownArgCheck */ true);
|
5128
5122
|
return {
|
5129
5123
|
type: (_d = callResult.returnType) !== null && _d !== void 0 ? _d : types_1.UnknownType.create(),
|
5130
5124
|
isIncomplete: !!callResult.isTypeIncomplete,
|
@@ -5144,7 +5138,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5144
5138
|
return undefined;
|
5145
5139
|
}
|
5146
5140
|
const slicedTypeArgs = tupleTypeArgs.slice(startValue, endValue);
|
5147
|
-
return
|
5141
|
+
return makeTupleObject(slicedTypeArgs);
|
5148
5142
|
}
|
5149
5143
|
function getTupleSliceParameter(expression, defaultValue, tupleTypeArgs) {
|
5150
5144
|
let value = defaultValue;
|
@@ -5412,8 +5406,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5412
5406
|
const entryTypeResults = node.expressions.map((expr, index) => getTypeOfExpression(expr,
|
5413
5407
|
/* flags */ undefined, (0, typeUtils_1.makeInferenceContext)(index < expectedTypes.length ? expectedTypes[index] : undefined, inferenceContext.isTypeIncomplete, inferenceContext.signatureTracker)));
|
5414
5408
|
const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
|
5415
|
-
const type = (
|
5416
|
-
/* isTypeArgumentExplicit */ true));
|
5409
|
+
const type = makeTupleObject(buildTupleTypesList(entryTypeResults));
|
5417
5410
|
// Copy any expected type diag addenda for precision error reporting.
|
5418
5411
|
let expectedTypeDiagAddendum;
|
5419
5412
|
if (entryTypeResults.some((result) => result.expectedTypeDiagAddendum)) {
|
@@ -5429,10 +5422,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5429
5422
|
function getTypeOfTupleInferred(node) {
|
5430
5423
|
const entryTypeResults = node.expressions.map((expr) => getTypeOfExpression(expr));
|
5431
5424
|
const isIncomplete = entryTypeResults.some((result) => result.isIncomplete);
|
5432
|
-
|
5433
|
-
return { type: types_1.UnknownType.create() };
|
5434
|
-
}
|
5435
|
-
const type = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, buildTupleTypesList(entryTypeResults)));
|
5425
|
+
const type = makeTupleObject(buildTupleTypesList(entryTypeResults));
|
5436
5426
|
if (isIncomplete) {
|
5437
5427
|
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
5438
5428
|
return { type: types_1.UnknownType.create() };
|
@@ -5889,10 +5879,12 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5889
5879
|
// If the bind-to type is a protocol, don't use the effective target class.
|
5890
5880
|
// This pattern is used for mixins, where the mixin type is a protocol class
|
5891
5881
|
// that is used to decorate the "self" or "cls" parameter.
|
5882
|
+
let isProtocolClass = false;
|
5892
5883
|
if (bindToType &&
|
5893
5884
|
types_1.ClassType.isProtocolClass(bindToType) &&
|
5894
5885
|
effectiveTargetClass &&
|
5895
5886
|
!types_1.ClassType.isSameGenericClass(bindToType, effectiveTargetClass)) {
|
5887
|
+
isProtocolClass = true;
|
5896
5888
|
effectiveTargetClass = undefined;
|
5897
5889
|
}
|
5898
5890
|
const lookupResults = bindToType
|
@@ -5901,6 +5893,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
5901
5893
|
let resultType;
|
5902
5894
|
if (lookupResults && (0, types_1.isInstantiableClass)(lookupResults.classType)) {
|
5903
5895
|
resultType = lookupResults.classType;
|
5896
|
+
if (isProtocolClass) {
|
5897
|
+
// If the bindToType is a protocol class, set the "include subclasses" flag
|
5898
|
+
// so we don't enforce that called methods are implemented within the protocol.
|
5899
|
+
resultType = types_1.ClassType.cloneIncludeSubclasses(resultType);
|
5900
|
+
}
|
5904
5901
|
}
|
5905
5902
|
else if (effectiveTargetClass &&
|
5906
5903
|
!(0, types_1.isAnyOrUnknown)(effectiveTargetClass) &&
|
@@ -6416,7 +6413,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
6416
6413
|
if (callTypeResult.type.specialForm) {
|
6417
6414
|
const exprNode = errorNode.nodeType === 9 /* ParseNodeType.Call */ ? errorNode.leftExpression : errorNode;
|
6418
6415
|
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.objectNotCallable().format({
|
6419
|
-
type: printType(callTypeResult.type, { expandTypeAlias: true }),
|
6416
|
+
type: printType(callTypeResult.type.specialForm, { expandTypeAlias: true }),
|
6420
6417
|
}), exprNode);
|
6421
6418
|
return { returnType: types_1.UnknownType.create(), argumentErrors: true, overloadsUsedForCall };
|
6422
6419
|
}
|
@@ -6906,7 +6903,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
6906
6903
|
argumentCategory: 1 /* ArgumentCategory.UnpackedList */,
|
6907
6904
|
valueExpression: undefined,
|
6908
6905
|
typeResult: {
|
6909
|
-
type: (
|
6906
|
+
type: makeTupleObject([tupleTypeArg]),
|
6910
6907
|
},
|
6911
6908
|
});
|
6912
6909
|
}
|
@@ -6934,7 +6931,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
6934
6931
|
// validation is left to the caller.
|
6935
6932
|
// This logic is based on PEP 3102: https://www.python.org/dev/peps/pep-3102/
|
6936
6933
|
function matchFunctionArgumentsToParameters(errorNode, argList, typeResult, overloadIndex) {
|
6937
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
6934
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
6938
6935
|
const paramDetails = (0, parameterUtils_1.getParameterListDetails)(typeResult.type);
|
6939
6936
|
let argIndex = 0;
|
6940
6937
|
let matchedUnpackedListOfUnknownLength = false;
|
@@ -7162,10 +7159,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7162
7159
|
listElementType = undefined;
|
7163
7160
|
}
|
7164
7161
|
else {
|
7165
|
-
listElementType =
|
7166
|
-
|
7167
|
-
|
7168
|
-
/* emitNotIterableError */ false)) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : types_1.UnknownType.create();
|
7162
|
+
listElementType = (_d = getTypeOfIterator({ type: argType, isIncomplete: argTypeResult.isIncomplete },
|
7163
|
+
/* isAsync */ false, errorNode,
|
7164
|
+
/* emitNotIterableError */ false)) === null || _d === void 0 ? void 0 : _d.type;
|
7169
7165
|
if (paramDetails.params[paramIndex].param.category !== 1 /* ParameterCategory.ArgsList */) {
|
7170
7166
|
matchedUnpackedListOfUnknownLength = true;
|
7171
7167
|
}
|
@@ -7175,8 +7171,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7175
7171
|
argumentCategory: 0 /* ArgumentCategory.Simple */,
|
7176
7172
|
typeResult: { type: listElementType, isIncomplete: argTypeResult.isIncomplete },
|
7177
7173
|
}
|
7178
|
-
:
|
7179
|
-
if (
|
7174
|
+
: { ...argList[argIndex] };
|
7175
|
+
if (argTypeResult.isIncomplete) {
|
7180
7176
|
isTypeIncomplete = true;
|
7181
7177
|
}
|
7182
7178
|
// It's not allowed to use unpacked arguments with a variadic *args
|
@@ -7197,7 +7193,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7197
7193
|
paramType,
|
7198
7194
|
requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
|
7199
7195
|
argument: funcArg,
|
7200
|
-
errorNode: (
|
7196
|
+
errorNode: (_e = argList[argIndex].valueExpression) !== null && _e !== void 0 ? _e : errorNode,
|
7201
7197
|
paramName,
|
7202
7198
|
isParamNameSynthesized: paramDetails.params[paramIndex].param.isNameSynthesized,
|
7203
7199
|
mapsToVarArgList: isParamVariadic && remainingArgCount > remainingParamCount,
|
@@ -7501,7 +7497,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7501
7497
|
paramType,
|
7502
7498
|
requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
|
7503
7499
|
argument: argList[argIndex],
|
7504
|
-
errorNode: (
|
7500
|
+
errorNode: (_f = argList[argIndex].valueExpression) !== null && _f !== void 0 ? _f : errorNode,
|
7505
7501
|
paramName: paramNameValue,
|
7506
7502
|
});
|
7507
7503
|
trySetActive(argList[argIndex], paramDetails.params[paramInfoIndex].param);
|
@@ -7517,7 +7513,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7517
7513
|
paramType,
|
7518
7514
|
requiresTypeVarMatching: (0, typeUtils_1.requiresSpecialization)(paramType),
|
7519
7515
|
argument: argList[argIndex],
|
7520
|
-
errorNode: (
|
7516
|
+
errorNode: (_g = argList[argIndex].valueExpression) !== null && _g !== void 0 ? _g : errorNode,
|
7521
7517
|
paramName: paramNameValue,
|
7522
7518
|
});
|
7523
7519
|
// Remember that this parameter has already received a value.
|
@@ -7567,7 +7563,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7567
7563
|
requiresTypeVarMatching: false,
|
7568
7564
|
argument: argList[argIndex],
|
7569
7565
|
argType: (0, types_1.isParamSpec)(argType) ? undefined : types_1.AnyType.create(),
|
7570
|
-
errorNode: (
|
7566
|
+
errorNode: (_h = argList[argIndex].valueExpression) !== null && _h !== void 0 ? _h : errorNode,
|
7571
7567
|
});
|
7572
7568
|
}
|
7573
7569
|
}
|
@@ -7675,61 +7671,57 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
7675
7671
|
const paramType = paramDetails.params[paramDetails.argsIndex].type;
|
7676
7672
|
const variadicArgs = validateArgTypeParams.filter((argParam) => argParam.mapsToVarArgList);
|
7677
7673
|
if ((0, types_1.isVariadicTypeVar)(paramType) && !paramType.isVariadicInUnion) {
|
7678
|
-
|
7679
|
-
|
7680
|
-
|
7681
|
-
|
7682
|
-
|
7683
|
-
(
|
7684
|
-
|
7685
|
-
|
7686
|
-
|
7687
|
-
|
7688
|
-
|
7689
|
-
|
7690
|
-
|
7691
|
-
|
7692
|
-
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeVarTupleMustBeUnpacked(), (_a = argParam.argument.valueExpression) !== null && _a !== void 0 ? _a : errorNode);
|
7693
|
-
}
|
7694
|
-
reportedArgError = true;
|
7674
|
+
const tupleTypeArgs = variadicArgs.map((argParam) => {
|
7675
|
+
var _a;
|
7676
|
+
const argType = getTypeOfArgument(argParam.argument).type;
|
7677
|
+
const containsVariadicTypeVar = (0, types_1.isUnpackedVariadicTypeVar)(argType) ||
|
7678
|
+
((0, types_1.isClassInstance)(argType) &&
|
7679
|
+
(0, typeUtils_1.isTupleClass)(argType) &&
|
7680
|
+
argType.tupleTypeArguments &&
|
7681
|
+
argType.tupleTypeArguments.length === 1 &&
|
7682
|
+
(0, types_1.isUnpackedVariadicTypeVar)(argType.tupleTypeArguments[0].type));
|
7683
|
+
if (containsVariadicTypeVar &&
|
7684
|
+
argParam.argument.argumentCategory !== 1 /* ArgumentCategory.UnpackedList */ &&
|
7685
|
+
!argParam.mapsToVarArgList) {
|
7686
|
+
if (!isDiagnosticSuppressedForNode(errorNode) && !isTypeIncomplete) {
|
7687
|
+
addDiagnostic(diagnosticRules_1.DiagnosticRule.reportCallIssue, localize_1.LocMessage.typeVarTupleMustBeUnpacked(), (_a = argParam.argument.valueExpression) !== null && _a !== void 0 ? _a : errorNode);
|
7695
7688
|
}
|
7696
|
-
|
7697
|
-
type: argType,
|
7698
|
-
isUnbounded: argParam.argument.argumentCategory === 1 /* ArgumentCategory.UnpackedList */,
|
7699
|
-
};
|
7700
|
-
});
|
7701
|
-
let specializedTuple;
|
7702
|
-
if (tupleTypeArgs.length === 1 &&
|
7703
|
-
!tupleTypeArgs[0].isUnbounded &&
|
7704
|
-
((0, types_1.isUnpackedClass)(tupleTypeArgs[0].type) || (0, types_1.isVariadicTypeVar)(tupleTypeArgs[0].type))) {
|
7705
|
-
// If there is a single unpacked tuple or unpacked variadic type variable
|
7706
|
-
// (including an unpacked TypeVarTuple union) within this tuple,
|
7707
|
-
// simplify the type.
|
7708
|
-
specializedTuple = tupleTypeArgs[0].type;
|
7709
|
-
}
|
7710
|
-
else {
|
7711
|
-
specializedTuple = types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, tupleTypeArgs,
|
7712
|
-
/* isTypeArgumentExplicit */ true,
|
7713
|
-
/* isUnpackedTuple */ true));
|
7689
|
+
reportedArgError = true;
|
7714
7690
|
}
|
7715
|
-
|
7716
|
-
|
7717
|
-
|
7718
|
-
requiresTypeVarMatching: true,
|
7719
|
-
argument: {
|
7720
|
-
argumentCategory: 0 /* ArgumentCategory.Simple */,
|
7721
|
-
typeResult: { type: specializedTuple },
|
7722
|
-
},
|
7723
|
-
errorNode,
|
7724
|
-
paramName: paramDetails.params[paramDetails.argsIndex].param.name,
|
7725
|
-
isParamNameSynthesized: paramDetails.params[paramDetails.argsIndex].param.isNameSynthesized,
|
7726
|
-
mapsToVarArgList: true,
|
7691
|
+
return {
|
7692
|
+
type: argType,
|
7693
|
+
isUnbounded: argParam.argument.argumentCategory === 1 /* ArgumentCategory.UnpackedList */,
|
7727
7694
|
};
|
7728
|
-
|
7729
|
-
|
7730
|
-
|
7731
|
-
]
|
7695
|
+
});
|
7696
|
+
let specializedTuple;
|
7697
|
+
if (tupleTypeArgs.length === 1 &&
|
7698
|
+
!tupleTypeArgs[0].isUnbounded &&
|
7699
|
+
((0, types_1.isUnpackedClass)(tupleTypeArgs[0].type) || (0, types_1.isVariadicTypeVar)(tupleTypeArgs[0].type))) {
|
7700
|
+
// If there is a single unpacked tuple or unpacked variadic type variable
|
7701
|
+
// (including an unpacked TypeVarTuple union) within this tuple,
|
7702
|
+
// simplify the type.
|
7703
|
+
specializedTuple = tupleTypeArgs[0].type;
|
7732
7704
|
}
|
7705
|
+
else {
|
7706
|
+
specializedTuple = makeTupleObject(tupleTypeArgs, /* isUnpackedTuple */ true);
|
7707
|
+
}
|
7708
|
+
const combinedArg = {
|
7709
|
+
paramCategory: 1 /* ParameterCategory.ArgsList */,
|
7710
|
+
paramType,
|
7711
|
+
requiresTypeVarMatching: true,
|
7712
|
+
argument: {
|
7713
|
+
argumentCategory: 0 /* ArgumentCategory.Simple */,
|
7714
|
+
typeResult: { type: specializedTuple },
|
7715
|
+
},
|
7716
|
+
errorNode,
|
7717
|
+
paramName: paramDetails.params[paramDetails.argsIndex].param.name,
|
7718
|
+
isParamNameSynthesized: paramDetails.params[paramDetails.argsIndex].param.isNameSynthesized,
|
7719
|
+
mapsToVarArgList: true,
|
7720
|
+
};
|
7721
|
+
validateArgTypeParams = [
|
7722
|
+
...validateArgTypeParams.filter((argParam) => !argParam.mapsToVarArgList),
|
7723
|
+
combinedArg,
|
7724
|
+
];
|
7733
7725
|
}
|
7734
7726
|
}
|
7735
7727
|
}
|
@@ -8067,7 +8059,6 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8067
8059
|
let specializedReturnType = (0, typeUtils_1.applySolvedTypeVars)(returnType, typeVarContext, {
|
8068
8060
|
unknownIfNotFound,
|
8069
8061
|
unknownExemptTypeVars: getUnknownExemptTypeVarsForReturnType(type, returnType),
|
8070
|
-
useUnknownOverDefault: skipUnknownArgCheck,
|
8071
8062
|
eliminateUnsolvedInUnions,
|
8072
8063
|
applyInScopePlaceholders: true,
|
8073
8064
|
});
|
@@ -8913,7 +8904,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
8913
8904
|
typeParamsExpr.expressions.map((expr) => {
|
8914
8905
|
let entryType = getTypeOfExpression(expr, 128 /* EvaluatorFlags.ExpectingInstantiableType */ | 4096 /* EvaluatorFlags.AllowTypeVarsWithoutScopeId */).type;
|
8915
8906
|
if ((0, types_1.isTypeVar)(entryType)) {
|
8916
|
-
if (entryType.scopeId) {
|
8907
|
+
if (entryType.scopeId || entryType.isVariadicUnpacked) {
|
8917
8908
|
isTypeParamListValid = false;
|
8918
8909
|
}
|
8919
8910
|
else {
|
@@ -10048,7 +10039,10 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
10048
10039
|
if (!expectedValueOrElementType || !(0, typeUtils_1.containsLiteralType)(expectedValueOrElementType)) {
|
10049
10040
|
valueType = stripLiteralValue(valueType);
|
10050
10041
|
}
|
10051
|
-
type = makeTupleObject([
|
10042
|
+
type = makeTupleObject([
|
10043
|
+
{ type: keyType, isUnbounded: false },
|
10044
|
+
{ type: valueType, isUnbounded: false },
|
10045
|
+
]);
|
10052
10046
|
}
|
10053
10047
|
else if (node.expression.nodeType === 16 /* ParseNodeType.DictionaryExpandEntry */) {
|
10054
10048
|
// The parser should have reported an error in this case because it's not allowed.
|
@@ -10916,7 +10910,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
10916
10910
|
if (isPep695Syntax || isPep695TypeVarType) {
|
10917
10911
|
const typeAliasTypeClass = getTypingType(errorNode, 'TypeAliasType');
|
10918
10912
|
if (typeAliasTypeClass && (0, types_1.isInstantiableClass)(typeAliasTypeClass)) {
|
10919
|
-
typeAlias = types_1.TypeBase.cloneAsSpecialForm(typeAlias, typeAliasTypeClass);
|
10913
|
+
typeAlias = types_1.TypeBase.cloneAsSpecialForm(typeAlias, types_1.ClassType.cloneAsInstance(typeAliasTypeClass));
|
10920
10914
|
}
|
10921
10915
|
}
|
10922
10916
|
return typeAlias;
|
@@ -11168,9 +11162,19 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
11168
11162
|
}
|
11169
11163
|
// If this is an enum, transform the type as required.
|
11170
11164
|
rightHandType = srcType;
|
11171
|
-
|
11165
|
+
let targetName;
|
11166
|
+
if (node.leftExpression.nodeType === 38 /* ParseNodeType.Name */) {
|
11167
|
+
targetName = node.leftExpression;
|
11168
|
+
}
|
11169
|
+
else if (node.leftExpression.nodeType === 54 /* ParseNodeType.TypeAnnotation */ &&
|
11170
|
+
node.leftExpression.valueExpression.nodeType === 38 /* ParseNodeType.Name */) {
|
11171
|
+
targetName = node.leftExpression.valueExpression;
|
11172
|
+
}
|
11173
|
+
if (targetName) {
|
11172
11174
|
rightHandType =
|
11173
|
-
(_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node,
|
11175
|
+
(_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, targetName, () => {
|
11176
|
+
return { assignedType: rightHandType };
|
11177
|
+
})) !== null && _a !== void 0 ? _a : rightHandType;
|
11174
11178
|
}
|
11175
11179
|
if (typeAliasNameNode) {
|
11176
11180
|
// If this was a speculative type alias, it becomes a real type alias
|
@@ -12239,7 +12243,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
12239
12243
|
}
|
12240
12244
|
// In case this is an enum class and a method wrapped in an enum.member.
|
12241
12245
|
decoratedType =
|
12242
|
-
(_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, node.name, () =>
|
12246
|
+
(_a = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, node, node.name, () => {
|
12247
|
+
return { assignedType: decoratedType };
|
12248
|
+
})) !== null && _a !== void 0 ? _a : decoratedType;
|
12243
12249
|
// See if there are any overloads provided by previous function declarations.
|
12244
12250
|
if ((0, types_1.isFunction)(decoratedType)) {
|
12245
12251
|
decoratedType.details.deprecatedMessage = functionType.details.deprecatedMessage;
|
@@ -12750,11 +12756,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
12750
12756
|
if ((0, types_1.isUnpackedClass)(type)) {
|
12751
12757
|
return types_1.ClassType.cloneForUnpacked(type, /* isUnpackedTuple */ false);
|
12752
12758
|
}
|
12753
|
-
|
12754
|
-
return types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type, isUnbounded: !(0, types_1.isVariadicTypeVar)(type) }],
|
12755
|
-
/* isTypeArgumentExplicit */ true));
|
12756
|
-
}
|
12757
|
-
return types_1.UnknownType.create();
|
12759
|
+
return makeTupleObject([{ type, isUnbounded: !(0, types_1.isVariadicTypeVar)(type) }]);
|
12758
12760
|
}
|
12759
12761
|
case 2 /* ParameterCategory.KwargsDict */: {
|
12760
12762
|
// Leave a ParamSpec alone.
|
@@ -14826,7 +14828,9 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
14826
14828
|
const variableNode = (_c = ParseTreeUtils.getParentNodeOfType(declaration.node, 3 /* ParseNodeType.Assignment */)) !== null && _c !== void 0 ? _c : ParseTreeUtils.getParentNodeOfType(declaration.node, 54 /* ParseNodeType.TypeAnnotation */);
|
14827
14829
|
if (variableNode) {
|
14828
14830
|
declaredType =
|
14829
|
-
(_d = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, variableNode, declaration.node, () =>
|
14831
|
+
(_d = (0, enums_1.transformTypeForPossibleEnumClass)(evaluatorInterface, variableNode, declaration.node, () => {
|
14832
|
+
return { declaredType };
|
14833
|
+
})) !== null && _d !== void 0 ? _d : declaredType;
|
14830
14834
|
}
|
14831
14835
|
}
|
14832
14836
|
if ((0, types_1.isClassInstance)(declaredType) && types_1.ClassType.isBuiltIn(declaredType, 'TypeAlias')) {
|
@@ -15081,9 +15085,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
15081
15085
|
var _a, _b;
|
15082
15086
|
(0, debug_1.assert)(resolvedDecl.inferredTypeSource !== undefined);
|
15083
15087
|
const inferredTypeSource = resolvedDecl.inferredTypeSource;
|
15084
|
-
return
|
15085
|
-
|
15086
|
-
|
15088
|
+
return {
|
15089
|
+
assignedType: (_b = (_a = evaluateTypeForSubnode(inferredTypeSource, () => {
|
15090
|
+
evaluateTypesForStatement(inferredTypeSource);
|
15091
|
+
})) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : types_1.UnknownType.create(),
|
15092
|
+
};
|
15087
15093
|
});
|
15088
15094
|
if (enumMemberType) {
|
15089
15095
|
inferredType = enumMemberType;
|
@@ -16039,26 +16045,28 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16039
16045
|
const destUnboundedOrVariadicIndex = destTypeArgs.findIndex((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type));
|
16040
16046
|
const srcUnboundedIndex = srcTypeArgs.findIndex((t) => t.isUnbounded);
|
16041
16047
|
const srcVariadicIndex = srcTypeArgs.findIndex((t) => (0, types_1.isVariadicTypeVar)(t.type));
|
16042
|
-
|
16043
|
-
// If the src contains an unbounded type but the dest does not, it's incompatible.
|
16044
|
-
if (srcUnboundedIndex >= 0 && destUnboundedOrVariadicIndex < 0) {
|
16045
|
-
// Unless the source contains an [Any, ...].
|
16048
|
+
if (srcUnboundedIndex >= 0) {
|
16046
16049
|
if ((0, types_1.isAnyOrUnknown)(srcTypeArgs[srcUnboundedIndex].type)) {
|
16047
|
-
|
16050
|
+
// If the source contains an unbounded Any, expand it to match the dest length.
|
16051
|
+
const typeToReplicate = srcTypeArgs.length > 0 ? srcTypeArgs[srcUnboundedIndex].type : types_1.AnyType.create();
|
16052
|
+
while (srcTypeArgs.length < destTypeArgs.length) {
|
16053
|
+
srcTypeArgs.splice(srcUnboundedIndex, 0, { type: typeToReplicate, isUnbounded: true });
|
16054
|
+
}
|
16055
|
+
if (srcTypeArgs.length > destTypeArgs.length) {
|
16056
|
+
srcTypeArgs.splice(srcUnboundedIndex, 1);
|
16057
|
+
}
|
16048
16058
|
}
|
16049
|
-
else {
|
16059
|
+
else if (destUnboundedOrVariadicIndex < 0) {
|
16060
|
+
// If the source contains an unbounded type but the dest does not, it's incompatible.
|
16050
16061
|
return false;
|
16051
16062
|
}
|
16052
16063
|
}
|
16053
|
-
|
16054
|
-
|
16055
|
-
|
16056
|
-
|
16057
|
-
while (
|
16058
|
-
|
16059
|
-
}
|
16060
|
-
if (isSrcVariadicAny && srcTypeArgs.length > destTypeArgs.length) {
|
16061
|
-
srcTypeArgs.splice(srcUnboundedIndex, 1);
|
16064
|
+
// If the dest contains an unbounded Any, expand it to match the source length.
|
16065
|
+
if (destUnboundedOrVariadicIndex >= 0 &&
|
16066
|
+
destTypeArgs[destUnboundedOrVariadicIndex].isUnbounded &&
|
16067
|
+
(0, types_1.isAnyOrUnknown)(destTypeArgs[destUnboundedOrVariadicIndex].type)) {
|
16068
|
+
while (destTypeArgs.length < srcTypeArgs.length) {
|
16069
|
+
destTypeArgs.splice(destUnboundedOrVariadicIndex, 0, destTypeArgs[destUnboundedOrVariadicIndex]);
|
16062
16070
|
}
|
16063
16071
|
}
|
16064
16072
|
// Remove any optional parameters from the end of the two lists until the lengths match.
|
@@ -16068,23 +16076,26 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16068
16076
|
while (destTypeArgs.length > srcTypeArgs.length && destTypeArgs[destTypeArgs.length - 1].isOptional) {
|
16069
16077
|
destTypeArgs.splice(destTypeArgs.length - 1, 1);
|
16070
16078
|
}
|
16071
|
-
|
16079
|
+
// If we're doing reverse type mappings and the source contains a variadic
|
16080
|
+
// TypeVar, we need to adjust the dest so the reverse type mapping assignment
|
16081
|
+
// can be performed.
|
16082
|
+
if ((flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0) {
|
16072
16083
|
const destArgsToCapture = destTypeArgs.length - srcTypeArgs.length + 1;
|
16073
|
-
|
16074
|
-
// TypeVar, we need to adjust the dest so the reverse type mapping assignment
|
16075
|
-
// can be performed.
|
16076
|
-
if (destArgsToCapture >= 0 && (flags & 2 /* AssignTypeFlags.ReverseTypeVarMatching */) !== 0) {
|
16084
|
+
if (srcVariadicIndex >= 0 && destArgsToCapture >= 0) {
|
16077
16085
|
// If the only removed arg from the dest type args is itself a variadic,
|
16078
16086
|
// don't bother adjusting it.
|
16079
16087
|
const skipAdjustment = destArgsToCapture === 1 && (0, types_1.isVariadicTypeVar)(destTypeArgs[srcVariadicIndex].type);
|
16080
16088
|
if (!skipAdjustment && tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
|
16081
16089
|
const removedArgs = destTypeArgs.splice(srcVariadicIndex, destArgsToCapture);
|
16082
16090
|
// Package up the remaining type arguments into a tuple object.
|
16083
|
-
const variadicTuple = (
|
16084
|
-
return {
|
16091
|
+
const variadicTuple = makeTupleObject(removedArgs.map((typeArg) => {
|
16092
|
+
return {
|
16093
|
+
type: typeArg.type,
|
16094
|
+
isUnbounded: typeArg.isUnbounded,
|
16095
|
+
isOptional: typeArg.isOptional,
|
16096
|
+
};
|
16085
16097
|
}),
|
16086
|
-
/*
|
16087
|
-
/* isUnpackedTuple */ true));
|
16098
|
+
/* isUnpackedTuple */ true);
|
16088
16099
|
destTypeArgs.splice(srcVariadicIndex, 0, {
|
16089
16100
|
type: variadicTuple,
|
16090
16101
|
isUnbounded: false,
|
@@ -16101,11 +16112,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16101
16112
|
if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
|
16102
16113
|
const removedArgs = srcTypeArgs.splice(destUnboundedOrVariadicIndex, srcArgsToCapture);
|
16103
16114
|
// Package up the remaining type arguments into a tuple object.
|
16104
|
-
const variadicTuple = (
|
16105
|
-
return {
|
16115
|
+
const variadicTuple = makeTupleObject(removedArgs.map((typeArg) => {
|
16116
|
+
return {
|
16117
|
+
type: typeArg.type,
|
16118
|
+
isUnbounded: typeArg.isUnbounded,
|
16119
|
+
isOptional: typeArg.isOptional,
|
16120
|
+
};
|
16106
16121
|
}),
|
16107
|
-
/*
|
16108
|
-
/* isUnpackedTuple */ true));
|
16122
|
+
/* isUnpackedTuple */ true);
|
16109
16123
|
srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
|
16110
16124
|
type: variadicTuple,
|
16111
16125
|
isUnbounded: false,
|
@@ -16113,18 +16127,27 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16113
16127
|
}
|
16114
16128
|
}
|
16115
16129
|
else {
|
16116
|
-
|
16117
|
-
|
16118
|
-
|
16119
|
-
|
16120
|
-
|
16121
|
-
|
16122
|
-
|
16123
|
-
|
16124
|
-
|
16125
|
-
|
16126
|
-
|
16127
|
-
|
16130
|
+
// If possible, package up the source entries that correspond to
|
16131
|
+
// the dest unbounded tuple. This isn't possible if the source contains
|
16132
|
+
// an unbounded tuple outside of this range.
|
16133
|
+
if (srcUnboundedIndex < 0 ||
|
16134
|
+
(srcUnboundedIndex >= destUnboundedOrVariadicIndex &&
|
16135
|
+
srcUnboundedIndex < destUnboundedOrVariadicIndex + srcArgsToCapture)) {
|
16136
|
+
const removedArgTypes = srcTypeArgs
|
16137
|
+
.splice(destUnboundedOrVariadicIndex, srcArgsToCapture)
|
16138
|
+
.map((t) => {
|
16139
|
+
if ((0, types_1.isTypeVar)(t.type) &&
|
16140
|
+
(0, types_1.isUnpackedVariadicTypeVar)(t.type) &&
|
16141
|
+
!t.type.isVariadicInUnion) {
|
16142
|
+
return types_1.TypeVarType.cloneForUnpacked(t.type, /* isInUnion */ true);
|
16143
|
+
}
|
16144
|
+
return t.type;
|
16145
|
+
});
|
16146
|
+
srcTypeArgs.splice(destUnboundedOrVariadicIndex, 0, {
|
16147
|
+
type: removedArgTypes.length > 0 ? (0, types_1.combineTypes)(removedArgTypes) : types_1.AnyType.create(),
|
16148
|
+
isUnbounded: false,
|
16149
|
+
});
|
16150
|
+
}
|
16128
16151
|
}
|
16129
16152
|
}
|
16130
16153
|
}
|
@@ -16148,16 +16171,32 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16148
16171
|
}
|
16149
16172
|
}
|
16150
16173
|
else {
|
16151
|
-
|
16152
|
-
|
16153
|
-
|
16154
|
-
|
16174
|
+
const isDestIndeterminate = destTypeArgs.some((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type));
|
16175
|
+
if (srcTypeArgs.some((t) => t.isUnbounded || (0, types_1.isVariadicTypeVar)(t.type))) {
|
16176
|
+
if (isDestIndeterminate) {
|
16177
|
+
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeIndeterminateSrcDest().format({
|
16178
|
+
expected: destTypeArgs.length - 1,
|
16179
|
+
}));
|
16180
|
+
}
|
16181
|
+
else {
|
16182
|
+
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeIndeterminateSrc().format({
|
16183
|
+
expected: destTypeArgs.length,
|
16184
|
+
}));
|
16185
|
+
}
|
16155
16186
|
}
|
16156
16187
|
else {
|
16157
|
-
|
16158
|
-
|
16159
|
-
|
16160
|
-
|
16188
|
+
if (isDestIndeterminate) {
|
16189
|
+
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeMismatchIndeterminateDest().format({
|
16190
|
+
expected: destTypeArgs.length - 1,
|
16191
|
+
received: srcTypeArgs.length,
|
16192
|
+
}));
|
16193
|
+
}
|
16194
|
+
else {
|
16195
|
+
diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.LocAddendum.tupleSizeMismatch().format({
|
16196
|
+
expected: destTypeArgs.length,
|
16197
|
+
received: srcTypeArgs.length,
|
16198
|
+
}));
|
16199
|
+
}
|
16161
16200
|
}
|
16162
16201
|
return false;
|
16163
16202
|
}
|
@@ -16248,6 +16287,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
16248
16287
|
const typeParam = destType.details.typeParameters[i];
|
16249
16288
|
const variance = types_1.TypeVarType.getVariance(typeParam);
|
16250
16289
|
(0, constraintSolver_1.updateTypeVarType)(evaluatorInterface, destTypeVarContext, typeParam, variance !== 4 /* Variance.Contravariant */ ? typeArgType : undefined, variance !== 3 /* Variance.Covariant */ ? typeArgType : undefined,
|
16290
|
+
/* tupleTypes */ curSrcType.tupleTypeArguments,
|
16251
16291
|
/* forceRetainLiterals */ true);
|
16252
16292
|
}
|
16253
16293
|
}
|
@@ -17010,7 +17050,8 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
17010
17050
|
return false;
|
17011
17051
|
});
|
17012
17052
|
if (destTypeIndex >= 0) {
|
17013
|
-
if (assignType(remainingDestSubtypes[destTypeIndex], srcSubtype,
|
17053
|
+
if (assignType(remainingDestSubtypes[destTypeIndex], srcSubtype,
|
17054
|
+
/* diag */ undefined, destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
|
17014
17055
|
// Note that we have matched at least one subtype indicating
|
17015
17056
|
// there is at least some overlap.
|
17016
17057
|
matchedSomeSubtypes = true;
|
@@ -17459,15 +17500,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
17459
17500
|
}
|
17460
17501
|
});
|
17461
17502
|
if (srcTupleTypes.length !== 1 || !(0, types_1.isVariadicTypeVar)(srcTupleTypes[0].type)) {
|
17462
|
-
|
17463
|
-
if (tupleClassType && (0, types_1.isInstantiableClass)(tupleClassType)) {
|
17464
|
-
srcPositionalsType = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, srcTupleTypes,
|
17465
|
-
/* isTypeArgumentExplicit */ true,
|
17466
|
-
/* isUnpackedTuple */ true));
|
17467
|
-
}
|
17468
|
-
else {
|
17469
|
-
srcPositionalsType = types_1.UnknownType.create();
|
17470
|
-
}
|
17503
|
+
const srcPositionalsType = makeTupleObject(srcTupleTypes, /* isUnpackedTuple */ true);
|
17471
17504
|
// Snip out the portion of the source positionals that map to the variadic
|
17472
17505
|
// dest parameter and replace it with a single parameter that is typed as a
|
17473
17506
|
// tuple containing the individual types of the replaced parameters.
|
@@ -17675,15 +17708,11 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
17675
17708
|
!types_1.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(destType)) {
|
17676
17709
|
let destArgsType = destParamDetails.params[destParamDetails.argsIndex].type;
|
17677
17710
|
let srcArgsType = srcParamDetails.params[srcParamDetails.argsIndex].type;
|
17678
|
-
if (
|
17679
|
-
|
17680
|
-
|
17681
|
-
|
17682
|
-
}
|
17683
|
-
if (!(0, types_1.isUnpacked)(srcArgsType)) {
|
17684
|
-
srcArgsType = types_1.ClassType.cloneForUnpacked(types_1.ClassType.cloneAsInstance((0, typeUtils_1.specializeTupleClass)(tupleClassType, [{ type: srcArgsType, isUnbounded: true }],
|
17685
|
-
/* isTypeArgumentExplicit */ true)));
|
17686
|
-
}
|
17711
|
+
if (!(0, types_1.isUnpacked)(destArgsType)) {
|
17712
|
+
destArgsType = makeTupleObject([{ type: destArgsType, isUnbounded: true }], /* isUnpackedTuple */ true);
|
17713
|
+
}
|
17714
|
+
if (!(0, types_1.isUnpacked)(srcArgsType)) {
|
17715
|
+
srcArgsType = makeTupleObject([{ type: srcArgsType, isUnbounded: true }], /* isUnpackedTuple */ true);
|
17687
17716
|
}
|
17688
17717
|
if (!assignFunctionParameter(destArgsType, srcArgsType, destParamDetails.params[destParamDetails.argsIndex].index, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
|
17689
17718
|
canAssign = false;
|
@@ -18012,6 +18041,14 @@ function createTypeEvaluator(importLookup, evaluatorOptions) {
|
|
18012
18041
|
// we may be able to narrow the type based on the assignment.
|
18013
18042
|
function narrowTypeBasedOnAssignment(node, declaredType, assignedType) {
|
18014
18043
|
const narrowedType = (0, typeUtils_1.mapSubtypes)(assignedType, (assignedSubtype) => {
|
18044
|
+
// Handle the special case where the assigned type is a literal type.
|
18045
|
+
// Some types include very large unions of literal types, and we don't
|
18046
|
+
// want to use an n^2 loop to compare them.
|
18047
|
+
if ((0, types_1.isClass)(assignedSubtype) && (0, typeUtils_1.isLiteralType)(assignedSubtype)) {
|
18048
|
+
if ((0, types_1.isUnion)(declaredType) && types_1.UnionType.containsType(declaredType, assignedSubtype)) {
|
18049
|
+
return assignedSubtype;
|
18050
|
+
}
|
18051
|
+
}
|
18015
18052
|
const narrowedSubtype = (0, typeUtils_1.mapSubtypes)(declaredType, (declaredSubtype) => {
|
18016
18053
|
// We can't narrow "Any".
|
18017
18054
|
if ((0, types_1.isAnyOrUnknown)(declaredSubtype)) {
|