@zzzen/pyright-internal 1.2.0-dev.20240609 → 1.2.0-dev.20240616
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/binder.d.ts +3 -1
- package/dist/analyzer/binder.js +9 -3
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +3 -3
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +1 -4
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructors.js +0 -2
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +0 -1
- package/dist/analyzer/dataClasses.js +51 -77
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/decorators.d.ts +2 -1
- package/dist/analyzer/decorators.js +34 -39
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/docStringUtils.d.ts +0 -1
- package/dist/analyzer/docStringUtils.js +1 -6
- package/dist/analyzer/docStringUtils.js.map +1 -1
- package/dist/analyzer/enums.js +1 -1
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.js +11 -9
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/namedTuples.js +3 -3
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/properties.js +2 -2
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +14 -3
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/service.js +27 -48
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +2 -1
- package/dist/analyzer/sourceFile.js +4 -2
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.d.ts +1 -0
- package/dist/analyzer/typeDocStringUtils.js +8 -1
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +468 -459
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typePrinter.js +4 -2
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +0 -1
- package/dist/analyzer/typeUtils.js +9 -22
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +6 -6
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +40 -42
- package/dist/analyzer/types.js +84 -91
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +16 -24
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/cancellationUtils.d.ts +1 -0
- package/dist/common/cancellationUtils.js +15 -1
- package/dist/common/cancellationUtils.js.map +1 -1
- package/dist/common/configOptions.js +1 -1
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/docStringService.d.ts +15 -0
- package/dist/common/docStringService.js +38 -0
- package/dist/common/docStringService.js.map +1 -0
- package/dist/common/envVarUtils.js +3 -1
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +1 -7
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/languageServerInterface.d.ts +1 -2
- package/dist/common/languageServerInterface.js.map +1 -1
- package/dist/common/serviceKeys.d.ts +2 -0
- package/dist/common/serviceKeys.js +1 -0
- package/dist/common/serviceKeys.js.map +1 -1
- package/dist/common/serviceProvider.js +3 -0
- package/dist/common/serviceProvider.js.map +1 -1
- package/dist/common/serviceProviderExtensions.d.ts +2 -0
- package/dist/common/serviceProviderExtensions.js +8 -0
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/stringUtils.d.ts +1 -0
- package/dist/common/stringUtils.js +5 -1
- package/dist/common/stringUtils.js.map +1 -1
- package/dist/common/uri/uriUtils.d.ts +1 -1
- package/dist/common/uri/uriUtils.js +1 -1
- package/dist/common/uri/uriUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +1 -1
- package/dist/languageServerBase.js +2 -2
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +1 -0
- package/dist/languageService/completionProvider.js +16 -7
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +2 -1
- package/dist/languageService/completionProviderUtils.js +6 -4
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +2 -1
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +2 -1
- package/dist/languageService/hoverProvider.js +7 -5
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.d.ts +3 -1
- package/dist/languageService/signatureHelpProvider.js +8 -6
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/localization/package.nls.cs.json +2 -1
- package/dist/localization/package.nls.de.json +2 -1
- package/dist/localization/package.nls.es.json +1 -0
- package/dist/localization/package.nls.fr.json +2 -1
- package/dist/localization/package.nls.it.json +2 -1
- package/dist/localization/package.nls.ja.json +2 -1
- package/dist/localization/package.nls.ko.json +2 -1
- package/dist/localization/package.nls.pl.json +2 -1
- package/dist/localization/package.nls.pt-br.json +2 -1
- package/dist/localization/package.nls.qps-ploc.json +2 -1
- package/dist/localization/package.nls.ru.json +2 -1
- package/dist/localization/package.nls.tr.json +2 -1
- package/dist/localization/package.nls.zh-cn.json +2 -1
- package/dist/localization/package.nls.zh-tw.json +2 -1
- package/dist/tests/checker.test.js +8 -0
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/config.test.js +1 -1
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/docStringConversion.test.d.ts +2 -1
- package/dist/tests/docStringConversion.test.js +300 -293
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js +2 -2
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js +1 -1
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.js +2 -1
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/pathUtils.test.js +6 -0
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/signatureHelp.test.js +2 -1
- package/dist/tests/signatureHelp.test.js.map +1 -1
- package/dist/tests/uri.test.js +6 -0
- package/dist/tests/uri.test.js.map +1 -1
- package/dist/workspaceFactory.d.ts +1 -1
- package/package.json +1 -1
- package/dist/tests/docStringUtils.test.d.ts +0 -1
- package/dist/tests/docStringUtils.test.js +0 -74
- package/dist/tests/docStringUtils.test.js.map +0 -1
package/dist/analyzer/types.js
CHANGED
@@ -281,91 +281,74 @@ var ClassTypeFlags;
|
|
281
281
|
// formally as a class. Examples include 'Optional'
|
282
282
|
// and 'Union'.
|
283
283
|
ClassTypeFlags[ClassTypeFlags["SpecialBuiltIn"] = 2] = "SpecialBuiltIn";
|
284
|
-
// Introduced in Python 3.7 - class either derives directly
|
285
|
-
// from NamedTuple or has a @dataclass class decorator.
|
286
|
-
ClassTypeFlags[ClassTypeFlags["DataClass"] = 4] = "DataClass";
|
287
|
-
// Indicates that the dataclass is frozen.
|
288
|
-
ClassTypeFlags[ClassTypeFlags["FrozenDataClass"] = 8] = "FrozenDataClass";
|
289
|
-
// Flags that control whether methods should be
|
290
|
-
// synthesized for a dataclass class.
|
291
|
-
ClassTypeFlags[ClassTypeFlags["SkipSynthesizedDataClassInit"] = 16] = "SkipSynthesizedDataClassInit";
|
292
|
-
ClassTypeFlags[ClassTypeFlags["SkipSynthesizedDataClassEq"] = 32] = "SkipSynthesizedDataClassEq";
|
293
|
-
ClassTypeFlags[ClassTypeFlags["SynthesizedDataClassOrder"] = 64] = "SynthesizedDataClassOrder";
|
294
284
|
// Introduced in PEP 589, TypedDict classes provide a way
|
295
285
|
// to specify type hints for dictionaries with different
|
296
286
|
// value types and a limited set of static keys.
|
297
|
-
ClassTypeFlags[ClassTypeFlags["TypedDictClass"] =
|
287
|
+
ClassTypeFlags[ClassTypeFlags["TypedDictClass"] = 4] = "TypedDictClass";
|
298
288
|
// Used in conjunction with TypedDictClass, indicates that
|
299
289
|
// the TypedDict class is marked "closed".
|
300
|
-
ClassTypeFlags[ClassTypeFlags["TypedDictMarkedClosed"] =
|
290
|
+
ClassTypeFlags[ClassTypeFlags["TypedDictMarkedClosed"] = 8] = "TypedDictMarkedClosed";
|
301
291
|
// Used in conjunction with TypedDictClass, indicates that
|
302
292
|
// the TypedDict class is marked "closed" or one or more of
|
303
293
|
// its superclasses is marked "closed".
|
304
|
-
ClassTypeFlags[ClassTypeFlags["TypedDictEffectivelyClosed"] =
|
294
|
+
ClassTypeFlags[ClassTypeFlags["TypedDictEffectivelyClosed"] = 16] = "TypedDictEffectivelyClosed";
|
305
295
|
// Used in conjunction with TypedDictClass, indicates that
|
306
296
|
// the dictionary values can be omitted.
|
307
|
-
ClassTypeFlags[ClassTypeFlags["CanOmitDictValues"] =
|
297
|
+
ClassTypeFlags[ClassTypeFlags["CanOmitDictValues"] = 32] = "CanOmitDictValues";
|
308
298
|
// The class derives from a class that has the ABCMeta
|
309
299
|
// metaclass. Such classes are allowed to contain
|
310
300
|
// @abstractmethod decorators.
|
311
|
-
ClassTypeFlags[ClassTypeFlags["SupportsAbstractMethods"] =
|
301
|
+
ClassTypeFlags[ClassTypeFlags["SupportsAbstractMethods"] = 64] = "SupportsAbstractMethods";
|
312
302
|
// Derives from property class and has the semantics of
|
313
303
|
// a property (with optional setter, deleter).
|
314
|
-
ClassTypeFlags[ClassTypeFlags["PropertyClass"] =
|
304
|
+
ClassTypeFlags[ClassTypeFlags["PropertyClass"] = 128] = "PropertyClass";
|
315
305
|
// The class is decorated with a "@final" decorator
|
316
306
|
// indicating that it cannot be subclassed.
|
317
|
-
ClassTypeFlags[ClassTypeFlags["Final"] =
|
307
|
+
ClassTypeFlags[ClassTypeFlags["Final"] = 256] = "Final";
|
318
308
|
// The class derives directly from "Protocol".
|
319
|
-
ClassTypeFlags[ClassTypeFlags["ProtocolClass"] =
|
309
|
+
ClassTypeFlags[ClassTypeFlags["ProtocolClass"] = 512] = "ProtocolClass";
|
320
310
|
// A class whose constructor (__init__ method) does not have
|
321
311
|
// annotated types and is treated as though each parameter
|
322
312
|
// is a generic type for purposes of type inference.
|
323
|
-
ClassTypeFlags[ClassTypeFlags["PseudoGenericClass"] =
|
313
|
+
ClassTypeFlags[ClassTypeFlags["PseudoGenericClass"] = 1024] = "PseudoGenericClass";
|
324
314
|
// A protocol class that is "runtime checkable" can be used
|
325
315
|
// in an isinstance call.
|
326
|
-
ClassTypeFlags[ClassTypeFlags["RuntimeCheckable"] =
|
316
|
+
ClassTypeFlags[ClassTypeFlags["RuntimeCheckable"] = 2048] = "RuntimeCheckable";
|
327
317
|
// The type is defined in the typing_extensions.pyi file.
|
328
|
-
ClassTypeFlags[ClassTypeFlags["TypingExtensionClass"] =
|
318
|
+
ClassTypeFlags[ClassTypeFlags["TypingExtensionClass"] = 4096] = "TypingExtensionClass";
|
329
319
|
// The class type is in the process of being evaluated and
|
330
320
|
// is not yet complete. This allows us to detect cases where
|
331
321
|
// the class refers to itself (e.g. uses itself as a type
|
332
322
|
// argument to one of its generic base classes).
|
333
|
-
ClassTypeFlags[ClassTypeFlags["PartiallyEvaluated"] =
|
323
|
+
ClassTypeFlags[ClassTypeFlags["PartiallyEvaluated"] = 8192] = "PartiallyEvaluated";
|
334
324
|
// The class or one of its ancestors defines a __class_getitem__
|
335
325
|
// method that is used for subscripting. This is not set if the
|
336
326
|
// class is generic, and therefore supports standard subscripting
|
337
327
|
// semantics.
|
338
|
-
ClassTypeFlags[ClassTypeFlags["HasCustomClassGetItem"] =
|
328
|
+
ClassTypeFlags[ClassTypeFlags["HasCustomClassGetItem"] = 16384] = "HasCustomClassGetItem";
|
339
329
|
// The tuple class uses a variadic type parameter and requires
|
340
330
|
// special-case handling of its type arguments.
|
341
|
-
ClassTypeFlags[ClassTypeFlags["TupleClass"] =
|
331
|
+
ClassTypeFlags[ClassTypeFlags["TupleClass"] = 32768] = "TupleClass";
|
342
332
|
// The class has a metaclass of EnumMeta or derives from
|
343
333
|
// a class that has this metaclass.
|
344
|
-
ClassTypeFlags[ClassTypeFlags["EnumClass"] =
|
345
|
-
// For dataclasses, should __init__ method always be generated
|
346
|
-
// with keyword-only parameters?
|
347
|
-
ClassTypeFlags[ClassTypeFlags["DataClassKeywordOnlyParams"] = 4194304] = "DataClassKeywordOnlyParams";
|
334
|
+
ClassTypeFlags[ClassTypeFlags["EnumClass"] = 65536] = "EnumClass";
|
348
335
|
// Properties that are defined using the @classmethod decorator.
|
349
|
-
ClassTypeFlags[ClassTypeFlags["ClassProperty"] =
|
336
|
+
ClassTypeFlags[ClassTypeFlags["ClassProperty"] = 131072] = "ClassProperty";
|
350
337
|
// Class is declared within a type stub file.
|
351
|
-
ClassTypeFlags[ClassTypeFlags["DefinedInStub"] =
|
338
|
+
ClassTypeFlags[ClassTypeFlags["DefinedInStub"] = 262144] = "DefinedInStub";
|
352
339
|
// Class does not allow writing or deleting its instance variables
|
353
340
|
// through a member access. Used with named tuples.
|
354
|
-
ClassTypeFlags[ClassTypeFlags["ReadOnlyInstanceVariables"] =
|
355
|
-
// For dataclasses, should __slots__ be generated?
|
356
|
-
ClassTypeFlags[ClassTypeFlags["GenerateDataClassSlots"] = 67108864] = "GenerateDataClassSlots";
|
357
|
-
// For dataclasses, should __hash__ be generated?
|
358
|
-
ClassTypeFlags[ClassTypeFlags["SynthesizeDataClassUnsafeHash"] = 134217728] = "SynthesizeDataClassUnsafeHash";
|
341
|
+
ClassTypeFlags[ClassTypeFlags["ReadOnlyInstanceVariables"] = 524288] = "ReadOnlyInstanceVariables";
|
359
342
|
// Decorated with @type_check_only.
|
360
|
-
ClassTypeFlags[ClassTypeFlags["TypeCheckOnly"] =
|
343
|
+
ClassTypeFlags[ClassTypeFlags["TypeCheckOnly"] = 1048576] = "TypeCheckOnly";
|
361
344
|
// Created with the NewType call.
|
362
|
-
ClassTypeFlags[ClassTypeFlags["NewTypeClass"] =
|
345
|
+
ClassTypeFlags[ClassTypeFlags["NewTypeClass"] = 2097152] = "NewTypeClass";
|
363
346
|
// Class is allowed to be used as an implicit type alias even
|
364
347
|
// though it is not defined using a `class` statement.
|
365
|
-
ClassTypeFlags[ClassTypeFlags["ValidTypeAliasClass"] =
|
348
|
+
ClassTypeFlags[ClassTypeFlags["ValidTypeAliasClass"] = 4194304] = "ValidTypeAliasClass";
|
366
349
|
// A special form is not compatible with type[T] and cannot
|
367
350
|
// be directly instantiated.
|
368
|
-
ClassTypeFlags[ClassTypeFlags["SpecialFormClass"] =
|
351
|
+
ClassTypeFlags[ClassTypeFlags["SpecialFormClass"] = 8388608] = "SpecialFormClass";
|
369
352
|
})(ClassTypeFlags || (exports.ClassTypeFlags = ClassTypeFlags = {}));
|
370
353
|
var ClassType;
|
371
354
|
(function (ClassType) {
|
@@ -452,6 +435,12 @@ var ClassType;
|
|
452
435
|
return newClassType;
|
453
436
|
}
|
454
437
|
ClassType.cloneWithLiteral = cloneWithLiteral;
|
438
|
+
function cloneForDeprecatedInstance(type, deprecatedMessage) {
|
439
|
+
const newClassType = TypeBase.cloneType(type);
|
440
|
+
newClassType.deprecatedInstanceMessage = deprecatedMessage;
|
441
|
+
return newClassType;
|
442
|
+
}
|
443
|
+
ClassType.cloneForDeprecatedInstance = cloneForDeprecatedInstance;
|
455
444
|
function cloneForTypingAlias(classType, aliasName) {
|
456
445
|
const newClassType = TypeBase.cloneType(classType);
|
457
446
|
newClassType.aliasName = aliasName;
|
@@ -606,99 +595,106 @@ var ClassType;
|
|
606
595
|
}
|
607
596
|
ClassType.isBuiltIn = isBuiltIn;
|
608
597
|
function supportsAbstractMethods(classType) {
|
609
|
-
return !!(classType.details.flags &
|
598
|
+
return !!(classType.details.flags & 64 /* ClassTypeFlags.SupportsAbstractMethods */);
|
610
599
|
}
|
611
600
|
ClassType.supportsAbstractMethods = supportsAbstractMethods;
|
612
601
|
function isDataClass(classType) {
|
613
|
-
return !!
|
602
|
+
return !!classType.details.dataClassBehaviors;
|
614
603
|
}
|
615
604
|
ClassType.isDataClass = isDataClass;
|
616
|
-
function
|
617
|
-
|
605
|
+
function isDataClassSkipGenerateInit(classType) {
|
606
|
+
var _a;
|
607
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.skipGenerateInit);
|
618
608
|
}
|
619
|
-
ClassType.
|
620
|
-
function
|
621
|
-
|
609
|
+
ClassType.isDataClassSkipGenerateInit = isDataClassSkipGenerateInit;
|
610
|
+
function isDataClassSkipGenerateEq(classType) {
|
611
|
+
var _a;
|
612
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.skipGenerateEq);
|
622
613
|
}
|
623
|
-
ClassType.
|
624
|
-
function
|
625
|
-
|
614
|
+
ClassType.isDataClassSkipGenerateEq = isDataClassSkipGenerateEq;
|
615
|
+
function isDataClassFrozen(classType) {
|
616
|
+
var _a;
|
617
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.frozen);
|
626
618
|
}
|
627
|
-
ClassType.
|
628
|
-
function
|
629
|
-
|
619
|
+
ClassType.isDataClassFrozen = isDataClassFrozen;
|
620
|
+
function isDataClassGenerateOrder(classType) {
|
621
|
+
var _a;
|
622
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.generateOrder);
|
630
623
|
}
|
631
|
-
ClassType.
|
632
|
-
function
|
633
|
-
|
624
|
+
ClassType.isDataClassGenerateOrder = isDataClassGenerateOrder;
|
625
|
+
function isDataClassKeywordOnly(classType) {
|
626
|
+
var _a;
|
627
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.keywordOnly);
|
634
628
|
}
|
635
|
-
ClassType.
|
636
|
-
function
|
637
|
-
|
629
|
+
ClassType.isDataClassKeywordOnly = isDataClassKeywordOnly;
|
630
|
+
function isDataClassGenerateSlots(classType) {
|
631
|
+
var _a;
|
632
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.generateSlots);
|
638
633
|
}
|
639
|
-
ClassType.
|
640
|
-
function
|
641
|
-
|
634
|
+
ClassType.isDataClassGenerateSlots = isDataClassGenerateSlots;
|
635
|
+
function isDataClassGenerateHash(classType) {
|
636
|
+
var _a;
|
637
|
+
return !!((_a = classType.details.dataClassBehaviors) === null || _a === void 0 ? void 0 : _a.generateHash);
|
642
638
|
}
|
643
|
-
ClassType.
|
639
|
+
ClassType.isDataClassGenerateHash = isDataClassGenerateHash;
|
644
640
|
function isTypeCheckOnly(classType) {
|
645
|
-
return !!(classType.details.flags &
|
641
|
+
return !!(classType.details.flags & 1048576 /* ClassTypeFlags.TypeCheckOnly */);
|
646
642
|
}
|
647
643
|
ClassType.isTypeCheckOnly = isTypeCheckOnly;
|
648
644
|
function isNewTypeClass(classType) {
|
649
|
-
return !!(classType.details.flags &
|
645
|
+
return !!(classType.details.flags & 2097152 /* ClassTypeFlags.NewTypeClass */);
|
650
646
|
}
|
651
647
|
ClassType.isNewTypeClass = isNewTypeClass;
|
652
648
|
function isValidTypeAliasClass(classType) {
|
653
|
-
return !!(classType.details.flags &
|
649
|
+
return !!(classType.details.flags & 4194304 /* ClassTypeFlags.ValidTypeAliasClass */);
|
654
650
|
}
|
655
651
|
ClassType.isValidTypeAliasClass = isValidTypeAliasClass;
|
656
652
|
function isSpecialFormClass(classType) {
|
657
|
-
return !!(classType.details.flags &
|
653
|
+
return !!(classType.details.flags & 8388608 /* ClassTypeFlags.SpecialFormClass */);
|
658
654
|
}
|
659
655
|
ClassType.isSpecialFormClass = isSpecialFormClass;
|
660
656
|
function isTypedDictClass(classType) {
|
661
|
-
return !!(classType.details.flags &
|
657
|
+
return !!(classType.details.flags & 4 /* ClassTypeFlags.TypedDictClass */);
|
662
658
|
}
|
663
659
|
ClassType.isTypedDictClass = isTypedDictClass;
|
664
660
|
function isCanOmitDictValues(classType) {
|
665
|
-
return !!(classType.details.flags &
|
661
|
+
return !!(classType.details.flags & 32 /* ClassTypeFlags.CanOmitDictValues */);
|
666
662
|
}
|
667
663
|
ClassType.isCanOmitDictValues = isCanOmitDictValues;
|
668
664
|
function isTypedDictMarkedClosed(classType) {
|
669
|
-
return !!(classType.details.flags &
|
665
|
+
return !!(classType.details.flags & 8 /* ClassTypeFlags.TypedDictMarkedClosed */);
|
670
666
|
}
|
671
667
|
ClassType.isTypedDictMarkedClosed = isTypedDictMarkedClosed;
|
672
668
|
function isTypedDictEffectivelyClosed(classType) {
|
673
|
-
return !!(classType.details.flags &
|
669
|
+
return !!(classType.details.flags & 16 /* ClassTypeFlags.TypedDictEffectivelyClosed */);
|
674
670
|
}
|
675
671
|
ClassType.isTypedDictEffectivelyClosed = isTypedDictEffectivelyClosed;
|
676
672
|
function isEnumClass(classType) {
|
677
|
-
return !!(classType.details.flags &
|
673
|
+
return !!(classType.details.flags & 65536 /* ClassTypeFlags.EnumClass */);
|
678
674
|
}
|
679
675
|
ClassType.isEnumClass = isEnumClass;
|
680
676
|
function isPropertyClass(classType) {
|
681
|
-
return !!(classType.details.flags &
|
677
|
+
return !!(classType.details.flags & 128 /* ClassTypeFlags.PropertyClass */);
|
682
678
|
}
|
683
679
|
ClassType.isPropertyClass = isPropertyClass;
|
684
680
|
function isClassProperty(classType) {
|
685
|
-
return !!(classType.details.flags &
|
681
|
+
return !!(classType.details.flags & 131072 /* ClassTypeFlags.ClassProperty */);
|
686
682
|
}
|
687
683
|
ClassType.isClassProperty = isClassProperty;
|
688
684
|
function isFinal(classType) {
|
689
|
-
return !!(classType.details.flags &
|
685
|
+
return !!(classType.details.flags & 256 /* ClassTypeFlags.Final */);
|
690
686
|
}
|
691
687
|
ClassType.isFinal = isFinal;
|
692
688
|
function isProtocolClass(classType) {
|
693
|
-
return !!(classType.details.flags &
|
689
|
+
return !!(classType.details.flags & 512 /* ClassTypeFlags.ProtocolClass */);
|
694
690
|
}
|
695
691
|
ClassType.isProtocolClass = isProtocolClass;
|
696
692
|
function isDefinedInStub(classType) {
|
697
|
-
return !!(classType.details.flags &
|
693
|
+
return !!(classType.details.flags & 262144 /* ClassTypeFlags.DefinedInStub */);
|
698
694
|
}
|
699
695
|
ClassType.isDefinedInStub = isDefinedInStub;
|
700
696
|
function isPseudoGenericClass(classType) {
|
701
|
-
return !!(classType.details.flags &
|
697
|
+
return !!(classType.details.flags & 1024 /* ClassTypeFlags.PseudoGenericClass */);
|
702
698
|
}
|
703
699
|
ClassType.isPseudoGenericClass = isPseudoGenericClass;
|
704
700
|
function getDataClassEntries(classType) {
|
@@ -708,27 +704,27 @@ var ClassType;
|
|
708
704
|
}
|
709
705
|
ClassType.getDataClassEntries = getDataClassEntries;
|
710
706
|
function isRuntimeCheckable(classType) {
|
711
|
-
return !!(classType.details.flags &
|
707
|
+
return !!(classType.details.flags & 2048 /* ClassTypeFlags.RuntimeCheckable */);
|
712
708
|
}
|
713
709
|
ClassType.isRuntimeCheckable = isRuntimeCheckable;
|
714
710
|
function isTypingExtensionClass(classType) {
|
715
|
-
return !!(classType.details.flags &
|
711
|
+
return !!(classType.details.flags & 4096 /* ClassTypeFlags.TypingExtensionClass */);
|
716
712
|
}
|
717
713
|
ClassType.isTypingExtensionClass = isTypingExtensionClass;
|
718
714
|
function isPartiallyEvaluated(classType) {
|
719
|
-
return !!(classType.details.flags &
|
715
|
+
return !!(classType.details.flags & 8192 /* ClassTypeFlags.PartiallyEvaluated */);
|
720
716
|
}
|
721
717
|
ClassType.isPartiallyEvaluated = isPartiallyEvaluated;
|
722
718
|
function hasCustomClassGetItem(classType) {
|
723
|
-
return !!(classType.details.flags &
|
719
|
+
return !!(classType.details.flags & 16384 /* ClassTypeFlags.HasCustomClassGetItem */);
|
724
720
|
}
|
725
721
|
ClassType.hasCustomClassGetItem = hasCustomClassGetItem;
|
726
722
|
function isTupleClass(classType) {
|
727
|
-
return !!(classType.details.flags &
|
723
|
+
return !!(classType.details.flags & 32768 /* ClassTypeFlags.TupleClass */);
|
728
724
|
}
|
729
725
|
ClassType.isTupleClass = isTupleClass;
|
730
726
|
function isReadOnlyInstanceVariables(classType) {
|
731
|
-
return !!(classType.details.flags &
|
727
|
+
return !!(classType.details.flags & 524288 /* ClassTypeFlags.ReadOnlyInstanceVariables */);
|
732
728
|
}
|
733
729
|
ClassType.isReadOnlyInstanceVariables = isReadOnlyInstanceVariables;
|
734
730
|
function getTypeParameters(classType) {
|
@@ -974,10 +970,11 @@ var FunctionType;
|
|
974
970
|
// version of _functionDetails.
|
975
971
|
function clone(type, stripFirstParam = false, boundToType, boundTypeVarScopeId) {
|
976
972
|
var _a;
|
977
|
-
const newFunction =
|
973
|
+
const newFunction = TypeBase.cloneType(type);
|
978
974
|
newFunction.details = { ...type.details };
|
979
|
-
newFunction.boundToType = boundToType !== null && boundToType !== void 0 ? boundToType : type.boundToType;
|
980
975
|
newFunction.preBoundFlags = newFunction.details.flags;
|
976
|
+
newFunction.boundToType = boundToType;
|
977
|
+
newFunction.boundTypeVarScopeId = boundTypeVarScopeId;
|
981
978
|
if (stripFirstParam) {
|
982
979
|
if (type.details.parameters.length > 0) {
|
983
980
|
if (type.details.parameters[0].category === 0 /* ParameterCategory.Simple */) {
|
@@ -1012,7 +1009,6 @@ var FunctionType;
|
|
1012
1009
|
};
|
1013
1010
|
}
|
1014
1011
|
newFunction.inferredReturnType = type.inferredReturnType;
|
1015
|
-
newFunction.boundTypeVarScopeId = boundTypeVarScopeId !== null && boundTypeVarScopeId !== void 0 ? boundTypeVarScopeId : type.boundTypeVarScopeId;
|
1016
1012
|
return newFunction;
|
1017
1013
|
}
|
1018
1014
|
FunctionType.clone = clone;
|
@@ -1039,16 +1035,13 @@ var FunctionType;
|
|
1039
1035
|
// specialized types. The clone shares the _functionDetails
|
1040
1036
|
// with the object being cloned.
|
1041
1037
|
function cloneForSpecialization(type, specializedTypes, specializedInferredReturnType) {
|
1042
|
-
const newFunction =
|
1043
|
-
newFunction.details = type.details;
|
1038
|
+
const newFunction = TypeBase.cloneType(type);
|
1044
1039
|
(0, debug_1.assert)(specializedTypes.parameterTypes.length === type.details.parameters.length);
|
1045
1040
|
if (specializedTypes.parameterDefaultArgs) {
|
1046
1041
|
(0, debug_1.assert)(specializedTypes.parameterDefaultArgs.length === type.details.parameters.length);
|
1047
1042
|
}
|
1048
1043
|
newFunction.specializedTypes = specializedTypes;
|
1049
|
-
|
1050
|
-
newFunction.inferredReturnType = specializedInferredReturnType;
|
1051
|
-
}
|
1044
|
+
newFunction.inferredReturnType = specializedInferredReturnType;
|
1052
1045
|
return newFunction;
|
1053
1046
|
}
|
1054
1047
|
FunctionType.cloneForSpecialization = cloneForSpecialization;
|