@zzzen/pyright-internal 1.2.0-dev.20240721 → 1.2.0-dev.20240804
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/analyzerNodeInfo.js +2 -2
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/binder.js +15 -12
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/cacheManager.js +3 -0
- package/dist/analyzer/cacheManager.js.map +1 -1
- package/dist/analyzer/checker.d.ts +5 -3
- package/dist/analyzer/checker.js +238 -193
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +2 -2
- package/dist/analyzer/codeFlowEngine.js +53 -46
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowTypes.js +1 -1
- package/dist/analyzer/codeFlowTypes.js.map +1 -1
- package/dist/analyzer/constraintSolution.d.ts +21 -0
- package/dist/analyzer/constraintSolution.js +71 -0
- package/dist/analyzer/constraintSolution.js.map +1 -0
- package/dist/analyzer/constraintSolver.d.ts +10 -6
- package/dist/analyzer/constraintSolver.js +520 -462
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constraintTracker.d.ts +44 -0
- package/dist/analyzer/constraintTracker.js +230 -0
- package/dist/analyzer/constraintTracker.js.map +1 -0
- package/dist/analyzer/constructorTransform.d.ts +2 -2
- package/dist/analyzer/constructorTransform.js +25 -25
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/constructors.d.ts +3 -3
- package/dist/analyzer/constructors.js +80 -64
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +2 -2
- package/dist/analyzer/dataClasses.js +87 -61
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +9 -9
- package/dist/analyzer/declaration.js +9 -9
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +1 -1
- package/dist/analyzer/declarationUtils.js +6 -6
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.js +5 -5
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +2 -2
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/enums.d.ts +2 -2
- package/dist/analyzer/enums.js +6 -6
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/functionTransform.d.ts +2 -2
- package/dist/analyzer/functionTransform.js +5 -5
- package/dist/analyzer/functionTransform.js.map +1 -1
- package/dist/analyzer/importResolver.js +5 -3
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/namedTuples.d.ts +3 -3
- package/dist/analyzer/namedTuples.js +21 -22
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.d.ts +1 -2
- package/dist/analyzer/operations.js +105 -82
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +16 -12
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parameterUtils.d.ts +12 -12
- package/dist/analyzer/parameterUtils.js +67 -69
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +6 -6
- package/dist/analyzer/parseTreeUtils.js +22 -22
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/patternMatching.js +122 -101
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.js +11 -4
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.d.ts +3 -2
- package/dist/analyzer/properties.js +27 -27
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.d.ts +3 -3
- package/dist/analyzer/protocols.js +58 -57
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js +1 -1
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/service.d.ts +3 -7
- package/dist/analyzer/service.js +28 -30
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/serviceUtils.d.ts +8 -0
- package/dist/analyzer/serviceUtils.js +31 -0
- package/dist/analyzer/serviceUtils.js.map +1 -0
- package/dist/analyzer/sourceFile.js +5 -19
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +1 -1
- package/dist/analyzer/sourceMapper.js +4 -4
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/staticExpressions.js +1 -1
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/tracePrinter.js +4 -4
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/tuples.d.ts +9 -0
- package/dist/analyzer/tuples.js +253 -0
- package/dist/analyzer/tuples.js.map +1 -0
- package/dist/analyzer/typeComplexity.d.ts +2 -0
- package/dist/analyzer/typeComplexity.js +94 -0
- package/dist/analyzer/typeComplexity.js.map +1 -0
- package/dist/analyzer/typeEvaluator.js +1758 -1979
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +69 -45
- package/dist/analyzer/typeEvaluatorTypes.js +7 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +157 -121
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +1 -1
- package/dist/analyzer/typePrinter.js +64 -61
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.d.ts +3 -3
- package/dist/analyzer/typeStubWriter.js +15 -15
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +45 -41
- package/dist/analyzer/typeUtils.js +511 -748
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeWalker.js +4 -4
- package/dist/analyzer/typeWalker.js.map +1 -1
- package/dist/analyzer/typedDicts.d.ts +4 -4
- package/dist/analyzer/typedDicts.js +73 -77
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +97 -72
- package/dist/analyzer/types.js +217 -208
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +11 -11
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/configOptions.d.ts +1 -0
- package/dist/common/configOptions.js +5 -0
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/diagnosticRules.d.ts +1 -0
- package/dist/common/diagnosticRules.js +1 -0
- package/dist/common/diagnosticRules.js.map +1 -1
- package/dist/common/fileSystem.d.ts +0 -1
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/languageServerInterface.d.ts +13 -0
- package/dist/common/languageServerInterface.js +15 -1
- package/dist/common/languageServerInterface.js.map +1 -1
- package/dist/common/lspUtils.js +2 -2
- package/dist/common/memUtils.d.ts +4 -0
- package/dist/common/memUtils.js +33 -2
- package/dist/common/memUtils.js.map +1 -1
- package/dist/common/serviceKeys.d.ts +3 -0
- package/dist/common/serviceKeys.js +2 -0
- package/dist/common/serviceKeys.js.map +1 -1
- package/dist/common/serviceProviderExtensions.js +7 -0
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/languageServerBase.d.ts +5 -4
- package/dist/languageServerBase.js +19 -12
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +3 -2
- package/dist/languageService/autoImporter.js +5 -1
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +5 -3
- package/dist/languageService/completionProvider.js +39 -38
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +1 -1
- package/dist/languageService/completionProviderUtils.js +3 -3
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/fileWatcherDynamicFeature.js +2 -2
- package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -1
- package/dist/languageService/hoverProvider.js +3 -3
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/referencesProvider.js +2 -2
- package/dist/languageService/signatureHelpProvider.js +1 -1
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +3 -3
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/localization/localize.d.ts +5 -0
- package/dist/localization/localize.js +6 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +5 -1
- package/dist/localization/package.nls.de.json +5 -1
- package/dist/localization/package.nls.en-us.json +5 -0
- package/dist/localization/package.nls.es.json +5 -1
- package/dist/localization/package.nls.fr.json +5 -1
- package/dist/localization/package.nls.it.json +5 -1
- package/dist/localization/package.nls.ja.json +5 -1
- package/dist/localization/package.nls.ko.json +5 -1
- package/dist/localization/package.nls.pl.json +5 -1
- package/dist/localization/package.nls.pt-br.json +5 -1
- package/dist/localization/package.nls.qps-ploc.json +5 -1
- package/dist/localization/package.nls.ru.json +5 -1
- package/dist/localization/package.nls.tr.json +5 -1
- package/dist/localization/package.nls.zh-cn.json +5 -1
- package/dist/localization/package.nls.zh-tw.json +5 -1
- package/dist/parser/parseNodes.d.ts +9 -9
- package/dist/parser/parseNodes.js +20 -20
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.js +30 -30
- package/dist/parser/parser.js.map +1 -1
- package/dist/tests/checker.test.js +12 -4
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js +4 -21
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.complicated.fourslash.js +1 -1
- package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/testStateUtils.js +2 -2
- package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.d.ts +0 -1
- package/dist/tests/harness/vfs/filesystem.js +0 -4
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/importResolver.test.js +62 -15
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/lsp/languageServerTestUtils.js +1 -1
- package/dist/tests/lsp/languageServerTestUtils.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +1 -1
- package/dist/tests/typeEvaluator2.test.js +12 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +5 -1
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +10 -2
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +9 -3
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typeEvaluator6.test.js +72 -60
- package/dist/tests/typeEvaluator6.test.js.map +1 -1
- package/dist/tests/typeEvaluator7.test.js +6 -2
- package/dist/tests/typeEvaluator7.test.js.map +1 -1
- package/dist/tests/typeEvaluator8.test.js +4 -0
- package/dist/tests/typeEvaluator8.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js +13 -18
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/workspaceFactory.d.ts +3 -2
- package/dist/workspaceFactory.js +15 -2
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +1 -1
- package/dist/analyzer/typeVarContext.d.ts +0 -60
- package/dist/analyzer/typeVarContext.js +0 -392
- package/dist/analyzer/typeVarContext.js.map +0 -1
package/dist/analyzer/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Uri } from '../common/uri/uri';
|
2
|
-
import { ArgumentNode, NameNode,
|
2
|
+
import { ArgumentNode, NameNode, ParamCategory } from '../parser/parseNodes';
|
3
3
|
import { ClassDeclaration, FunctionDeclaration, SpecialBuiltInClassDeclaration } from './declaration';
|
4
4
|
import { Symbol, SymbolTable } from './symbol';
|
5
5
|
export declare const enum TypeCategory {
|
@@ -24,7 +24,7 @@ export declare const enum TypeFlags {
|
|
24
24
|
export type UnionableType = UnboundType | UnknownType | AnyType | FunctionType | OverloadedFunctionType | ClassType | ModuleType | TypeVarType;
|
25
25
|
export type Type = UnionableType | NeverType | UnionType;
|
26
26
|
export type TypeVarScopeId = string;
|
27
|
-
export declare const
|
27
|
+
export declare const UnificationScopeId = "-";
|
28
28
|
export declare class EnumLiteral {
|
29
29
|
classFullName: string;
|
30
30
|
className: string;
|
@@ -51,9 +51,9 @@ export interface TypeAliasInfo {
|
|
51
51
|
fileUri: Uri;
|
52
52
|
typeVarScopeId: TypeVarScopeId;
|
53
53
|
isPep695Syntax: boolean;
|
54
|
-
|
54
|
+
typeParams: TypeVarType[] | undefined;
|
55
55
|
usageVariance: Variance[] | undefined;
|
56
|
-
|
56
|
+
typeArgs: Type[] | undefined;
|
57
57
|
}
|
58
58
|
interface CachedTypeInfo {
|
59
59
|
instantiableType?: Type;
|
@@ -89,7 +89,7 @@ export declare namespace TypeBase {
|
|
89
89
|
function cloneAsSpecialForm<T extends TypeBase<any>>(type: T, specialForm: ClassType | undefined): T;
|
90
90
|
function cloneTypeAsInstance<T extends Type>(type: T, cache: boolean): T;
|
91
91
|
function cloneTypeAsInstantiable<T extends Type>(type: T, cache: boolean): T;
|
92
|
-
function cloneForTypeAlias(type: Type,
|
92
|
+
function cloneForTypeAlias(type: Type, aliasInfo: TypeAliasInfo): Type;
|
93
93
|
function cloneForCondition<T extends Type>(type: T, condition: TypeCondition[] | undefined): T;
|
94
94
|
function cloneForAmbiguousType(type: Type): Type;
|
95
95
|
}
|
@@ -99,19 +99,19 @@ export declare namespace UnboundType {
|
|
99
99
|
function create(): UnboundType;
|
100
100
|
function convertToInstance(type: UnboundType): UnboundType;
|
101
101
|
}
|
102
|
-
export interface
|
102
|
+
export interface UnknownDetailsPriv {
|
103
103
|
isIncomplete: boolean;
|
104
104
|
possibleType: Type | undefined;
|
105
105
|
}
|
106
106
|
export interface UnknownType extends TypeBase<TypeCategory.Unknown> {
|
107
|
-
priv:
|
107
|
+
priv: UnknownDetailsPriv;
|
108
108
|
}
|
109
109
|
export declare namespace UnknownType {
|
110
110
|
function create(isIncomplete?: boolean): UnknownType;
|
111
111
|
function createPossibleType(possibleType: Type, isIncomplete: boolean): UnknownType;
|
112
112
|
function convertToInstance(type: UnknownType): UnknownType;
|
113
113
|
}
|
114
|
-
export interface
|
114
|
+
export interface ModuleDetailsPriv {
|
115
115
|
fields: SymbolTable;
|
116
116
|
docString: string | undefined;
|
117
117
|
notPresentFieldType: AnyType | UnknownType | undefined;
|
@@ -120,7 +120,7 @@ export interface ModuleTypeDetailsPriv {
|
|
120
120
|
fileUri: Uri;
|
121
121
|
}
|
122
122
|
export interface ModuleType extends TypeBase<TypeCategory.Module> {
|
123
|
-
priv:
|
123
|
+
priv: ModuleDetailsPriv;
|
124
124
|
}
|
125
125
|
export declare namespace ModuleType {
|
126
126
|
function create(moduleName: string, fileUri: Uri, symbolTable?: SymbolTable): ModuleType;
|
@@ -200,7 +200,7 @@ interface ClassDetailsShared {
|
|
200
200
|
declaredMetaclass?: ClassType | UnknownType | undefined;
|
201
201
|
effectiveMetaclass?: ClassType | UnknownType | undefined;
|
202
202
|
fields: SymbolTable;
|
203
|
-
|
203
|
+
typeParams: TypeVarType[];
|
204
204
|
typeVarScopeId?: TypeVarScopeId | undefined;
|
205
205
|
docString?: string | undefined;
|
206
206
|
dataClassEntries?: DataClassEntry[] | undefined;
|
@@ -216,7 +216,7 @@ interface ClassDetailsShared {
|
|
216
216
|
calculateInheritedSlotsNamesDeferred?: () => void;
|
217
217
|
inheritedSlotsNamesCached?: string[];
|
218
218
|
}
|
219
|
-
export interface
|
219
|
+
export interface TupleTypeArg {
|
220
220
|
type: Type;
|
221
221
|
isUnbounded: boolean;
|
222
222
|
isOptional?: boolean;
|
@@ -226,13 +226,11 @@ export interface PropertyMethodInfo {
|
|
226
226
|
classType: ClassType | undefined;
|
227
227
|
}
|
228
228
|
export interface ClassDetailsPriv {
|
229
|
-
|
230
|
-
typeGuardType?: Type | undefined;
|
231
|
-
isStrictTypeGuard?: boolean;
|
229
|
+
typeArgs?: Type[] | undefined;
|
232
230
|
isEmptyContainer?: boolean | undefined;
|
233
|
-
|
231
|
+
tupleTypeArgs?: TupleTypeArg[] | undefined;
|
234
232
|
isUnpacked?: boolean | undefined;
|
235
|
-
|
233
|
+
isTypeArgExplicit?: boolean | undefined;
|
236
234
|
includeSubclasses?: boolean;
|
237
235
|
includePromotions?: boolean;
|
238
236
|
literalValue?: LiteralValue | undefined;
|
@@ -254,7 +252,7 @@ export declare namespace ClassType {
|
|
254
252
|
function createInstantiable(name: string, fullName: string, moduleName: string, fileUri: Uri, flags: ClassTypeFlags, typeSourceId: TypeSourceId, declaredMetaclass: ClassType | UnknownType | undefined, effectiveMetaclass: ClassType | UnknownType | undefined, docString?: string): ClassType;
|
255
253
|
function cloneAsInstance(type: ClassType, includeSubclasses?: boolean): ClassType;
|
256
254
|
function cloneAsInstantiable(type: ClassType, includeSubclasses?: boolean): ClassType;
|
257
|
-
function
|
255
|
+
function specialize(classType: ClassType, typeArgs: Type[] | undefined, isTypeArgExplicit?: boolean, includeSubclasses?: boolean, tupleTypeArgs?: TupleTypeArg[], isEmptyContainer?: boolean): ClassType;
|
258
256
|
function cloneIncludeSubclasses(classType: ClassType, includeSubclasses?: boolean): ClassType;
|
259
257
|
function cloneWithLiteral(classType: ClassType, value: LiteralValue | undefined): ClassType;
|
260
258
|
function cloneForDeprecatedInstance(type: ClassType, deprecatedMessage?: string): ClassType;
|
@@ -262,7 +260,6 @@ export declare namespace ClassType {
|
|
262
260
|
function cloneForNarrowedTypedDictEntries(classType: ClassType, narrowedEntries?: Map<string, TypedDictEntry>): ClassType;
|
263
261
|
function cloneForPartialTypedDict(classType: ClassType): ClassType;
|
264
262
|
function cloneRemoveTypePromotions(classType: ClassType): ClassType;
|
265
|
-
function cloneForTypeGuard(classType: ClassType, typeGuardType: Type, isStrictTypeGuard: boolean): ClassType;
|
266
263
|
function cloneForSymbolTableUpdate(classType: ClassType): ClassType;
|
267
264
|
function cloneForUnpacked(classType: ClassType, isUnpacked?: boolean): ClassType;
|
268
265
|
function cloneWithNewFlags(classType: ClassType, newFlags: ClassTypeFlags): ClassType;
|
@@ -304,7 +301,7 @@ export declare namespace ClassType {
|
|
304
301
|
function hasCustomClassGetItem(classType: ClassType): boolean;
|
305
302
|
function isTupleClass(classType: ClassType): boolean;
|
306
303
|
function isReadOnlyInstanceVariables(classType: ClassType): boolean;
|
307
|
-
function
|
304
|
+
function getTypeParams(classType: ClassType): TypeVarType[];
|
308
305
|
function derivesFromAnyOrUnknown(classType: ClassType): boolean;
|
309
306
|
function getSymbolTable(classType: ClassType): SymbolTable;
|
310
307
|
function getInheritedSlotsNames(classType: ClassType): string[] | undefined;
|
@@ -320,14 +317,14 @@ export declare enum FunctionParamFlags {
|
|
320
317
|
TypeInferred = 4
|
321
318
|
}
|
322
319
|
export interface FunctionParam {
|
323
|
-
category:
|
324
|
-
type: Type;
|
320
|
+
category: ParamCategory;
|
325
321
|
flags: FunctionParamFlags;
|
326
322
|
name: string | undefined;
|
327
|
-
|
323
|
+
_type: Type;
|
324
|
+
_defaultType: Type | undefined;
|
328
325
|
}
|
329
326
|
export declare namespace FunctionParam {
|
330
|
-
function create(category:
|
327
|
+
function create(category: ParamCategory, type: Type, flags?: FunctionParamFlags, name?: string, defaultType?: Type): FunctionParam;
|
331
328
|
function isNameSynthesized(param: FunctionParam): boolean;
|
332
329
|
function isTypeDeclared(param: FunctionParam): boolean;
|
333
330
|
function isTypeInferred(param: FunctionParam): boolean;
|
@@ -362,7 +359,7 @@ interface FunctionDetailsShared {
|
|
362
359
|
fullName: string;
|
363
360
|
moduleName: string;
|
364
361
|
flags: FunctionTypeFlags;
|
365
|
-
|
362
|
+
typeParams: TypeVarType[];
|
366
363
|
parameters: FunctionParam[];
|
367
364
|
declaredReturnType: Type | undefined;
|
368
365
|
declaration: FunctionDeclaration | undefined;
|
@@ -374,7 +371,7 @@ interface FunctionDetailsShared {
|
|
374
371
|
}
|
375
372
|
export interface SpecializedFunctionTypes {
|
376
373
|
parameterTypes: Type[];
|
377
|
-
|
374
|
+
parameterDefaultTypes: (Type | undefined)[] | undefined;
|
378
375
|
returnType: Type | undefined;
|
379
376
|
}
|
380
377
|
export interface CallSiteInferenceTypeCacheEntry {
|
@@ -387,7 +384,6 @@ export interface SignatureWithOffsets {
|
|
387
384
|
}
|
388
385
|
export interface FunctionDetailsPriv {
|
389
386
|
constructorTypeVarScopeId?: TypeVarScopeId | undefined;
|
390
|
-
higherOrderTypeVarScopeIds?: TypeVarScopeId[];
|
391
387
|
specializedTypes?: SpecializedFunctionTypes | undefined;
|
392
388
|
inferredReturnType?: Type | undefined;
|
393
389
|
callSiteReturnTypeCache?: CallSiteInferenceTypeCacheEntry[];
|
@@ -405,22 +401,21 @@ export declare namespace FunctionType {
|
|
405
401
|
function createInstance(name: string, fullName: string, moduleName: string, functionFlags: FunctionTypeFlags, docString?: string): FunctionType;
|
406
402
|
function createInstantiable(functionFlags: FunctionTypeFlags, docString?: string): FunctionType;
|
407
403
|
function createSynthesizedInstance(name: string, additionalFlags?: FunctionTypeFlags): FunctionType;
|
408
|
-
function clone(type: FunctionType, stripFirstParam?: boolean, boundToType?: ClassType
|
404
|
+
function clone(type: FunctionType, stripFirstParam?: boolean, boundToType?: ClassType): FunctionType;
|
409
405
|
function cloneAsInstance(type: FunctionType): FunctionType;
|
410
406
|
function cloneAsInstantiable(type: FunctionType): FunctionType;
|
411
|
-
function
|
407
|
+
function specialize(type: FunctionType, specializedTypes: SpecializedFunctionTypes, specializedInferredReturnType: Type | undefined): FunctionType;
|
412
408
|
function applyParamSpecValue(type: FunctionType, paramSpecValue: FunctionType): FunctionType;
|
413
409
|
function cloneWithNewFlags(type: FunctionType, flags: FunctionTypeFlags): FunctionType;
|
414
|
-
function cloneWithNewTypeVarScopeId(type: FunctionType, newScopeId: TypeVarScopeId | undefined, newConstructorScopeId: TypeVarScopeId | undefined,
|
410
|
+
function cloneWithNewTypeVarScopeId(type: FunctionType, newScopeId: TypeVarScopeId | undefined, newConstructorScopeId: TypeVarScopeId | undefined, typeParams: TypeVarType[]): FunctionType;
|
415
411
|
function cloneWithDocString(type: FunctionType, docString?: string): FunctionType;
|
416
412
|
function cloneWithDeprecatedMessage(type: FunctionType, deprecatedMessage?: string): FunctionType;
|
417
413
|
function cloneRemoveParamSpecArgsKwargs(type: FunctionType, stripPositionOnlySeparator?: boolean): FunctionType;
|
418
|
-
function getParamSpecFromArgsKwargs(type: FunctionType):
|
419
|
-
function addParamSpecVariadics(type: FunctionType, paramSpec:
|
420
|
-
function
|
421
|
-
function
|
422
|
-
function
|
423
|
-
function hasDefaultParameters(functionType: FunctionType): boolean;
|
414
|
+
function getParamSpecFromArgsKwargs(type: FunctionType): ParamSpecType | undefined;
|
415
|
+
function addParamSpecVariadics(type: FunctionType, paramSpec: ParamSpecType): void;
|
416
|
+
function addDefaultParams(type: FunctionType, useUnknown?: boolean): void;
|
417
|
+
function getDefaultParams(useUnknown?: boolean): FunctionParam[];
|
418
|
+
function hasDefaultParams(functionType: FunctionType): boolean;
|
424
419
|
function isInstanceMethod(type: FunctionType): boolean;
|
425
420
|
function isConstructorMethod(type: FunctionType): boolean;
|
426
421
|
function isStaticMethod(type: FunctionType): boolean;
|
@@ -430,7 +425,7 @@ export declare namespace FunctionType {
|
|
430
425
|
function isSynthesizedMethod(type: FunctionType): boolean;
|
431
426
|
function isTypeCheckOnly(type: FunctionType): boolean;
|
432
427
|
function isOverloaded(type: FunctionType): boolean;
|
433
|
-
function
|
428
|
+
function isDefaultParamCheckDisabled(type: FunctionType): boolean;
|
434
429
|
function isAsync(type: FunctionType): boolean;
|
435
430
|
function isStubDefinition(type: FunctionType): boolean;
|
436
431
|
function isPyTypedDefinition(type: FunctionType): boolean;
|
@@ -441,18 +436,19 @@ export declare namespace FunctionType {
|
|
441
436
|
function isPartiallyEvaluated(type: FunctionType): boolean;
|
442
437
|
function isOverridden(type: FunctionType): boolean;
|
443
438
|
function isBuiltIn(type: FunctionType, name?: string | string[]): boolean;
|
444
|
-
function
|
445
|
-
function
|
446
|
-
function
|
447
|
-
function
|
448
|
-
function
|
439
|
+
function getDeclaredParamType(type: FunctionType, index: number): Type;
|
440
|
+
function getParamType(type: FunctionType, index: number): Type;
|
441
|
+
function getParamDefaultType(type: FunctionType, index: number): Type | undefined;
|
442
|
+
function addParam(type: FunctionType, param: FunctionParam): void;
|
443
|
+
function addPositionOnlyParamSeparator(type: FunctionType): void;
|
444
|
+
function addKeywordOnlyParamSeparator(type: FunctionType): void;
|
449
445
|
function getEffectiveReturnType(type: FunctionType, includeInferred?: boolean): Type | undefined;
|
450
446
|
}
|
451
|
-
export interface
|
447
|
+
export interface OverloadedFunctionDetailsPriv {
|
452
448
|
overloads: FunctionType[];
|
453
449
|
}
|
454
450
|
export interface OverloadedFunctionType extends TypeBase<TypeCategory.OverloadedFunction> {
|
455
|
-
priv:
|
451
|
+
priv: OverloadedFunctionDetailsPriv;
|
456
452
|
}
|
457
453
|
export declare namespace OverloadedFunctionType {
|
458
454
|
function create(overloads: FunctionType[]): OverloadedFunctionType;
|
@@ -460,22 +456,22 @@ export declare namespace OverloadedFunctionType {
|
|
460
456
|
function getOverloads(type: OverloadedFunctionType): FunctionType[];
|
461
457
|
function getImplementation(type: OverloadedFunctionType): FunctionType | undefined;
|
462
458
|
}
|
463
|
-
export interface
|
459
|
+
export interface NeverDetailsPriv {
|
464
460
|
isNoReturn: boolean;
|
465
461
|
}
|
466
462
|
export interface NeverType extends TypeBase<TypeCategory.Never> {
|
467
|
-
priv:
|
463
|
+
priv: NeverDetailsPriv;
|
468
464
|
}
|
469
465
|
export declare namespace NeverType {
|
470
466
|
function createNever(): NeverType;
|
471
467
|
function createNoReturn(): NeverType;
|
472
468
|
function convertToInstance(type: NeverType): NeverType;
|
473
469
|
}
|
474
|
-
export interface
|
470
|
+
export interface AnyDetailsPriv {
|
475
471
|
isEllipsis: boolean;
|
476
472
|
}
|
477
473
|
export interface AnyType extends TypeBase<TypeCategory.Any> {
|
478
|
-
priv:
|
474
|
+
priv: AnyDetailsPriv;
|
479
475
|
}
|
480
476
|
export declare namespace AnyType {
|
481
477
|
function create(isEllipsis?: boolean): AnyType;
|
@@ -498,7 +494,7 @@ export interface LiteralTypes {
|
|
498
494
|
literalIntMap: Map<bigint | number, UnionableType> | undefined;
|
499
495
|
literalEnumMap: Map<string, UnionableType> | undefined;
|
500
496
|
}
|
501
|
-
export interface
|
497
|
+
export interface UnionDetailsPriv {
|
502
498
|
subtypes: UnionableType[];
|
503
499
|
literalInstances: LiteralTypes;
|
504
500
|
literalClasses: LiteralTypes;
|
@@ -506,7 +502,7 @@ export interface UnionTypeDetailsPriv {
|
|
506
502
|
includesRecursiveTypeAlias: boolean;
|
507
503
|
}
|
508
504
|
export interface UnionType extends TypeBase<TypeCategory.Union> {
|
509
|
-
priv:
|
505
|
+
priv: UnionDetailsPriv;
|
510
506
|
}
|
511
507
|
export declare namespace UnionType {
|
512
508
|
function create(): UnionType;
|
@@ -525,16 +521,20 @@ export interface RecursiveAliasInfo {
|
|
525
521
|
name: string;
|
526
522
|
scopeId: TypeVarScopeId;
|
527
523
|
isPep695Syntax: boolean;
|
528
|
-
|
524
|
+
typeParams: TypeVarType[] | undefined;
|
525
|
+
}
|
526
|
+
export declare enum TypeVarKind {
|
527
|
+
TypeVar = 0,
|
528
|
+
TypeVarTuple = 1,
|
529
|
+
ParamSpec = 2
|
529
530
|
}
|
530
531
|
export interface TypeVarDetailsShared {
|
532
|
+
kind: TypeVarKind;
|
531
533
|
name: string;
|
532
534
|
constraints: Type[];
|
533
535
|
boundType: Type | undefined;
|
534
536
|
isDefaultExplicit: boolean;
|
535
537
|
defaultType: Type;
|
536
|
-
isParamSpec: boolean;
|
537
|
-
isVariadic: boolean;
|
538
538
|
declaredVariance: Variance;
|
539
539
|
isSynthesized: boolean;
|
540
540
|
isSynthesizedSelf: boolean;
|
@@ -549,45 +549,70 @@ export declare const enum TypeVarScopeType {
|
|
549
549
|
Function = 1,
|
550
550
|
TypeAlias = 2
|
551
551
|
}
|
552
|
-
export interface
|
552
|
+
export interface TypeVarDetailsPriv {
|
553
553
|
scopeId?: TypeVarScopeId | undefined;
|
554
554
|
scopeName?: string | undefined;
|
555
555
|
scopeType?: TypeVarScopeType;
|
556
556
|
nameWithScope?: string | undefined;
|
557
|
-
isVariadicUnpacked?: boolean | undefined;
|
558
|
-
isVariadicInUnion?: boolean | undefined;
|
559
|
-
paramSpecAccess?: ParamSpecAccess;
|
560
557
|
computedVariance?: Variance;
|
561
|
-
|
562
|
-
|
558
|
+
isUnificationVar?: boolean;
|
559
|
+
freeTypeVar?: TypeVarType | undefined;
|
563
560
|
}
|
564
561
|
export interface TypeVarType extends TypeBase<TypeCategory.TypeVar> {
|
565
562
|
shared: TypeVarDetailsShared;
|
566
|
-
priv:
|
563
|
+
priv: TypeVarDetailsPriv;
|
564
|
+
}
|
565
|
+
export interface ParamSpecDetailsPriv extends TypeVarDetailsPriv {
|
566
|
+
paramSpecAccess?: ParamSpecAccess;
|
567
|
+
freeTypeVar?: ParamSpecType | undefined;
|
568
|
+
}
|
569
|
+
export interface ParamSpecType extends TypeVarType {
|
570
|
+
shared: TypeVarDetailsShared & {
|
571
|
+
kind: TypeVarKind.ParamSpec;
|
572
|
+
};
|
573
|
+
priv: ParamSpecDetailsPriv;
|
574
|
+
}
|
575
|
+
export declare namespace ParamSpecType {
|
576
|
+
function getUnknown(): FunctionType;
|
577
|
+
}
|
578
|
+
export interface TypeVarTupleDetailsPriv extends TypeVarDetailsPriv {
|
579
|
+
isUnpacked?: boolean | undefined;
|
580
|
+
isInUnion?: boolean | undefined;
|
581
|
+
freeTypeVar?: TypeVarTupleType | undefined;
|
582
|
+
}
|
583
|
+
export interface TypeVarTupleType extends TypeVarType {
|
584
|
+
shared: TypeVarDetailsShared & {
|
585
|
+
kind: TypeVarKind.TypeVarTuple;
|
586
|
+
};
|
587
|
+
priv: TypeVarTupleDetailsPriv;
|
567
588
|
}
|
568
589
|
export declare namespace TypeVarType {
|
569
|
-
function createInstance(name: string): TypeVarType;
|
570
|
-
function createInstantiable(name: string,
|
590
|
+
function createInstance(name: string, kind?: TypeVarKind): TypeVarType;
|
591
|
+
function createInstantiable(name: string, kind?: TypeVarKind): TypeVarType;
|
571
592
|
function cloneAsInstance(type: TypeVarType): TypeVarType;
|
572
593
|
function cloneAsInstantiable(type: TypeVarType): TypeVarType;
|
573
594
|
function cloneForNewName(type: TypeVarType, name: string): TypeVarType;
|
574
595
|
function cloneForScopeId(type: TypeVarType, scopeId: string, scopeName: string | undefined, scopeType: TypeVarScopeType | undefined): TypeVarType;
|
575
|
-
function cloneForUnpacked(type:
|
576
|
-
function cloneForPacked(type:
|
596
|
+
function cloneForUnpacked(type: TypeVarTupleType, isInUnion?: boolean): TypeVarTupleType;
|
597
|
+
function cloneForPacked(type: TypeVarTupleType): TypeVarTupleType;
|
577
598
|
function cloneAsInvariant(type: TypeVarType): TypeVarType;
|
578
|
-
function cloneForParamSpecAccess(type:
|
599
|
+
function cloneForParamSpecAccess(type: ParamSpecType, access: ParamSpecAccess | undefined): ParamSpecType;
|
579
600
|
function cloneAsSpecializedSelf(type: TypeVarType, specializedBoundType: Type): TypeVarType;
|
580
|
-
function
|
601
|
+
function cloneAsUnificationVar(type: TypeVarType, usageOffset?: number): TypeVarType;
|
581
602
|
function makeNameWithScope(name: string, scopeId: string): string;
|
582
|
-
function
|
583
|
-
function
|
584
|
-
function
|
585
|
-
function
|
603
|
+
function makeBoundScopeId(scopeId: TypeVarScopeId): TypeVarScopeId;
|
604
|
+
function makeBoundScopeId(scopeId: TypeVarScopeId | undefined): TypeVarScopeId | undefined;
|
605
|
+
function cloneAsBound(type: TypeVarType): TypeVarType;
|
606
|
+
function isBound(type: TypeVarType): boolean;
|
607
|
+
function isUnification(type: TypeVarType): boolean | undefined;
|
586
608
|
function addConstraint(type: TypeVarType, constraintType: Type): void;
|
587
609
|
function getNameWithScope(typeVarType: TypeVarType): string;
|
588
610
|
function getReadableName(type: TypeVarType): string;
|
589
611
|
function getVariance(type: TypeVarType): Variance.Invariant | Variance.Covariant | Variance.Contravariant;
|
590
612
|
function isTypeAliasPlaceholder(type: TypeVarType): boolean;
|
613
|
+
function isSelf(type: TypeVarType): boolean;
|
614
|
+
function hasConstraints(type: TypeVarType): boolean;
|
615
|
+
function hasBound(type: TypeVarType): boolean;
|
591
616
|
}
|
592
617
|
export declare function isNever(type: Type): type is NeverType;
|
593
618
|
export declare function isAny(type: Type): type is AnyType;
|
@@ -601,11 +626,11 @@ export declare function isInstantiableClass(type: Type): type is ClassType;
|
|
601
626
|
export declare function isClassInstance(type: Type): type is ClassType;
|
602
627
|
export declare function isModule(type: Type): type is ModuleType;
|
603
628
|
export declare function isTypeVar(type: Type): type is TypeVarType;
|
604
|
-
export declare function
|
605
|
-
export declare function
|
629
|
+
export declare function isParamSpec(type: Type): type is ParamSpecType;
|
630
|
+
export declare function isTypeVarTuple(type: Type): type is TypeVarTupleType;
|
631
|
+
export declare function isUnpackedTypeVarTuple(type: Type): type is TypeVarTupleType;
|
606
632
|
export declare function isUnpackedClass(type: Type): type is ClassType;
|
607
633
|
export declare function isUnpacked(type: Type): boolean;
|
608
|
-
export declare function isParamSpec(type: Type): type is TypeVarType;
|
609
634
|
export declare function isFunction(type: Type): type is FunctionType;
|
610
635
|
export declare function isOverloadedFunction(type: Type): type is OverloadedFunctionType;
|
611
636
|
export declare function getTypeAliasInfo(type: Type): TypeAliasInfo | undefined;
|