@zzzen/pyright-internal 1.2.0-dev.20240707 → 1.2.0-dev.20240721
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 +74 -46
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/binder.js +506 -512
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +672 -655
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +5 -3
- package/dist/analyzer/codeFlowEngine.js +112 -103
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowTypes.js +30 -28
- package/dist/analyzer/codeFlowTypes.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +70 -66
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructorTransform.d.ts +1 -2
- package/dist/analyzer/constructorTransform.js +26 -27
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/constructors.d.ts +2 -2
- package/dist/analyzer/constructors.js +95 -190
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +110 -179
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declarationUtils.js +14 -15
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.js +78 -79
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/enums.js +70 -56
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/functionTransform.js +8 -18
- package/dist/analyzer/functionTransform.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +2 -1
- package/dist/analyzer/importResolver.js +40 -29
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importStatementUtils.js +27 -27
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +33 -59
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +194 -145
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +66 -62
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parameterUtils.d.ts +4 -4
- package/dist/analyzer/parameterUtils.js +30 -47
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -0
- package/dist/analyzer/parseTreeUtils.js +294 -272
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.js +76 -76
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/patternMatching.js +178 -145
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.js +1 -1
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +82 -147
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +29 -25
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/sourceFile.js +3 -3
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceMapper.js +20 -19
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/staticExpressions.js +83 -84
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/testWalker.js +15 -3
- package/dist/analyzer/testWalker.js.map +1 -1
- package/dist/analyzer/tracePrinter.js +20 -20
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +25 -25
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +2443 -2350
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +13 -9
- package/dist/analyzer/typeEvaluatorTypes.js +7 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +212 -215
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.js +118 -115
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js +104 -103
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +30 -15
- package/dist/analyzer/typeUtils.js +534 -436
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.js +8 -8
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typeWalker.js +13 -10
- package/dist/analyzer/typeWalker.js.map +1 -1
- package/dist/analyzer/typedDicts.js +97 -199
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +152 -106
- package/dist/analyzer/types.js +695 -496
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +34 -34
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/fileSystem.d.ts +1 -0
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/fullAccessHost.js +6 -4
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/realFileSystem.d.ts +1 -0
- package/dist/common/realFileSystem.js +4 -0
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/textEditTracker.js +14 -14
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/languageService/autoImporter.js +10 -10
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +23 -23
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +153 -151
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +1 -1
- package/dist/languageService/definitionProvider.js +3 -1
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js +19 -19
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/hoverProvider.js +36 -27
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importSorter.js +8 -8
- package/dist/languageService/importSorter.js.map +1 -1
- package/dist/languageService/referencesProvider.d.ts +10 -4
- package/dist/languageService/referencesProvider.js +30 -18
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/renameProvider.js +21 -4
- package/dist/languageService/renameProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.d.ts +1 -1
- package/dist/languageService/signatureHelpProvider.js +6 -6
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.js +3 -3
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +13 -13
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/localization/localize.d.ts +4 -3
- package/dist/localization/localize.js +2 -1
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +0 -1
- package/dist/localization/package.nls.de.json +0 -1
- package/dist/localization/package.nls.en-us.json +2 -1
- package/dist/localization/package.nls.es.json +0 -1
- package/dist/localization/package.nls.fr.json +0 -1
- package/dist/localization/package.nls.it.json +0 -1
- package/dist/localization/package.nls.ja.json +0 -1
- package/dist/localization/package.nls.ko.json +0 -1
- package/dist/localization/package.nls.pl.json +0 -1
- package/dist/localization/package.nls.pt-br.json +0 -1
- package/dist/localization/package.nls.qps-ploc.json +0 -1
- package/dist/localization/package.nls.ru.json +0 -1
- package/dist/localization/package.nls.tr.json +0 -1
- package/dist/localization/package.nls.zh-cn.json +0 -1
- package/dist/localization/package.nls.zh-tw.json +0 -1
- package/dist/parser/parseNodes.d.ts +471 -402
- package/dist/parser/parseNodes.js +629 -356
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.d.ts +1 -0
- package/dist/parser/parser.js +345 -300
- package/dist/parser/parser.js.map +1 -1
- package/dist/tests/classDeclaration.test.js +14 -14
- package/dist/tests/classDeclaration.test.js.map +1 -1
- package/dist/tests/fourslash/rename.args.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.args.fourslash.js +71 -0
- package/dist/tests/fourslash/rename.args.fourslash.js.map +1 -0
- package/dist/tests/harness/vfs/filesystem.d.ts +3 -2
- package/dist/tests/harness/vfs/filesystem.js +6 -2
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/importResolver.test.js +4 -3
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +5 -5
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/parser.test.js +8 -8
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +7 -7
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +17 -0
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +4 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +8 -3
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +10 -6
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator6.test.js +6 -2
- package/dist/tests/typeEvaluator6.test.js.map +1 -1
- package/dist/tests/typeEvaluator7.test.js +7 -3
- package/dist/tests/typeEvaluator7.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js +14 -39
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/package.json +1 -1
package/dist/analyzer/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Uri } from '../common/uri/uri';
|
2
|
-
import { ArgumentNode,
|
2
|
+
import { ArgumentNode, NameNode, ParameterCategory } 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 {
|
@@ -17,7 +17,9 @@ export declare const enum TypeCategory {
|
|
17
17
|
export declare const enum TypeFlags {
|
18
18
|
None = 0,
|
19
19
|
Instantiable = 1,
|
20
|
-
Instance = 2
|
20
|
+
Instance = 2,
|
21
|
+
Ambiguous = 4,
|
22
|
+
TypeCompatibilityMask = 3
|
21
23
|
}
|
22
24
|
export type UnionableType = UnboundType | UnknownType | AnyType | FunctionType | OverloadedFunctionType | ClassType | ModuleType | TypeVarType;
|
23
25
|
export type Type = UnionableType | NeverType | UnionType;
|
@@ -49,64 +51,77 @@ export interface TypeAliasInfo {
|
|
49
51
|
fileUri: Uri;
|
50
52
|
typeVarScopeId: TypeVarScopeId;
|
51
53
|
isPep695Syntax: boolean;
|
52
|
-
typeParameters
|
53
|
-
usageVariance
|
54
|
-
typeArguments
|
55
|
-
}
|
56
|
-
interface
|
57
|
-
|
54
|
+
typeParameters: TypeVarType[] | undefined;
|
55
|
+
usageVariance: Variance[] | undefined;
|
56
|
+
typeArguments: Type[] | undefined;
|
57
|
+
}
|
58
|
+
interface CachedTypeInfo {
|
59
|
+
instantiableType?: Type;
|
60
|
+
instanceType?: Type;
|
61
|
+
typeBaseInstantiableType?: Type;
|
62
|
+
typeBaseInstanceType?: Type;
|
63
|
+
requiresSpecialization?: boolean;
|
64
|
+
}
|
65
|
+
export interface TypeBaseProps {
|
66
|
+
instantiableDepth: number | undefined;
|
67
|
+
specialForm: ClassType | undefined;
|
68
|
+
typeAliasInfo: TypeAliasInfo | undefined;
|
69
|
+
condition: TypeCondition[] | undefined;
|
70
|
+
}
|
71
|
+
export interface TypeBase<T extends TypeCategory> {
|
72
|
+
category: T;
|
58
73
|
flags: TypeFlags;
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
isAmbiguous?: boolean;
|
64
|
-
cached?: {
|
65
|
-
instantiableType?: Type;
|
66
|
-
instanceType?: Type;
|
67
|
-
typeBaseInstantiableType?: Type;
|
68
|
-
typeBaseInstanceType?: Type;
|
69
|
-
requiresSpecialization?: boolean;
|
70
|
-
};
|
74
|
+
props: TypeBaseProps | undefined;
|
75
|
+
cached: CachedTypeInfo | undefined;
|
76
|
+
shared: object | undefined;
|
77
|
+
priv: object | undefined;
|
71
78
|
}
|
72
79
|
export declare namespace TypeBase {
|
73
|
-
function isInstantiable(type: TypeBase): boolean;
|
74
|
-
function isInstance(type: TypeBase): boolean;
|
75
|
-
function isAmbiguous(type: TypeBase): boolean;
|
76
|
-
function
|
77
|
-
function
|
80
|
+
function isInstantiable(type: TypeBase<any>): boolean;
|
81
|
+
function isInstance(type: TypeBase<any>): boolean;
|
82
|
+
function isAmbiguous(type: TypeBase<any>): boolean;
|
83
|
+
function addProps(type: TypeBase<any>): TypeBaseProps;
|
84
|
+
function setSpecialForm(type: TypeBase<any>, specialForm: ClassType | undefined): void;
|
85
|
+
function setInstantiableDepth(type: TypeBase<any>, depth: number | undefined): void;
|
86
|
+
function setTypeAliasInfo(type: TypeBase<any>, typeAliasInfo: TypeAliasInfo | undefined): void;
|
87
|
+
function setCondition(type: TypeBase<any>, condition: TypeCondition[] | undefined): void;
|
88
|
+
function cloneType<T extends TypeBase<any>>(type: T): T;
|
89
|
+
function cloneAsSpecialForm<T extends TypeBase<any>>(type: T, specialForm: ClassType | undefined): T;
|
78
90
|
function cloneTypeAsInstance<T extends Type>(type: T, cache: boolean): T;
|
79
91
|
function cloneTypeAsInstantiable<T extends Type>(type: T, cache: boolean): T;
|
80
92
|
function cloneForTypeAlias(type: Type, name: string, fullName: string, moduleName: string, fileUri: Uri, typeVarScopeId: TypeVarScopeId, isPep695Syntax: boolean, typeParams?: TypeVarType[], typeArgs?: Type[]): Type;
|
81
93
|
function cloneForCondition<T extends Type>(type: T, condition: TypeCondition[] | undefined): T;
|
82
94
|
function cloneForAmbiguousType(type: Type): Type;
|
83
95
|
}
|
84
|
-
export interface UnboundType extends TypeBase {
|
85
|
-
category: TypeCategory.Unbound;
|
96
|
+
export interface UnboundType extends TypeBase<TypeCategory.Unbound> {
|
86
97
|
}
|
87
98
|
export declare namespace UnboundType {
|
88
99
|
function create(): UnboundType;
|
89
100
|
function convertToInstance(type: UnboundType): UnboundType;
|
90
101
|
}
|
91
|
-
export interface
|
92
|
-
category: TypeCategory.Unknown;
|
102
|
+
export interface UnknownTypeDetailsPriv {
|
93
103
|
isIncomplete: boolean;
|
94
|
-
possibleType
|
104
|
+
possibleType: Type | undefined;
|
105
|
+
}
|
106
|
+
export interface UnknownType extends TypeBase<TypeCategory.Unknown> {
|
107
|
+
priv: UnknownTypeDetailsPriv;
|
95
108
|
}
|
96
109
|
export declare namespace UnknownType {
|
97
110
|
function create(isIncomplete?: boolean): UnknownType;
|
98
111
|
function createPossibleType(possibleType: Type, isIncomplete: boolean): UnknownType;
|
99
112
|
function convertToInstance(type: UnknownType): UnknownType;
|
100
113
|
}
|
101
|
-
export interface
|
102
|
-
category: TypeCategory.Module;
|
114
|
+
export interface ModuleTypeDetailsPriv {
|
103
115
|
fields: SymbolTable;
|
104
|
-
docString
|
105
|
-
notPresentFieldType
|
116
|
+
docString: string | undefined;
|
117
|
+
notPresentFieldType: AnyType | UnknownType | undefined;
|
106
118
|
loaderFields: SymbolTable;
|
107
119
|
moduleName: string;
|
108
120
|
fileUri: Uri;
|
109
121
|
}
|
122
|
+
export interface ModuleType extends TypeBase<TypeCategory.Module> {
|
123
|
+
priv: ModuleTypeDetailsPriv;
|
124
|
+
}
|
110
125
|
export declare namespace ModuleType {
|
111
126
|
function create(moduleName: string, fileUri: Uri, symbolTable?: SymbolTable): ModuleType;
|
112
127
|
function getField(moduleType: ModuleType, name: string): Symbol | undefined;
|
@@ -119,7 +134,6 @@ export interface DataClassEntry {
|
|
119
134
|
alias?: string | undefined;
|
120
135
|
hasDefault?: boolean | undefined;
|
121
136
|
nameNode: NameNode | undefined;
|
122
|
-
defaultValueExpression?: ExpressionNode | undefined;
|
123
137
|
includeInInit: boolean;
|
124
138
|
type: Type;
|
125
139
|
converter?: ArgumentNode | undefined;
|
@@ -136,7 +150,7 @@ export interface TypedDictEntries {
|
|
136
150
|
}
|
137
151
|
export declare const enum ClassTypeFlags {
|
138
152
|
None = 0,
|
139
|
-
|
153
|
+
BuiltIn = 1,
|
140
154
|
SpecialBuiltIn = 2,
|
141
155
|
TypedDictClass = 4,
|
142
156
|
TypedDictMarkedClosed = 8,
|
@@ -173,7 +187,7 @@ export interface DataClassBehaviors {
|
|
173
187
|
frozenDefault?: boolean;
|
174
188
|
fieldDescriptorNames: string[];
|
175
189
|
}
|
176
|
-
interface
|
190
|
+
interface ClassDetailsShared {
|
177
191
|
name: string;
|
178
192
|
fullName: string;
|
179
193
|
moduleName: string;
|
@@ -211,9 +225,7 @@ export interface PropertyMethodInfo {
|
|
211
225
|
methodType: FunctionType;
|
212
226
|
classType: ClassType | undefined;
|
213
227
|
}
|
214
|
-
export interface
|
215
|
-
category: TypeCategory.Class;
|
216
|
-
details: ClassDetails;
|
228
|
+
export interface ClassDetailsPriv {
|
217
229
|
typeArguments?: Type[] | undefined;
|
218
230
|
typeGuardType?: Type | undefined;
|
219
231
|
isStrictTypeGuard?: boolean;
|
@@ -234,6 +246,10 @@ export interface ClassType extends TypeBase {
|
|
234
246
|
fdelInfo?: PropertyMethodInfo | undefined;
|
235
247
|
deprecatedInstanceMessage?: string | undefined;
|
236
248
|
}
|
249
|
+
export interface ClassType extends TypeBase<TypeCategory.Class> {
|
250
|
+
shared: ClassDetailsShared;
|
251
|
+
priv: ClassDetailsPriv;
|
252
|
+
}
|
237
253
|
export declare namespace ClassType {
|
238
254
|
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;
|
239
255
|
function cloneAsInstance(type: ClassType, includeSubclasses?: boolean): ClassType;
|
@@ -297,20 +313,27 @@ export declare namespace ClassType {
|
|
297
313
|
function isDerivedFrom(subclassType: ClassType, parentClassType: ClassType, inheritanceChain?: InheritanceChain): boolean;
|
298
314
|
function getReverseMro(classType: ClassType): (ClassType | UnknownType | AnyType)[];
|
299
315
|
}
|
300
|
-
export
|
316
|
+
export declare enum FunctionParamFlags {
|
317
|
+
None = 0,
|
318
|
+
NameSynthesized = 1,
|
319
|
+
TypeDeclared = 2,
|
320
|
+
TypeInferred = 4
|
321
|
+
}
|
322
|
+
export interface FunctionParam {
|
301
323
|
category: ParameterCategory;
|
302
|
-
name?: string | undefined;
|
303
|
-
isNameSynthesized?: boolean;
|
304
|
-
hasDefault?: boolean | undefined;
|
305
|
-
defaultValueExpression?: ExpressionNode | undefined;
|
306
324
|
type: Type;
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
325
|
+
flags: FunctionParamFlags;
|
326
|
+
name: string | undefined;
|
327
|
+
defaultType: Type | undefined;
|
328
|
+
}
|
329
|
+
export declare namespace FunctionParam {
|
330
|
+
function create(category: ParameterCategory, type: Type, flags?: FunctionParamFlags, name?: string, defaultType?: Type): FunctionParam;
|
331
|
+
function isNameSynthesized(param: FunctionParam): boolean;
|
332
|
+
function isTypeDeclared(param: FunctionParam): boolean;
|
333
|
+
function isTypeInferred(param: FunctionParam): boolean;
|
334
|
+
}
|
335
|
+
export declare function isPositionOnlySeparator(param: FunctionParam): boolean;
|
336
|
+
export declare function isKeywordOnlySeparator(param: FunctionParam): boolean;
|
314
337
|
export declare const enum FunctionTypeFlags {
|
315
338
|
None = 0,
|
316
339
|
ConstructorMethod = 1,
|
@@ -331,30 +354,28 @@ export declare const enum FunctionTypeFlags {
|
|
331
354
|
ParamSpecValue = 65536,
|
332
355
|
PartiallyEvaluated = 131072,
|
333
356
|
Overridden = 262144,
|
334
|
-
NoTypeCheck = 524288
|
357
|
+
NoTypeCheck = 524288,
|
358
|
+
BuiltIn = 1048576
|
335
359
|
}
|
336
|
-
interface
|
360
|
+
interface FunctionDetailsShared {
|
337
361
|
name: string;
|
338
362
|
fullName: string;
|
339
363
|
moduleName: string;
|
340
364
|
flags: FunctionTypeFlags;
|
341
365
|
typeParameters: TypeVarType[];
|
342
|
-
parameters:
|
343
|
-
declaredReturnType
|
344
|
-
declaration
|
345
|
-
typeVarScopeId
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
decoratorDataClassBehaviors?: DataClassBehaviors | undefined;
|
351
|
-
constructorTypeVarScopeId?: TypeVarScopeId | undefined;
|
352
|
-
higherOrderTypeVarScopeIds?: TypeVarScopeId[];
|
366
|
+
parameters: FunctionParam[];
|
367
|
+
declaredReturnType: Type | undefined;
|
368
|
+
declaration: FunctionDeclaration | undefined;
|
369
|
+
typeVarScopeId: TypeVarScopeId | undefined;
|
370
|
+
docString: string | undefined;
|
371
|
+
deprecatedMessage: string | undefined;
|
372
|
+
methodClass: ClassType | undefined;
|
373
|
+
decoratorDataClassBehaviors: DataClassBehaviors | undefined;
|
353
374
|
}
|
354
375
|
export interface SpecializedFunctionTypes {
|
355
376
|
parameterTypes: Type[];
|
356
|
-
parameterDefaultArgs
|
357
|
-
returnType
|
377
|
+
parameterDefaultArgs: (Type | undefined)[] | undefined;
|
378
|
+
returnType: Type | undefined;
|
358
379
|
}
|
359
380
|
export interface CallSiteInferenceTypeCacheEntry {
|
360
381
|
paramTypes: Type[];
|
@@ -364,20 +385,22 @@ export interface SignatureWithOffsets {
|
|
364
385
|
type: FunctionType | OverloadedFunctionType;
|
365
386
|
expressionOffsets: number[];
|
366
387
|
}
|
367
|
-
export interface
|
368
|
-
|
369
|
-
|
388
|
+
export interface FunctionDetailsPriv {
|
389
|
+
constructorTypeVarScopeId?: TypeVarScopeId | undefined;
|
390
|
+
higherOrderTypeVarScopeIds?: TypeVarScopeId[];
|
370
391
|
specializedTypes?: SpecializedFunctionTypes | undefined;
|
371
392
|
inferredReturnType?: Type | undefined;
|
372
393
|
callSiteReturnTypeCache?: CallSiteInferenceTypeCacheEntry[];
|
373
394
|
strippedFirstParamType?: Type | undefined;
|
374
395
|
boundToType?: ClassType | undefined;
|
375
396
|
preBoundFlags?: FunctionTypeFlags;
|
376
|
-
boundTypeVarScopeId?: TypeVarScopeId | undefined;
|
377
397
|
overloaded?: OverloadedFunctionType;
|
378
|
-
trackedSignatures?: SignatureWithOffsets[];
|
379
398
|
isCallableWithTypeArgs?: boolean;
|
380
399
|
}
|
400
|
+
export interface FunctionType extends TypeBase<TypeCategory.Function> {
|
401
|
+
shared: FunctionDetailsShared;
|
402
|
+
priv: FunctionDetailsPriv;
|
403
|
+
}
|
381
404
|
export declare namespace FunctionType {
|
382
405
|
function createInstance(name: string, fullName: string, moduleName: string, functionFlags: FunctionTypeFlags, docString?: string): FunctionType;
|
383
406
|
function createInstantiable(functionFlags: FunctionTypeFlags, docString?: string): FunctionType;
|
@@ -388,7 +411,7 @@ export declare namespace FunctionType {
|
|
388
411
|
function cloneForSpecialization(type: FunctionType, specializedTypes: SpecializedFunctionTypes, specializedInferredReturnType: Type | undefined): FunctionType;
|
389
412
|
function applyParamSpecValue(type: FunctionType, paramSpecValue: FunctionType): FunctionType;
|
390
413
|
function cloneWithNewFlags(type: FunctionType, flags: FunctionTypeFlags): FunctionType;
|
391
|
-
function cloneWithNewTypeVarScopeId(type: FunctionType, newScopeId: TypeVarScopeId,
|
414
|
+
function cloneWithNewTypeVarScopeId(type: FunctionType, newScopeId: TypeVarScopeId | undefined, newConstructorScopeId: TypeVarScopeId | undefined, typeParameters: TypeVarType[]): FunctionType;
|
392
415
|
function cloneWithDocString(type: FunctionType, docString?: string): FunctionType;
|
393
416
|
function cloneWithDeprecatedMessage(type: FunctionType, deprecatedMessage?: string): FunctionType;
|
394
417
|
function cloneRemoveParamSpecArgsKwargs(type: FunctionType, stripPositionOnlySeparator?: boolean): FunctionType;
|
@@ -396,7 +419,7 @@ export declare namespace FunctionType {
|
|
396
419
|
function addParamSpecVariadics(type: FunctionType, paramSpec: TypeVarType): void;
|
397
420
|
function addDefaultParameters(type: FunctionType, useUnknown?: boolean): void;
|
398
421
|
function addHigherOrderTypeVarScopeIds(functionType: FunctionType, scopeIds: (TypeVarScopeId | undefined)[] | TypeVarScopeId | undefined): void;
|
399
|
-
function getDefaultParameters(useUnknown?: boolean):
|
422
|
+
function getDefaultParameters(useUnknown?: boolean): FunctionParam[];
|
400
423
|
function hasDefaultParameters(functionType: FunctionType): boolean;
|
401
424
|
function isInstanceMethod(type: FunctionType): boolean;
|
402
425
|
function isConstructorMethod(type: FunctionType): boolean;
|
@@ -417,36 +440,43 @@ export declare namespace FunctionType {
|
|
417
440
|
function isParamSpecValue(type: FunctionType): boolean;
|
418
441
|
function isPartiallyEvaluated(type: FunctionType): boolean;
|
419
442
|
function isOverridden(type: FunctionType): boolean;
|
443
|
+
function isBuiltIn(type: FunctionType, name?: string | string[]): boolean;
|
420
444
|
function getEffectiveParameterType(type: FunctionType, index: number): Type;
|
421
445
|
function getEffectiveParameterDefaultArgType(type: FunctionType, index: number): Type | undefined;
|
422
|
-
function addParameter(type: FunctionType, param:
|
446
|
+
function addParameter(type: FunctionType, param: FunctionParam): void;
|
423
447
|
function addPositionOnlyParameterSeparator(type: FunctionType): void;
|
424
448
|
function addKeywordOnlyParameterSeparator(type: FunctionType): void;
|
425
449
|
function getEffectiveReturnType(type: FunctionType, includeInferred?: boolean): Type | undefined;
|
426
450
|
}
|
427
|
-
export interface
|
428
|
-
category: TypeCategory.OverloadedFunction;
|
451
|
+
export interface OverloadedFunctionTypeDetailsPriv {
|
429
452
|
overloads: FunctionType[];
|
430
453
|
}
|
454
|
+
export interface OverloadedFunctionType extends TypeBase<TypeCategory.OverloadedFunction> {
|
455
|
+
priv: OverloadedFunctionTypeDetailsPriv;
|
456
|
+
}
|
431
457
|
export declare namespace OverloadedFunctionType {
|
432
458
|
function create(overloads: FunctionType[]): OverloadedFunctionType;
|
433
459
|
function addOverload(type: OverloadedFunctionType, functionType: FunctionType): void;
|
434
460
|
function getOverloads(type: OverloadedFunctionType): FunctionType[];
|
435
461
|
function getImplementation(type: OverloadedFunctionType): FunctionType | undefined;
|
436
462
|
}
|
437
|
-
export interface
|
438
|
-
category: TypeCategory.Never;
|
463
|
+
export interface NeverTypeDetailsPriv {
|
439
464
|
isNoReturn: boolean;
|
440
465
|
}
|
466
|
+
export interface NeverType extends TypeBase<TypeCategory.Never> {
|
467
|
+
priv: NeverTypeDetailsPriv;
|
468
|
+
}
|
441
469
|
export declare namespace NeverType {
|
442
470
|
function createNever(): NeverType;
|
443
471
|
function createNoReturn(): NeverType;
|
444
472
|
function convertToInstance(type: NeverType): NeverType;
|
445
473
|
}
|
446
|
-
export interface
|
447
|
-
category: TypeCategory.Any;
|
474
|
+
export interface AnyTypeDetailsPriv {
|
448
475
|
isEllipsis: boolean;
|
449
476
|
}
|
477
|
+
export interface AnyType extends TypeBase<TypeCategory.Any> {
|
478
|
+
priv: AnyTypeDetailsPriv;
|
479
|
+
}
|
450
480
|
export declare namespace AnyType {
|
451
481
|
function create(isEllipsis?: boolean): AnyType;
|
452
482
|
function createSpecialForm(): AnyType;
|
@@ -464,17 +494,19 @@ export declare namespace TypeCondition {
|
|
464
494
|
function isCompatible(conditions1: TypeCondition[] | undefined, conditions2: TypeCondition[] | undefined): boolean;
|
465
495
|
}
|
466
496
|
export interface LiteralTypes {
|
467
|
-
literalStrMap
|
468
|
-
literalIntMap
|
469
|
-
literalEnumMap
|
497
|
+
literalStrMap: Map<string, UnionableType> | undefined;
|
498
|
+
literalIntMap: Map<bigint | number, UnionableType> | undefined;
|
499
|
+
literalEnumMap: Map<string, UnionableType> | undefined;
|
470
500
|
}
|
471
|
-
export interface
|
472
|
-
category: TypeCategory.Union;
|
501
|
+
export interface UnionTypeDetailsPriv {
|
473
502
|
subtypes: UnionableType[];
|
474
503
|
literalInstances: LiteralTypes;
|
475
504
|
literalClasses: LiteralTypes;
|
476
|
-
typeAliasSources
|
477
|
-
includesRecursiveTypeAlias
|
505
|
+
typeAliasSources: Set<UnionType> | undefined;
|
506
|
+
includesRecursiveTypeAlias: boolean;
|
507
|
+
}
|
508
|
+
export interface UnionType extends TypeBase<TypeCategory.Union> {
|
509
|
+
priv: UnionTypeDetailsPriv;
|
478
510
|
}
|
479
511
|
export declare namespace UnionType {
|
480
512
|
function create(): UnionType;
|
@@ -489,24 +521,27 @@ export declare const enum Variance {
|
|
489
521
|
Covariant = 3,
|
490
522
|
Contravariant = 4
|
491
523
|
}
|
492
|
-
export interface
|
524
|
+
export interface RecursiveAliasInfo {
|
525
|
+
name: string;
|
526
|
+
scopeId: TypeVarScopeId;
|
527
|
+
isPep695Syntax: boolean;
|
528
|
+
typeParameters: TypeVarType[] | undefined;
|
529
|
+
}
|
530
|
+
export interface TypeVarDetailsShared {
|
493
531
|
name: string;
|
494
532
|
constraints: Type[];
|
495
|
-
boundType
|
496
|
-
isDefaultExplicit
|
533
|
+
boundType: Type | undefined;
|
534
|
+
isDefaultExplicit: boolean;
|
497
535
|
defaultType: Type;
|
498
536
|
isParamSpec: boolean;
|
499
537
|
isVariadic: boolean;
|
500
538
|
declaredVariance: Variance;
|
501
539
|
isSynthesized: boolean;
|
502
|
-
isSynthesizedSelf
|
503
|
-
synthesizedIndex
|
504
|
-
isExemptFromBoundCheck
|
505
|
-
isTypeParamSyntax
|
506
|
-
|
507
|
-
recursiveTypeAliasScopeId?: TypeVarScopeId | undefined;
|
508
|
-
recursiveTypeAliasIsPep695Syntax?: boolean;
|
509
|
-
recursiveTypeParameters?: TypeVarType[] | undefined;
|
540
|
+
isSynthesizedSelf: boolean;
|
541
|
+
synthesizedIndex: number | undefined;
|
542
|
+
isExemptFromBoundCheck: boolean;
|
543
|
+
isTypeParamSyntax: boolean;
|
544
|
+
recursiveAlias: RecursiveAliasInfo | undefined;
|
510
545
|
}
|
511
546
|
export type ParamSpecAccess = 'args' | 'kwargs';
|
512
547
|
export declare const enum TypeVarScopeType {
|
@@ -514,9 +549,7 @@ export declare const enum TypeVarScopeType {
|
|
514
549
|
Function = 1,
|
515
550
|
TypeAlias = 2
|
516
551
|
}
|
517
|
-
export interface
|
518
|
-
category: TypeCategory.TypeVar;
|
519
|
-
details: TypeVarDetails;
|
552
|
+
export interface TypeVarTypeDetailsPriv {
|
520
553
|
scopeId?: TypeVarScopeId | undefined;
|
521
554
|
scopeName?: string | undefined;
|
522
555
|
scopeType?: TypeVarScopeType;
|
@@ -526,6 +559,11 @@ export interface TypeVarType extends TypeBase {
|
|
526
559
|
paramSpecAccess?: ParamSpecAccess;
|
527
560
|
computedVariance?: Variance;
|
528
561
|
isInScopePlaceholder?: boolean;
|
562
|
+
externalTypeVar?: TypeVarType | undefined;
|
563
|
+
}
|
564
|
+
export interface TypeVarType extends TypeBase<TypeCategory.TypeVar> {
|
565
|
+
shared: TypeVarDetailsShared;
|
566
|
+
priv: TypeVarTypeDetailsPriv;
|
529
567
|
}
|
530
568
|
export declare namespace TypeVarType {
|
531
569
|
function createInstance(name: string): TypeVarType;
|
@@ -533,7 +571,7 @@ export declare namespace TypeVarType {
|
|
533
571
|
function cloneAsInstance(type: TypeVarType): TypeVarType;
|
534
572
|
function cloneAsInstantiable(type: TypeVarType): TypeVarType;
|
535
573
|
function cloneForNewName(type: TypeVarType, name: string): TypeVarType;
|
536
|
-
function cloneForScopeId(type: TypeVarType, scopeId: string, scopeName: string, scopeType: TypeVarScopeType): TypeVarType;
|
574
|
+
function cloneForScopeId(type: TypeVarType, scopeId: string, scopeName: string | undefined, scopeType: TypeVarScopeType | undefined): TypeVarType;
|
537
575
|
function cloneForUnpacked(type: TypeVarType, isInUnion?: boolean): TypeVarType;
|
538
576
|
function cloneForPacked(type: TypeVarType): TypeVarType;
|
539
577
|
function cloneAsInvariant(type: TypeVarType): TypeVarType;
|
@@ -541,9 +579,13 @@ export declare namespace TypeVarType {
|
|
541
579
|
function cloneAsSpecializedSelf(type: TypeVarType, specializedBoundType: Type): TypeVarType;
|
542
580
|
function cloneAsInScopePlaceholder(type: TypeVarType, usageOffset?: number): TypeVarType;
|
543
581
|
function makeNameWithScope(name: string, scopeId: string): string;
|
544
|
-
function
|
582
|
+
function makeInternalScopeId(scopeId: TypeVarScopeId): TypeVarScopeId;
|
583
|
+
function makeInternalScopeId(scopeId: TypeVarScopeId | undefined): TypeVarScopeId | undefined;
|
584
|
+
function cloneWithInternalScopeId(type: TypeVarType): TypeVarType;
|
585
|
+
function hasInternalScopeId(type: TypeVarType): boolean;
|
586
|
+
function addConstraint(type: TypeVarType, constraintType: Type): void;
|
545
587
|
function getNameWithScope(typeVarType: TypeVarType): string;
|
546
|
-
function getReadableName(
|
588
|
+
function getReadableName(type: TypeVarType): string;
|
547
589
|
function getVariance(type: TypeVarType): Variance.Invariant | Variance.Covariant | Variance.Contravariant;
|
548
590
|
function isTypeAliasPlaceholder(type: TypeVarType): boolean;
|
549
591
|
}
|
@@ -572,6 +614,10 @@ export declare function removeUnknownFromUnion(type: Type): Type;
|
|
572
614
|
export declare function removeUnbound(type: Type): Type;
|
573
615
|
export declare function removeFromUnion(type: Type, removeFilter: (type: Type) => boolean): Type;
|
574
616
|
export declare function findSubtype(type: Type, filter: (type: UnionableType | NeverType) => boolean): UnionableType | NeverType | undefined;
|
575
|
-
export
|
617
|
+
export interface CombineTypesOptions {
|
618
|
+
skipElideRedundantLiterals?: boolean;
|
619
|
+
maxSubtypeCount?: number;
|
620
|
+
}
|
621
|
+
export declare function combineTypes(subtypes: Type[], options?: CombineTypesOptions): Type;
|
576
622
|
export declare function isSameWithoutLiteralValue(destType: Type, srcType: Type): boolean;
|
577
623
|
export {};
|