code owner: Arne Dรถring e-mail: arne.doering@gmx.net included from types.nim
Types
EffectsCompat = enum efCompat, efRaisesDiffer, efRaisesUnknown, efTagsDiffer, efTagsUnknown, efEffectsDelayed, efTagsIllegal
- Source Edit
OffsetAccum = object maxAlign*: int32 offset*: int32
- Source Edit
OrdinalType = enum NoneLike, IntLike, FloatLike
- Source Edit
ProcConvMismatch = enum pcmNoSideEffect, pcmNotGcSafe, pcmNotIterator, pcmDifferentCallConv
- Source Edit
TDistinctCompare = enum dcEq, ## a and b should be the same type dcEqIgnoreDistinct, ## compare symmetrically: (distinct a) == b, a == b ## or a == (distinct b) dcEqOrDistinctOf ## a equals b or a is distinct of b
- how distinct types are to be compared Source Edit
TParamsEquality = enum paramsNotEqual, paramsEqual, paramsIncompatible
- Source Edit
TPreferedDesc = enum preferName, preferDesc, preferExported, preferModuleInfo, preferGenericArg, preferTypeName, preferResolved, preferMixed, preferInlayHint, preferInferredEffects
- Source Edit
TTypeCmpFlag = enum IgnoreTupleFields, ## NOTE: Only set this flag for backends! IgnoreCC, ExactTypeDescValues, ExactGenericParams, ExactConstraints, ExactGcSafety, AllowCommonBase, PickyCAliases, IgnoreFlags, PickyBackendAliases, IgnoreRangeShallow
- Source Edit
TTypeCmpFlags = set[TTypeCmpFlag]
- Source Edit
TTypeFieldResult = enum frNone, frHeader, frEmbedded
- Source Edit
TTypePredicate = proc (t: PType): bool {.nimcall.}
- Source Edit
TTypeRelation = enum isNone, isConvertible, isIntConv, isSubtype, isSubrange, isBothMetaConvertible, isInferred, isInferredConvertible, isGeneric, isFromIntLit, isEqual
- Source Edit
Consts
abstractInstOwned = {tyAlias, tyTypeDesc, tyGenericInst, tyDistinct, tyOrdinal, tyOwned..tySink, tyInferred}
- Source Edit
abstractPtrs = {tyVar, tyPtr, tyRef, tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyLent, tyOwned}
- Source Edit
abstractRange = {tyGenericInst, tyRange, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyOwned}
- Source Edit
abstractVar = {tyVar, tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyLent, tyOwned}
- Source Edit
skipPtrs = {tyVar, tyPtr, tyRef, tyGenericInst, tyTypeDesc, tyAlias, tyInferred, tySink, tyLent, tyOwned}
- Source Edit
szIllegalRecursion = -2
- Source Edit
szTooBigSize = -4
- Source Edit
szUncomputedSize = -1
- Source Edit
szUnknownSize = -3
- Source Edit
typedescInst = {tyAlias, tyTypeDesc, tyGenericInst, tyDistinct, tyOrdinal, tyOwned..tySink, tyUserTypeClass, tyInferred}
- Source Edit
typedescPtrs = {tyAlias, tyTypeDesc, tyGenericInst, tyDistinct, tyOrdinal, tyPtr..tyVar, tyOwned..tyLent, tyInferred}
- Source Edit
Procs
proc addPragmaAndCallConvMismatch(message: var string; formal, actual: PType; conf: ConfigRef) {....raises: [ValueError], tags: [], forbids: [].}
- Source Edit
proc addTypeDeclVerboseMaybe(result: var string; conf: ConfigRef; typ: PType) {. ...raises: [Exception, ValueError, KeyError], tags: [RootEffect, ReadDirEffect], forbids: [].}
- Source Edit
proc addTypeHeader(result: var string; conf: ConfigRef; typ: PType; prefer: TPreferedDesc = preferMixed; getDeclarationPath = true) {. ...raises: [Exception, ValueError, KeyError], tags: [RootEffect, ReadDirEffect], forbids: [].}
- Source Edit
proc align(arg: var OffsetAccum; value: int32) {. ...raises: [IllegalTypeRecursionError], tags: [], forbids: [].}
- Source Edit
proc analyseObjectWithTypeField(t: PType): TTypeFieldResult {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc baseOfDistinct(t: PType; g: ModuleGraph; idgen: IdGenerator): PType {. ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect], forbids: [].}
- Source Edit
proc canFormAcycle(g: ModuleGraph; typ: PType): bool {. ...raises: [Exception, KeyError], tags: [RootEffect, ReadDirEffect], forbids: [].}
- Source Edit
proc classify(t: PType): OrdinalType {....raises: [], tags: [], forbids: [].}
- for convenient type checking: Source Edit
proc commonSuperclass(a, b: PType): PType {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc compareTypes(x, y: PType; cmp: TDistinctCompare = dcEq; flags: TTypeCmpFlags = {}): bool {. ...raises: [KeyError, Exception, ValueError, ERecoverableError], tags: [RootEffect], forbids: [].}
- compares two type for equality (modulo type distinction) Source Edit
proc compatibleEffects(formal, actual: PType): EffectsCompat {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc computeSize(conf: ConfigRef; typ: PType): BiggestInt {. ...raises: [Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [ RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc computeSizeAlign(conf: ConfigRef; typ: PType) {....raises: [Exception, ValueError, KeyError, IOError, ERecoverableError, Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc containsCompileTimeOnly(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc containsGarbageCollectedRef(typ: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc containsGenericType(t: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc containsHiddenPointer(typ: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc containsManagedMemory(typ: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc containsObject(t: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc containsTyRef(typ: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc containsUnresolvedType(t: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc enumHasHoles(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc equalParams(a, b: PNode): TParamsEquality {....raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}
- Source Edit
proc firstFloat(t: PType): BiggestFloat {. ...raises: [Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [ RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc floatRangeCheck(x: BiggestFloat; t: PType): bool {. ...raises: [Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [ RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc genericAliasDepth(t: PType): int {....raises: [], tags: [], forbids: [].}
- Source Edit
proc genericRoot(t: PType): PType {....raises: [], tags: [], forbids: [].}
- gets the root generic type (tyGenericBody) from t, if t is a generic type or the body of a generic instantiation Source Edit
proc getFloatValue(n: PNode): BiggestFloat {....raises: [], tags: [], forbids: [].}
- Source Edit
proc getOrdValue(n: PNode): Int128 {....raises: [], tags: [], forbids: [].}
- Source Edit
proc getOrdValueAux(n: PNode; err: var bool): Int128 {....raises: [], tags: [], forbids: [].}
- Source Edit
proc getProcConvMismatch(c: ConfigRef; f, a: PType; rel = isNone): ( set[ProcConvMismatch], TTypeRelation) {....raises: [], tags: [], forbids: [].}
- Returns a set of the reason of mismatch, and the relation for conversion. Source Edit
proc getProcHeader(conf: ConfigRef; sym: PSym; prefer: TPreferedDesc = preferName; getDeclarationPath = true): string {. ...raises: [Exception, KeyError, ValueError], tags: [RootEffect, ReadDirEffect], forbids: [].}
- Source Edit
proc getReturnType(s: PSym): PType {....raises: [], tags: [], forbids: [].}
- Source Edit
proc inc(arg: var OffsetAccum; value: int32) {. ...raises: [IllegalTypeRecursionError], tags: [], forbids: [].}
- Source Edit
proc inheritanceDiff(a, b: PType): int {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc invalidGenericInst(f: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isCharArrayPtr(t: PType; allowPointerToChar: bool): bool {. ...raises: [Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [ RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc isCompileTimeOnly(t: PType): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc isDefectException(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isDefectOrCatchableError(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isEmptyContainer(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isException(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isFloatLit(t: PType): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc isGenericAlias(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isOrdinalType(t: PType; allowEnumWithHoles: bool = false): bool {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc isPureObject(typ: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isRefPtrObject(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isSinkTypeForParam(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isTupleRecursive(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc isUnsigned(t: PType): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc iterOverType(t: PType; iter: TTypeIter; closure: RootRef): bool {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc lacksMTypeField(typ: PType): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc nominalRoot(t: PType): PType {....raises: [], tags: [], forbids: [].}
-
the "name" type of a given instance of a nominal type, i.e. the type directly associated with the symbol where the root nominal type of t was defined, skipping things like generic instances, aliases, var/sink/typedesc modifiers
instead of returning the uninstantiated body of a generic type, returns the type of the symbol instead (with tyGenericBody type)
Source Edit proc safeInheritanceDiff(a, b: PType): int {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc safeSkipTypes(t: PType; kinds: TTypeKinds): PType {....raises: [], tags: [], forbids: [].}
- same as 'skipTypes' but with a simple cycle detector. Source Edit
proc sameBackendType(x, y: PType): bool {. ...raises: [KeyError, Exception, ValueError, ERecoverableError], tags: [RootEffect], forbids: [].}
- Source Edit
proc sameBackendTypeIgnoreRange(x, y: PType): bool {. ...raises: [KeyError, Exception, ValueError, ERecoverableError], tags: [RootEffect], forbids: [].}
- Source Edit
proc sameBackendTypePickyAliases(x, y: PType): bool {. ...raises: [KeyError, Exception, ValueError, ERecoverableError], tags: [RootEffect], forbids: [].}
- Source Edit
proc sameDistinctTypes(a, b: PType): bool {.inline, ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc sameEnumTypes(a, b: PType): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc sameObjectTypes(a, b: PType): bool {....raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc sameType(a, b: PType; flags: TTypeCmpFlags = {}): bool {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc sameTypeOrNil(a, b: PType; flags: TTypeCmpFlags = {}): bool {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc searchTypeFor(t: PType; predicate: TTypePredicate): bool {. ...raises: [Exception], tags: [RootEffect], forbids: [].}
- Source Edit
proc skipConvTakeType(n: PNode): PNode {....raises: [], tags: [], forbids: [].}
- Source Edit
proc skipGenericAlias(t: PType): PType {....raises: [], tags: [], forbids: [].}
- Source Edit
proc skipHidden(n: PNode): PNode {....raises: [], tags: [], forbids: [].}
- Source Edit
proc skipHiddenSubConv(n: PNode; g: ModuleGraph; idgen: IdGenerator): PNode {. ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect], forbids: [].}
- Source Edit
proc takeType(formal, arg: PType; g: ModuleGraph; idgen: IdGenerator): PType {. ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect], forbids: [].}
- Source Edit
proc targetSizeSignedToKind(conf: ConfigRef): TTypeKind {....raises: [], tags: [], forbids: [].}
- Source Edit
proc targetSizeUnsignedToKind(conf: ConfigRef): TTypeKind {....raises: [], tags: [], forbids: [].}
- Source Edit
proc typeNameAndDesc(t: PType): string {. ...raises: [Exception, KeyError, ValueError], tags: [RootEffect], forbids: [].}
- Source Edit
proc typeToString(typ: PType; prefer: TPreferedDesc = preferName): string {. ...raises: [Exception, KeyError, ValueError], tags: [RootEffect], forbids: [].}
- Source Edit
Templates
template bindConcreteTypeToUserTypeClass(tc, concrete: PType)
- Source Edit
template isResolvedUserTypeClass(t: PType): bool
- Source Edit