@zzzen/pyright-internal 1.2.0-dev.20240630 → 1.2.0-dev.20240714
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 +507 -513
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +652 -633
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +5 -3
- package/dist/analyzer/codeFlowEngine.js +143 -122
- 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.d.ts +1 -1
- package/dist/analyzer/constraintSolver.js +71 -67
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructorTransform.js +22 -22
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/constructors.js +85 -77
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +113 -176
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +1 -1
- package/dist/analyzer/declarationUtils.js +14 -15
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.js +85 -85
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/enums.js +71 -57
- 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.d.ts +4 -4
- package/dist/analyzer/operations.js +70 -70
- 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 +28 -46
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.js +268 -269
- 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 +195 -147
- 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 +78 -147
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +22 -22
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +3 -2
- package/dist/analyzer/sourceFile.js +8 -8
- 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 +2 -2
- 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 +2330 -2367
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +33 -31
- package/dist/analyzer/typeEvaluatorTypes.js +48 -41
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +221 -217
- 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 +26 -9
- package/dist/analyzer/typeUtils.js +460 -404
- 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 +96 -198
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +147 -103
- package/dist/analyzer/types.js +668 -493
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +33 -33
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/diagnostic.d.ts +14 -0
- package/dist/common/diagnostic.js +41 -1
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticSink.d.ts +4 -0
- package/dist/common/diagnosticSink.js +21 -1
- package/dist/common/diagnosticSink.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.d.ts +1 -1
- package/dist/languageService/completionProvider.js +156 -154
- 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 +25 -24
- 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.js +8 -8
- package/dist/languageService/referencesProvider.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 +3 -0
- package/dist/localization/localize.js +1 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +2 -1
- package/dist/parser/parseNodes.d.ts +468 -401
- package/dist/parser/parseNodes.js +626 -355
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.d.ts +1 -0
- package/dist/parser/parser.js +322 -297
- package/dist/parser/parser.js.map +1 -1
- package/dist/pyright.js +265 -5
- package/dist/pyright.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/hover.init.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
- 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/typeEvaluator2.test.js +2 -2
- package/dist/tests/typeEvaluator3.test.js +10 -5
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +1 -1
- package/dist/tests/typeEvaluator7.test.js +2 -2
- 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
|
+
interface TypeBaseProps {
|
66
|
+
instantiableDepth: number | undefined;
|
67
|
+
specialForm: ClassType | undefined;
|
68
|
+
typeAliasInfo: TypeAliasInfo | undefined;
|
69
|
+
condition: TypeCondition[] | undefined;
|
70
|
+
}
|
71
|
+
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,
|
@@ -159,7 +173,8 @@ export declare const enum ClassTypeFlags {
|
|
159
173
|
TypeCheckOnly = 1048576,
|
160
174
|
NewTypeClass = 2097152,
|
161
175
|
ValidTypeAliasClass = 4194304,
|
162
|
-
SpecialFormClass = 8388608
|
176
|
+
SpecialFormClass = 8388608,
|
177
|
+
IllegalIsinstanceClass = 16777216
|
163
178
|
}
|
164
179
|
export interface DataClassBehaviors {
|
165
180
|
skipGenerateInit?: boolean;
|
@@ -172,7 +187,7 @@ export interface DataClassBehaviors {
|
|
172
187
|
frozenDefault?: boolean;
|
173
188
|
fieldDescriptorNames: string[];
|
174
189
|
}
|
175
|
-
interface
|
190
|
+
interface ClassDetailsShared {
|
176
191
|
name: string;
|
177
192
|
fullName: string;
|
178
193
|
moduleName: string;
|
@@ -210,9 +225,7 @@ export interface PropertyMethodInfo {
|
|
210
225
|
methodType: FunctionType;
|
211
226
|
classType: ClassType | undefined;
|
212
227
|
}
|
213
|
-
export interface
|
214
|
-
category: TypeCategory.Class;
|
215
|
-
details: ClassDetails;
|
228
|
+
export interface ClassDetailsPriv {
|
216
229
|
typeArguments?: Type[] | undefined;
|
217
230
|
typeGuardType?: Type | undefined;
|
218
231
|
isStrictTypeGuard?: boolean;
|
@@ -233,6 +246,10 @@ export interface ClassType extends TypeBase {
|
|
233
246
|
fdelInfo?: PropertyMethodInfo | undefined;
|
234
247
|
deprecatedInstanceMessage?: string | undefined;
|
235
248
|
}
|
249
|
+
export interface ClassType extends TypeBase<TypeCategory.Class> {
|
250
|
+
shared: ClassDetailsShared;
|
251
|
+
priv: ClassDetailsPriv;
|
252
|
+
}
|
236
253
|
export declare namespace ClassType {
|
237
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;
|
238
255
|
function cloneAsInstance(type: ClassType, includeSubclasses?: boolean): ClassType;
|
@@ -268,6 +285,7 @@ export declare namespace ClassType {
|
|
268
285
|
function isNewTypeClass(classType: ClassType): boolean;
|
269
286
|
function isValidTypeAliasClass(classType: ClassType): boolean;
|
270
287
|
function isSpecialFormClass(classType: ClassType): boolean;
|
288
|
+
function isIllegalIsinstanceClass(classType: ClassType): boolean;
|
271
289
|
function isTypedDictClass(classType: ClassType): boolean;
|
272
290
|
function isCanOmitDictValues(classType: ClassType): boolean;
|
273
291
|
function isTypedDictMarkedClosed(classType: ClassType): boolean;
|
@@ -295,20 +313,27 @@ export declare namespace ClassType {
|
|
295
313
|
function isDerivedFrom(subclassType: ClassType, parentClassType: ClassType, inheritanceChain?: InheritanceChain): boolean;
|
296
314
|
function getReverseMro(classType: ClassType): (ClassType | UnknownType | AnyType)[];
|
297
315
|
}
|
298
|
-
export
|
316
|
+
export declare enum FunctionParamFlags {
|
317
|
+
None = 0,
|
318
|
+
NameSynthesized = 1,
|
319
|
+
TypeDeclared = 2,
|
320
|
+
TypeInferred = 4
|
321
|
+
}
|
322
|
+
export interface FunctionParam {
|
299
323
|
category: ParameterCategory;
|
300
|
-
name?: string | undefined;
|
301
|
-
isNameSynthesized?: boolean;
|
302
|
-
hasDefault?: boolean | undefined;
|
303
|
-
defaultValueExpression?: ExpressionNode | undefined;
|
304
324
|
type: Type;
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
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;
|
312
337
|
export declare const enum FunctionTypeFlags {
|
313
338
|
None = 0,
|
314
339
|
ConstructorMethod = 1,
|
@@ -329,30 +354,28 @@ export declare const enum FunctionTypeFlags {
|
|
329
354
|
ParamSpecValue = 65536,
|
330
355
|
PartiallyEvaluated = 131072,
|
331
356
|
Overridden = 262144,
|
332
|
-
NoTypeCheck = 524288
|
357
|
+
NoTypeCheck = 524288,
|
358
|
+
BuiltIn = 1048576
|
333
359
|
}
|
334
|
-
interface
|
360
|
+
interface FunctionDetailsShared {
|
335
361
|
name: string;
|
336
362
|
fullName: string;
|
337
363
|
moduleName: string;
|
338
364
|
flags: FunctionTypeFlags;
|
339
365
|
typeParameters: TypeVarType[];
|
340
|
-
parameters:
|
341
|
-
declaredReturnType
|
342
|
-
declaration
|
343
|
-
typeVarScopeId
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
decoratorDataClassBehaviors?: DataClassBehaviors | undefined;
|
349
|
-
constructorTypeVarScopeId?: TypeVarScopeId | undefined;
|
350
|
-
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;
|
351
374
|
}
|
352
375
|
export interface SpecializedFunctionTypes {
|
353
376
|
parameterTypes: Type[];
|
354
|
-
parameterDefaultArgs
|
355
|
-
returnType
|
377
|
+
parameterDefaultArgs: (Type | undefined)[] | undefined;
|
378
|
+
returnType: Type | undefined;
|
356
379
|
}
|
357
380
|
export interface CallSiteInferenceTypeCacheEntry {
|
358
381
|
paramTypes: Type[];
|
@@ -362,20 +385,23 @@ export interface SignatureWithOffsets {
|
|
362
385
|
type: FunctionType | OverloadedFunctionType;
|
363
386
|
expressionOffsets: number[];
|
364
387
|
}
|
365
|
-
export interface
|
366
|
-
|
367
|
-
|
388
|
+
export interface FunctionDetailsPriv {
|
389
|
+
constructorTypeVarScopeId?: TypeVarScopeId | undefined;
|
390
|
+
higherOrderTypeVarScopeIds?: TypeVarScopeId[];
|
368
391
|
specializedTypes?: SpecializedFunctionTypes | undefined;
|
369
392
|
inferredReturnType?: Type | undefined;
|
370
393
|
callSiteReturnTypeCache?: CallSiteInferenceTypeCacheEntry[];
|
371
394
|
strippedFirstParamType?: Type | undefined;
|
372
395
|
boundToType?: ClassType | undefined;
|
373
396
|
preBoundFlags?: FunctionTypeFlags;
|
374
|
-
boundTypeVarScopeId?: TypeVarScopeId | undefined;
|
375
397
|
overloaded?: OverloadedFunctionType;
|
376
398
|
trackedSignatures?: SignatureWithOffsets[];
|
377
399
|
isCallableWithTypeArgs?: boolean;
|
378
400
|
}
|
401
|
+
export interface FunctionType extends TypeBase<TypeCategory.Function> {
|
402
|
+
shared: FunctionDetailsShared;
|
403
|
+
priv: FunctionDetailsPriv;
|
404
|
+
}
|
379
405
|
export declare namespace FunctionType {
|
380
406
|
function createInstance(name: string, fullName: string, moduleName: string, functionFlags: FunctionTypeFlags, docString?: string): FunctionType;
|
381
407
|
function createInstantiable(functionFlags: FunctionTypeFlags, docString?: string): FunctionType;
|
@@ -386,7 +412,7 @@ export declare namespace FunctionType {
|
|
386
412
|
function cloneForSpecialization(type: FunctionType, specializedTypes: SpecializedFunctionTypes, specializedInferredReturnType: Type | undefined): FunctionType;
|
387
413
|
function applyParamSpecValue(type: FunctionType, paramSpecValue: FunctionType): FunctionType;
|
388
414
|
function cloneWithNewFlags(type: FunctionType, flags: FunctionTypeFlags): FunctionType;
|
389
|
-
function cloneWithNewTypeVarScopeId(type: FunctionType, newScopeId: TypeVarScopeId, typeParameters: TypeVarType[], trackedSignatures?: SignatureWithOffsets[]): FunctionType;
|
415
|
+
function cloneWithNewTypeVarScopeId(type: FunctionType, newScopeId: TypeVarScopeId, newConstructorScopeId: TypeVarScopeId | undefined, typeParameters: TypeVarType[], trackedSignatures?: SignatureWithOffsets[]): FunctionType;
|
390
416
|
function cloneWithDocString(type: FunctionType, docString?: string): FunctionType;
|
391
417
|
function cloneWithDeprecatedMessage(type: FunctionType, deprecatedMessage?: string): FunctionType;
|
392
418
|
function cloneRemoveParamSpecArgsKwargs(type: FunctionType, stripPositionOnlySeparator?: boolean): FunctionType;
|
@@ -394,7 +420,7 @@ export declare namespace FunctionType {
|
|
394
420
|
function addParamSpecVariadics(type: FunctionType, paramSpec: TypeVarType): void;
|
395
421
|
function addDefaultParameters(type: FunctionType, useUnknown?: boolean): void;
|
396
422
|
function addHigherOrderTypeVarScopeIds(functionType: FunctionType, scopeIds: (TypeVarScopeId | undefined)[] | TypeVarScopeId | undefined): void;
|
397
|
-
function getDefaultParameters(useUnknown?: boolean):
|
423
|
+
function getDefaultParameters(useUnknown?: boolean): FunctionParam[];
|
398
424
|
function hasDefaultParameters(functionType: FunctionType): boolean;
|
399
425
|
function isInstanceMethod(type: FunctionType): boolean;
|
400
426
|
function isConstructorMethod(type: FunctionType): boolean;
|
@@ -415,36 +441,43 @@ export declare namespace FunctionType {
|
|
415
441
|
function isParamSpecValue(type: FunctionType): boolean;
|
416
442
|
function isPartiallyEvaluated(type: FunctionType): boolean;
|
417
443
|
function isOverridden(type: FunctionType): boolean;
|
444
|
+
function isBuiltIn(type: FunctionType, name?: string | string[]): boolean;
|
418
445
|
function getEffectiveParameterType(type: FunctionType, index: number): Type;
|
419
446
|
function getEffectiveParameterDefaultArgType(type: FunctionType, index: number): Type | undefined;
|
420
|
-
function addParameter(type: FunctionType, param:
|
447
|
+
function addParameter(type: FunctionType, param: FunctionParam): void;
|
421
448
|
function addPositionOnlyParameterSeparator(type: FunctionType): void;
|
422
449
|
function addKeywordOnlyParameterSeparator(type: FunctionType): void;
|
423
450
|
function getEffectiveReturnType(type: FunctionType, includeInferred?: boolean): Type | undefined;
|
424
451
|
}
|
425
|
-
export interface
|
426
|
-
category: TypeCategory.OverloadedFunction;
|
452
|
+
export interface OverloadedFunctionTypeDetailsPriv {
|
427
453
|
overloads: FunctionType[];
|
428
454
|
}
|
455
|
+
export interface OverloadedFunctionType extends TypeBase<TypeCategory.OverloadedFunction> {
|
456
|
+
priv: OverloadedFunctionTypeDetailsPriv;
|
457
|
+
}
|
429
458
|
export declare namespace OverloadedFunctionType {
|
430
459
|
function create(overloads: FunctionType[]): OverloadedFunctionType;
|
431
460
|
function addOverload(type: OverloadedFunctionType, functionType: FunctionType): void;
|
432
461
|
function getOverloads(type: OverloadedFunctionType): FunctionType[];
|
433
462
|
function getImplementation(type: OverloadedFunctionType): FunctionType | undefined;
|
434
463
|
}
|
435
|
-
export interface
|
436
|
-
category: TypeCategory.Never;
|
464
|
+
export interface NeverTypeDetailsPriv {
|
437
465
|
isNoReturn: boolean;
|
438
466
|
}
|
467
|
+
export interface NeverType extends TypeBase<TypeCategory.Never> {
|
468
|
+
priv: NeverTypeDetailsPriv;
|
469
|
+
}
|
439
470
|
export declare namespace NeverType {
|
440
471
|
function createNever(): NeverType;
|
441
472
|
function createNoReturn(): NeverType;
|
442
473
|
function convertToInstance(type: NeverType): NeverType;
|
443
474
|
}
|
444
|
-
export interface
|
445
|
-
category: TypeCategory.Any;
|
475
|
+
export interface AnyTypeDetailsPriv {
|
446
476
|
isEllipsis: boolean;
|
447
477
|
}
|
478
|
+
export interface AnyType extends TypeBase<TypeCategory.Any> {
|
479
|
+
priv: AnyTypeDetailsPriv;
|
480
|
+
}
|
448
481
|
export declare namespace AnyType {
|
449
482
|
function create(isEllipsis?: boolean): AnyType;
|
450
483
|
function createSpecialForm(): AnyType;
|
@@ -462,17 +495,19 @@ export declare namespace TypeCondition {
|
|
462
495
|
function isCompatible(conditions1: TypeCondition[] | undefined, conditions2: TypeCondition[] | undefined): boolean;
|
463
496
|
}
|
464
497
|
export interface LiteralTypes {
|
465
|
-
literalStrMap
|
466
|
-
literalIntMap
|
467
|
-
literalEnumMap
|
498
|
+
literalStrMap: Map<string, UnionableType> | undefined;
|
499
|
+
literalIntMap: Map<bigint | number, UnionableType> | undefined;
|
500
|
+
literalEnumMap: Map<string, UnionableType> | undefined;
|
468
501
|
}
|
469
|
-
export interface
|
470
|
-
category: TypeCategory.Union;
|
502
|
+
export interface UnionTypeDetailsPriv {
|
471
503
|
subtypes: UnionableType[];
|
472
504
|
literalInstances: LiteralTypes;
|
473
505
|
literalClasses: LiteralTypes;
|
474
|
-
typeAliasSources
|
475
|
-
includesRecursiveTypeAlias
|
506
|
+
typeAliasSources: Set<UnionType> | undefined;
|
507
|
+
includesRecursiveTypeAlias: boolean;
|
508
|
+
}
|
509
|
+
export interface UnionType extends TypeBase<TypeCategory.Union> {
|
510
|
+
priv: UnionTypeDetailsPriv;
|
476
511
|
}
|
477
512
|
export declare namespace UnionType {
|
478
513
|
function create(): UnionType;
|
@@ -487,24 +522,27 @@ export declare const enum Variance {
|
|
487
522
|
Covariant = 3,
|
488
523
|
Contravariant = 4
|
489
524
|
}
|
490
|
-
export interface
|
525
|
+
export interface RecursiveAliasInfo {
|
526
|
+
name: string;
|
527
|
+
scopeId: TypeVarScopeId;
|
528
|
+
isPep695Syntax: boolean;
|
529
|
+
typeParameters: TypeVarType[] | undefined;
|
530
|
+
}
|
531
|
+
export interface TypeVarDetailsShared {
|
491
532
|
name: string;
|
492
533
|
constraints: Type[];
|
493
|
-
boundType
|
494
|
-
isDefaultExplicit
|
534
|
+
boundType: Type | undefined;
|
535
|
+
isDefaultExplicit: boolean;
|
495
536
|
defaultType: Type;
|
496
537
|
isParamSpec: boolean;
|
497
538
|
isVariadic: boolean;
|
498
539
|
declaredVariance: Variance;
|
499
540
|
isSynthesized: boolean;
|
500
|
-
isSynthesizedSelf
|
501
|
-
synthesizedIndex
|
502
|
-
isExemptFromBoundCheck
|
503
|
-
isTypeParamSyntax
|
504
|
-
|
505
|
-
recursiveTypeAliasScopeId?: TypeVarScopeId | undefined;
|
506
|
-
recursiveTypeAliasIsPep695Syntax?: boolean;
|
507
|
-
recursiveTypeParameters?: TypeVarType[] | undefined;
|
541
|
+
isSynthesizedSelf: boolean;
|
542
|
+
synthesizedIndex: number | undefined;
|
543
|
+
isExemptFromBoundCheck: boolean;
|
544
|
+
isTypeParamSyntax: boolean;
|
545
|
+
recursiveAlias: RecursiveAliasInfo | undefined;
|
508
546
|
}
|
509
547
|
export type ParamSpecAccess = 'args' | 'kwargs';
|
510
548
|
export declare const enum TypeVarScopeType {
|
@@ -512,9 +550,7 @@ export declare const enum TypeVarScopeType {
|
|
512
550
|
Function = 1,
|
513
551
|
TypeAlias = 2
|
514
552
|
}
|
515
|
-
export interface
|
516
|
-
category: TypeCategory.TypeVar;
|
517
|
-
details: TypeVarDetails;
|
553
|
+
export interface TypeVarTypeDetailsPriv {
|
518
554
|
scopeId?: TypeVarScopeId | undefined;
|
519
555
|
scopeName?: string | undefined;
|
520
556
|
scopeType?: TypeVarScopeType;
|
@@ -525,6 +561,10 @@ export interface TypeVarType extends TypeBase {
|
|
525
561
|
computedVariance?: Variance;
|
526
562
|
isInScopePlaceholder?: boolean;
|
527
563
|
}
|
564
|
+
export interface TypeVarType extends TypeBase<TypeCategory.TypeVar> {
|
565
|
+
shared: TypeVarDetailsShared;
|
566
|
+
priv: TypeVarTypeDetailsPriv;
|
567
|
+
}
|
528
568
|
export declare namespace TypeVarType {
|
529
569
|
function createInstance(name: string): TypeVarType;
|
530
570
|
function createInstantiable(name: string, isParamSpec?: boolean): TypeVarType;
|
@@ -570,6 +610,10 @@ export declare function removeUnknownFromUnion(type: Type): Type;
|
|
570
610
|
export declare function removeUnbound(type: Type): Type;
|
571
611
|
export declare function removeFromUnion(type: Type, removeFilter: (type: Type) => boolean): Type;
|
572
612
|
export declare function findSubtype(type: Type, filter: (type: UnionableType | NeverType) => boolean): UnionableType | NeverType | undefined;
|
573
|
-
export
|
613
|
+
export interface CombineTypesOptions {
|
614
|
+
skipElideRedundantLiterals?: boolean;
|
615
|
+
maxSubtypeCount?: number;
|
616
|
+
}
|
617
|
+
export declare function combineTypes(subtypes: Type[], options?: CombineTypesOptions): Type;
|
574
618
|
export declare function isSameWithoutLiteralValue(destType: Type, srcType: Type): boolean;
|
575
619
|
export {};
|