types

Search:
Group by:
Source   Edit  

code owner: Arne Dรถring e-mail: [email protected] included from types.nim

Types

EffectsCompat = enum
  efCompat, efRaisesDiffer, efRaisesUnknown, efTagsDiffer, efTagsUnknown,
  efEffectsDelayed, efTagsIllegal
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
Source   Edit  
TTypeCmpFlag = enum
  IgnoreTupleFields,        ## NOTE: Only set this flag for backends!
  IgnoreCC, ExactTypeDescValues, ExactGenericParams, ExactConstraints,
  ExactGcSafety, AllowCommonBase, PickyCAliases
Source   Edit  
TTypeFieldResult = enum
  frNone, frHeader, frEmbedded
Source   Edit  
TTypeIter = proc (t: PType; closure: RootRef): bool {.nimcall.}
Source   Edit  
TTypeMutator = proc (t: PType; closure: RootRef): PType {.nimcall.}
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  
szTooBigSize = -4
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, OSError],
    tags: [RootEffect, ReadDirEffect], forbids: [].}
Source   Edit  
proc addTypeHeader(result: var string; conf: ConfigRef; typ: PType;
                   prefer: TPreferedDesc = preferMixed;
                   getDeclarationPath = true) {.
    ...raises: [Exception, ValueError, KeyError, OSError],
    tags: [RootEffect, ReadDirEffect], forbids: [].}
Source   Edit  
proc analyseObjectWithTypeField(t: PType): TTypeFieldResult {.
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc base(t: PType): PType {....raises: [], tags: [], 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, 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, OSError, 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 elemType(t: PType): PType {....raises: [], tags: [], 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, OSError, IOError, ERecoverableError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
Source   Edit  
proc firstOrd(conf: ConfigRef; t: PType): Int128 {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
    forbids: [].}
Source   Edit  
proc floatRangeCheck(x: BiggestFloat; t: PType): bool {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
    forbids: [].}
Source   Edit  
proc getAlign(conf: ConfigRef; typ: PType): BiggestInt {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
    forbids: [].}
Source   Edit  
proc getFloatValue(n: PNode): BiggestFloat {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc getOrdValue(n: PNode; onError = high(Int128)): 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, OSError],
    tags: [RootEffect, ReadDirEffect], forbids: [].}
Source   Edit  
proc getReturnType(s: PSym): PType {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc getSize(conf: ConfigRef; typ: PType): BiggestInt {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
    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, OSError, 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 isFinal(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 isIntLit(t: PType): bool {.inline, ...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 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 lastFloat(t: PType): BiggestFloat {....raises: [Exception, ValueError,
    KeyError, OSError, IOError, ERecoverableError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
Source   Edit  
proc lastOrd(conf: ConfigRef; t: PType): Int128 {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
    forbids: [].}
Source   Edit  
proc lengthOrd(conf: ConfigRef; t: PType): Int128 {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
    forbids: [].}
Source   Edit  
proc lookupFieldAgain(ty: PType; field: PSym): PSym {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc matchType(a: PType; pattern: openArray[tuple[k: TTypeKind, i: int]];
               last: TTypeKind): bool {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc mutateType(t: PType; iter: TTypeMutator; closure: RootRef): PType {.
    ...raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}
Source   Edit  
proc normalizeKind(conf: ConfigRef; k: TTypeKind): TTypeKind {....raises: [],
    tags: [], forbids: [].}
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, 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 sameFlags(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 skipConv(n: PNode): PNode {....raises: [], tags: [], 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 typeMismatch(conf: ConfigRef; info: TLineInfo; formal, actual: PType;
                  n: PNode) {....raises: [Exception, KeyError, ValueError, OSError,
                                       IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
                              forbids: [].}
Source   Edit  
proc typeToString(typ: PType; prefer: TPreferedDesc = preferName): string {.
    ...raises: [Exception, KeyError, ValueError], tags: [RootEffect], forbids: [].}
Source   Edit  

Templates

template `$`(typ: PType): string
Source   Edit  
template bindConcreteTypeToUserTypeClass(tc, concrete: PType)
Source   Edit  
template foldAlignOf(conf: ConfigRef; n: PNode; fallback: PNode): PNode
Source   Edit  
template foldOffsetOf(conf: ConfigRef; n: PNode; fallback: PNode): PNode
Returns an int literal node of the given offsetof expression in n. Falls back to fallback, if the offsetof expression can't be processed. Source   Edit  
template foldSizeOf(conf: ConfigRef; n: PNode; fallback: PNode): PNode
Source   Edit  
template isResolvedUserTypeClass(t: PType): bool
Source   Edit