diff --git a/compiler/ast2nif.nim b/compiler/ast2nif.nim index e49f59ab20..ba9c0d9cff 100644 --- a/compiler/ast2nif.nim +++ b/compiler/ast2nif.nim @@ -679,7 +679,7 @@ proc loadAtom[T: int16|int32|int64](t: typedesc[T]; n: var Cursor): T = result = pool.integers[n.intId].T inc n -template loadField(field) = +template loadField(field) {.dirty.} = field = loadAtom(typeof(field), n) proc loadLoc(c: var DecodeContext; n: var Cursor; loc: var TLoc) = @@ -713,7 +713,7 @@ proc loadType*(c: var DecodeContext; t: PType) = t.n = loadNode(c, n) t.setOwner loadSymStub(c, n) t.sym = loadSymStub(c, n) - loadLoc c, n, t.loc + loadLoc c, n, t.locImpl var kids: seq[PType] = @[] while n.kind != ParRi: diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index 02e689071c..e520f89f66 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -369,7 +369,7 @@ proc genArg(p: BProc, n: PNode, param: PSym; call: PNode; result: var Builder; n let needsIndirect = mapType(p.config, n[0].typ, mapTypeChooser(n[0]) == skParam) != ctArray if needsIndirect: n.typ() = n.typ.exactReplica - n.typ.flags.incl tfVarIsPtr + n.typ.incl tfVarIsPtr a = initLocExprSingleUse(p, n) a = withTmpIfNeeded(p, a, needsTmp) if needsIndirect: a.flags.incl lfIndirect diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index bee0d656a5..eb81c4e562 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -158,9 +158,10 @@ proc getTypeName(m: BModule; typ: PType; sig: SigHash): Rope = else: break let typ = if typ.kind in {tyAlias, tySink, tyOwned}: typ.elementType else: typ + ensureMutable typ if typ.loc.snippet == "": - typ.typeName(typ.loc.snippet) - typ.loc.snippet.add $sig + typ.typeName(typ.locImpl.snippet) + typ.locImpl.snippet.add $sig else: when defined(debugSigHashes): # check consistency: @@ -1459,7 +1460,7 @@ proc genObjectInfo(m: BModule; typ, origType: PType, name: Rope; info: TLineInfo var t = typ.baseClass while t != nil: t = t.skipTypes(skipPtrs) - t.flags.incl tfObjHasKids + t.incl tfObjHasKids t = t.baseClass proc genTupleInfo(m: BModule; typ, origType: PType, name: Rope; info: TLineInfo) = diff --git a/compiler/plugins/itersgen.nim b/compiler/plugins/itersgen.nim index e2c97bdc57..6c0bfd8f30 100644 --- a/compiler/plugins/itersgen.nim +++ b/compiler/plugins/itersgen.nim @@ -33,7 +33,7 @@ proc iterToProcImpl*(c: PContext, n: PNode): PNode = let prc = newSym(skProc, n[3].ident, c.idgen, iter.sym.owner, iter.sym.info) prc.typ = copyType(iter.sym.typ, c.idgen, prc) - excl prc.typ.flags, tfCapturesEnv + excl prc.typ, tfCapturesEnv prc.typ.n.add newSymNode(getEnvParam(iter.sym)) prc.typ.rawAddSon t let orig = iter.sym.ast diff --git a/compiler/sem.nim b/compiler/sem.nim index 48a6aacf30..8d48c67cfe 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -126,7 +126,7 @@ proc fitNodeConsiderViewType(c: PContext, formal: PType, arg: PNode; info: TLine #classifyViewType(formal) != noView: result = newNodeIT(nkHiddenAddr, a.info, formal) result.add a - formal.flags.incl tfVarIsPtr + formal.incl tfVarIsPtr else: result = a diff --git a/compiler/semcall.nim b/compiler/semcall.nim index a80b58be7b..c07a79f5d1 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -847,7 +847,7 @@ proc semResolvedCall(c: PContext, x: var TCandidate, result[0] = newSymNode(finalCallee, getCallLineInfo(result[0])) if containsGenericType(result.typ): result.typ() = newTypeS(tyError, c) - incl result.typ.flags, tfCheckedForDestructor + incl result.typ, tfCheckedForDestructor return let gp = finalCallee.ast[genericParamsPos] if gp.isGenericParams: @@ -945,7 +945,7 @@ proc explicitGenericSym(c: PContext, n: PNode, s: PSym, errors: var CandidateErr diagnostics: m.diagnostics)) return nil var newInst = generateInstance(c, s, m.bindings, n.info) - newInst.typ.flags.excl tfUnresolved + newInst.typ.excl tfUnresolved let info = getCallLineInfo(n) markUsed(c, info, s, isGenericInstance = false) onUse(info, s, isGenericInstance = false) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 4ec7beebeb..31b3770459 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -412,7 +412,7 @@ proc semConv(c: PContext, n: PNode; flags: TExprFlags = {}, expectedType: PType let baseType = semTypeNode(c, n[1], nil).skipTypes({tyTypeDesc}) let t = newTypeS(targetType.kind, c, baseType) if targetType.kind == tyOwned: - t.flags.incl tfHasOwned + t.incl tfHasOwned result = newNodeI(nkType, n.info) result.typ() = makeTypeDesc(c, t) return @@ -919,7 +919,7 @@ proc evalAtCompileTime(c: PContext, n: PNode): PNode = tfUnresolved notin n[i].typ.flags: break maybeLabelAsStatic n.typ() = newTypeS(tyStatic, c, n.typ) - n.typ.flags.incl tfUnresolved + n.typ.incl tfUnresolved # optimization pass: not necessary for correctness of the semantic pass if (callee.kind == skConst or @@ -1847,10 +1847,10 @@ proc asgnToResultVar(c: PContext, n, le, ri: PNode) {.inline.} = if x.sym.kind == skResult and (x.typ.kind in {tyVar, tyLent} or classifyViewType(x.typ) != noView): n[0] = x # 'result[]' --> 'result' n[1] = takeImplicitAddr(c, ri, x.typ.kind == tyLent) - x.typ.flags.incl tfVarIsPtr + x.typ.incl tfVarIsPtr #echo x.info, " setting it for this type ", typeToString(x.typ), " ", n.info elif sfGlobal in x.sym.flags: - x.typ.flags.incl tfVarIsPtr + x.typ.incl tfVarIsPtr proc borrowCheck(c: PContext, n, le, ri: PNode) = const @@ -2124,7 +2124,7 @@ proc semYieldVarResult(c: PContext, n: PNode, restype: PType) = var t = skipTypes(restype, {tyGenericInst, tyAlias, tySink}) case t.kind of tyVar, tyLent: - t.flags.incl tfVarIsPtr # bugfix for #4048, #4910, #6892 + t.incl tfVarIsPtr # bugfix for #4048, #4910, #6892 if n[0].kind in {nkHiddenStdConv, nkHiddenSubConv}: n[0] = n[0][1] n[0] = takeImplicitAddr(c, n[0], t.kind == tyLent) @@ -2132,7 +2132,7 @@ proc semYieldVarResult(c: PContext, n: PNode, restype: PType) = for i in 0.. 0 and base.containsGenericType: t = makeTypeFromExpr(c, copyTree(typExpr)) - t.flags.incl tfNonConstExpr + t.incl tfNonConstExpr else: t = base result.typ() = makeTypeDesc(c, t) @@ -85,7 +85,7 @@ proc semArrGet(c: PContext; n: PNode; flags: TExprFlags): PNode = # expression is compiled early in a generic body result = semGenericStmt(c, x) result.typ() = makeTypeFromExpr(c, copyTree(result)) - result.typ.flags.incl tfNonConstExpr + result.typ.incl tfNonConstExpr return let s = # extract sym from first arg if n.len > 1: @@ -442,7 +442,7 @@ proc semUnown(c: PContext; n: PNode): PNode = copyTypeProps(c.graph, c.idgen.module, result, t) result[^1] = b - result.flags.excl tfHasOwned + result.excl tfHasOwned else: result = t else: diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 36a7cc5584..aab17e5443 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -485,7 +485,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType result.typ() = makeVarType(c, result.typ, tyOwned) # we have to watch out, there are also 'owned proc' types that can be used # multiple times as long as they don't have closures. - result.typ.flags.incl tfHasOwned + result.typ.incl tfHasOwned if t.kind != tyObject: return localErrorNode(c, result, if t.kind != tyGenericBody: "object constructor needs an object type".dup(addTypeNodeDeclaredLoc(c.config, t)) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 9e5c54320e..0c50441cf3 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1119,7 +1119,7 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode = v.typ = newTypeS(iter.kind, c) v.typ.add iterAfterVarLent[i] if tfVarIsPtr in iter.flags: - v.typ.flags.incl tfVarIsPtr + v.typ.incl tfVarIsPtr else: v.typ = iter[i] n[0][i] = newSymNode(v) @@ -1177,7 +1177,7 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode = v.typ = newTypeS(iter.kind, c) v.typ.add iterAfterVarLent[i] if tfVarIsPtr in iter.flags: - v.typ.flags.incl tfVarIsPtr + v.typ.incl tfVarIsPtr else: v.typ = iter[i] n[i] = newSymNode(v) @@ -1549,7 +1549,7 @@ proc checkCovariantParamsUsages(c: PContext; genericType: PType) = case t.kind of tyGenericParam: - t.flags.incl tfWeakCovariant + t.incl tfWeakCovariant return true of tyObject: for field in t.n: @@ -1575,7 +1575,7 @@ proc checkCovariantParamsUsages(c: PContext; genericType: PType) = error("covariant param '" & param.sym.name.s & "' used in a non-covariant position") elif tfWeakCovariant in formalFlags: - param.flags.incl tfWeakCovariant + param.incl tfWeakCovariant result = true elif tfContravariant in param.flags: let formalParam = targetBody[i-1].sym @@ -1667,11 +1667,11 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) = body.size = -1 # could not be computed properly if body.kind == tyObject: # add flags applied to generic type to object (nominal) type - incl(body.flags, oldFlags) + incl(body, oldFlags) # {.inheritable, final.} is already disallowed, but # object might have been assumed to be final if tfInheritable in oldFlags and tfFinal in body.flags: - excl(body.flags, tfFinal) + excl(body, tfFinal) s.typ[^1] = body if tfCovariant in s.typ.flags: checkCovariantParamsUsages(c, s.typ) @@ -1720,7 +1720,7 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) = # flag might be copied from alias/instantiation: let t = body.skipTypes({tyAlias, tyGenericInst}) if not (t.kind == tyDistinct and tfBorrowDot in t.flags): - excl s.typ.flags, tfBorrowDot + excl s.typ, tfBorrowDot localError(c.config, name.info, "only a 'distinct' type can borrow `.`") let aa = a[2] if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and @@ -1730,14 +1730,14 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) = if st.kind == tyGenericBody: st = st.typeBodyImpl internalAssert c.config, st.kind in {tyPtr, tyRef} internalAssert c.config, st.last.sym == nil - incl st.flags, tfRefsAnonObj + incl st, tfRefsAnonObj let objTy = st.last # add flags for `ref object` etc to underlying `object` - incl(objTy.flags, oldFlags) + incl(objTy, oldFlags) # {.inheritable, final.} is already disallowed, but # object might have been assumed to be final if tfInheritable in oldFlags and tfFinal in objTy.flags: - excl(objTy.flags, tfFinal) + excl(objTy, tfFinal) let obj = newSym(skType, getIdent(c.cache, s.name.s & ":ObjectType"), c.idgen, getCurrOwner(c), s.info) obj.flagsImpl.incl sfGeneratedType @@ -2129,7 +2129,7 @@ proc bindDupHook(c: PContext; s: PSym; n: PNode; op: TTypeAttachedOp) = if cond: var obj = t.firstParamType while true: - incl(obj.flags, tfHasAsgn) + incl(obj, tfHasAsgn) if obj.kind in {tyGenericBody, tyGenericInst}: obj = obj.skipModifier elif obj.kind == tyGenericInvocation: obj = obj.genericHead else: break @@ -2184,7 +2184,7 @@ proc bindTypeHook(c: PContext; s: PSym; n: PNode; op: TTypeAttachedOp) = if cond: var obj = t.firstParamType.skipTypes({tyVar}) while true: - incl(obj.flags, tfHasAsgn) + incl(obj, tfHasAsgn) if obj.kind in {tyGenericBody, tyGenericInst}: obj = obj.skipModifier elif obj.kind == tyGenericInvocation: obj = obj.genericHead else: break @@ -2269,7 +2269,7 @@ proc semOverride(c: PContext, s: PSym, n: PNode) = if t.len == 3 and t.returnType == nil and t.firstParamType.kind == tyVar: var obj = t.firstParamType.elementType while true: - incl(obj.flags, tfHasAsgn) + incl(obj, tfHasAsgn) if obj.kind == tyGenericBody: obj = obj.skipModifier elif obj.kind == tyGenericInvocation: obj = obj.genericHead else: break @@ -2497,10 +2497,10 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, if n[patternPos].kind != nkEmpty: n[patternPos] = semPattern(c, n[patternPos], s) if s.kind == skIterator: - s.typ.flags.incl(tfIterator) + s.typ.incl(tfIterator) elif s.kind == skFunc: incl(s, sfNoSideEffect) - incl(s.typ.flags, tfNoSideEffect) + incl(s.typ, tfNoSideEffect) var (proto, comesFromShadowScope) = if isAnon: (nil, false) @@ -2546,7 +2546,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, if n[pragmasPos].kind != nkEmpty and sfBorrow notin s.flags: setEffectsForProcType(c.graph, s.typ, n[pragmasPos], s) - s.typ.flags.incl tfEffectSystemWorkaround + s.typ.incl tfEffectSystemWorkaround # To ease macro generation that produce forwarded .async procs we now # allow a bit redundancy in the pragma declarations. The rule is @@ -2724,7 +2724,7 @@ proc semIterator(c: PContext, n: PNode): PNode = # we require first class iterators to be marked with 'closure' explicitly # -- at least for 0.9.2. if s.typ.callConv == ccClosure: - incl(s.typ.flags, tfCapturesEnv) + incl(s.typ, tfCapturesEnv) else: s.typ.callConv = ccInline if result[bodyPos].kind == nkEmpty and s.magic == mNone and c.inConceptDecl == 0: diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 78f546a0c6..3aca4ea743 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -62,7 +62,7 @@ proc newOrPrevType(kind: TTypeKind, prev: PType, c: PContext): PType = proc newConstraint(c: PContext, k: TTypeKind): PType = result = newTypeS(tyBuiltInTypeClass, c) - result.flags.incl tfCheckedForDestructor + result.incl tfCheckedForDestructor result.addSonSkipIntLit(newTypeS(k, c), c.idgen) proc skipGenericPrev(prev: PType): PType = @@ -151,7 +151,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = if i != 1: if x != counter: needsReorder = true - incl(result.flags, tfEnumHasHoles) + incl(result, tfEnumHasHoles) e.ast = strVal # might be nil counter = x of nkSym: @@ -212,7 +212,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = if isPure and sfExported in result.sym.flags: addPureEnum(c, LazySym(sym: result.sym)) if tfNotNil in e.typ.flags and not hasNull: - result.flags.incl tfRequiresInit + result.incl tfRequiresInit setToStringProc(c.graph, result, genEnumToStrProc(result, n.info, c.graph, c.idgen)) proc semSet(c: PContext, n: PNode, prev: PType): PType = @@ -378,7 +378,7 @@ proc semRangeAux(c: PContext, n: PNode, prev: PType): PType = for i in 0..1: if hasUnresolvedArgs(c, range[i]): result.n.add makeStaticExpr(c, range[i]) - result.flags.incl tfUnresolved + result.incl tfUnresolved else: result.n.add semConstExpr(c, range[i]) @@ -398,15 +398,15 @@ proc semRange(c: PContext, n: PNode, prev: PType): PType = if not isDefined(c.config, "nimPreviewRangeDefault"): let n = result.n if n[0].kind in {nkCharLit..nkUInt64Lit} and n[0].intVal > 0: - incl(result.flags, tfRequiresInit) + incl(result, tfRequiresInit) elif n[1].kind in {nkCharLit..nkUInt64Lit} and n[1].intVal < 0: - incl(result.flags, tfRequiresInit) + incl(result, tfRequiresInit) elif n[0].kind in {nkFloatLit..nkFloat64Lit} and n[0].floatVal > 0.0: - incl(result.flags, tfRequiresInit) + incl(result, tfRequiresInit) elif n[1].kind in {nkFloatLit..nkFloat64Lit} and n[1].floatVal < 0.0: - incl(result.flags, tfRequiresInit) + incl(result, tfRequiresInit) else: if n[1].kind == nkInfix and considerQuotedIdent(c, n[1][0]).s == "..<": localError(c.config, n[0].info, "range types need to be constructed with '..', '..<' is not supported") @@ -453,10 +453,10 @@ proc semArrayIndex(c: PContext, n: PNode): PType = let info = if n.safeLen > 1: n[1].info else: n.info localError(c.config, info, errOrdinalTypeExpected % typeToString(e.typ, preferDesc)) result = makeRangeWithStaticExpr(c, e) - if c.inGenericContext > 0: result.flags.incl tfUnresolved + if c.inGenericContext > 0: result.incl tfUnresolved else: result = e.typ.skipTypes({tyTypeDesc}) - result.flags.incl tfImplicitStatic + result.incl tfImplicitStatic elif e.kind in (nkCallKinds + {nkBracketExpr}) and hasUnresolvedArgs(c, e): if not isOrdinalType(e.typ.skipTypes({tyStatic, tyAlias, tyGenericInst, tySink})): localError(c.config, n[1].info, errOrdinalTypeExpected % typeToString(e.typ, preferDesc)) @@ -1075,8 +1075,8 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType; flags: TTypeFlags): PType c.forwardTypeUpdates.add (result, n) # we retry in the final pass rawAddSon(result, realBase) if realBase == nil and tfInheritable in flags: - result.flags.incl tfInheritable - if tfAcyclic in flags: result.flags.incl tfAcyclic + result.incl tfInheritable + if tfAcyclic in flags: result.incl tfAcyclic if result.n.isNil: result.n = newNodeI(nkRecList, n.info) else: @@ -1091,9 +1091,9 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType; flags: TTypeFlags): PType s.typ = result pragma(c, s, n[0], typePragmas) if base == nil and tfInheritable notin result.flags: - incl(result.flags, tfFinal) + incl(result, tfFinal) if c.inGenericContext == 0 and computeRequiresInit(c, result): - result.flags.incl tfRequiresInit + result.incl tfRequiresInit proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = if n.len < 1: @@ -1136,13 +1136,13 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = addSonSkipIntLit(result, region, c.idgen) addSonSkipIntLit(result, t, c.idgen) if tfPartial in result.flags: - if result.elementType.kind == tyObject: incl(result.elementType.flags, tfPartial) + if result.elementType.kind == tyObject: incl(result.elementType, tfPartial) # if not isNilable: result.flags.incl tfNotNil case wrapperKind of tyOwned: if optOwnedRefs in c.config.globalOptions: let t = newTypeS(tyOwned, c, result) - t.flags.incl tfHasOwned + t.incl tfHasOwned result = t of tySink: let t = newTypeS(tySink, c, result) @@ -1151,7 +1151,7 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = if result.kind == tyRef and c.config.selectedGC in {gcArc, gcOrc, gcAtomicArc} and tfTriggersCompileTime notin result.flags: - result.flags.incl tfHasAsgn + result.incl tfHasAsgn proc findEnforcedStaticType(t: PType): PType = # This handles types such as `static[T] and Foo`, @@ -1211,7 +1211,7 @@ proc addImplicitGeneric(c: PContext; typeClass: PType, typId: PIdent; if sfExplain in owner.flags: s.incl sfExplain if typId == nil: s.incl(sfAnon) s.linkTo(typeClass) - typeClass.flags.incl tfImplicitTypeParam + typeClass.incl tfImplicitTypeParam s.position = genericParams.len genericParams.add newSymNode(s) result = typeClass @@ -1244,7 +1244,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, localError(c.config, info, errMacroBodyDependsOnGenericTypes % paramName) result = addImplicitGeneric(c, newTypeS(tyStatic, c, base), paramTypId, info, genericParams, paramName) - if result != nil: result.flags.incl({tfHasStatic, tfUnresolved}) + if result != nil: result.incl({tfHasStatic, tfUnresolved}) of tyTypeDesc: if tfUnresolved notin paramType.flags: @@ -1255,7 +1255,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, # XXX Why doesn't this check for tyTypeDesc instead? paramTypId = nil let t = newTypeS(tyTypeDesc, c, paramType.base) - incl t.flags, tfCheckedForDestructor + incl t, tfCheckedForDestructor result = addImplicitGeneric(c, t, paramTypId, info, genericParams, paramName) else: result = nil @@ -1305,7 +1305,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, for i in 0.. 0 and base.containsGenericType: result = makeTypeFromExpr(c, copyTree(ex)) - result.flags.incl tfNonConstExpr + result.incl tfNonConstExpr else: result = base fixupTypeOf(c, prev, result) @@ -2014,12 +2014,12 @@ proc semTypeOf2(c: PContext; n: PNode; prev: PType): PType = closeScope(c) result = ex.typ if result.kind == tyFromExpr: - result.flags.incl tfNonConstExpr + result.incl tfNonConstExpr elif result.kind == tyStatic: let base = result.skipTypes({tyStatic}) if c.inGenericContext > 0 and base.containsGenericType: result = makeTypeFromExpr(c, copyTree(ex)) - result.flags.incl tfNonConstExpr + result.incl tfNonConstExpr else: result = base fixupTypeOf(c, prev, result) @@ -2053,14 +2053,14 @@ proc semTypeIdent(c: PContext, n: PNode): PSym = return errorSym(c, n) result = result.typ.sym.copySym(c.idgen) result.typ = exactReplica(result.typ) - result.typ.flags.incl tfUnresolved + result.typ.incl tfUnresolved if result.kind == skGenericParam: if result.typ.kind == tyGenericParam and result.typ.len == 0 and tfWildcard in result.typ.flags: # collapse the wild-card param to a type result.transitionGenericParamToType() - result.typ.flags.excl tfWildcard + result.typ.excl tfWildcard return else: localError(c.config, n.info, errTypeExpected) @@ -2102,7 +2102,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = # for ``typeof(countup(1,3))``, see ``tests/ttoseq``. checkSonsLen(n, 1, c.config) result = semTypeOf(c, n[0], prev) - if result.kind == tyTypeDesc: result.flags.incl tfExplicit + if result.kind == tyTypeDesc: result.incl tfExplicit of nkPar: if n.len == 1: result = semTypeNode(c, n[0], prev) else: @@ -2122,7 +2122,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = if result.skipTypes({tyGenericInst, tyAlias, tySink, tyOwned}).kind in NilableTypes+GenericTypes: if tfNotNil in result.flags: result = freshType(c, result, prev) - result.flags.excl(tfNotNil) + result.excl(tfNotNil) else: localError(c.config, n.info, errGenerated, "invalid type") elif n[0].kind notin nkIdentKinds: @@ -2185,7 +2185,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result = makeTypeFromExpr(c, newTree(nkStmtListType, n.copyTree)) of NilableTypes + {tyGenericInvocation, tyForward}: result = freshType(c, result, prev) - result.flags.incl(tfNotNil) + result.incl(tfNotNil) else: localError(c.config, n.info, errGenerated, "invalid type") of 2: @@ -2231,11 +2231,11 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = of mSeq: result = semContainer(c, n, tySequence, "seq", prev) if optSeqDestructors in c.config.globalOptions: - incl result.flags, tfHasAsgn + incl result, tfHasAsgn of mVarargs: result = semVarargs(c, n, prev) of mTypeDesc, mType, mTypeOf: result = makeTypeDesc(c, semTypeNode(c, n[1], nil)) - result.flags.incl tfExplicit + result.incl tfExplicit of mStatic: result = semStaticType(c, n[1], prev) of mExpr: @@ -2354,7 +2354,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result = newTypeS(tyBuiltInTypeClass, c) let child = newTypeS(tyProc, c) if n.kind == nkIteratorTy: - child.flags.incl tfIterator + child.incl tfIterator if n.len > 0 and n[1].kind != nkEmpty and n[1].len > 0: # typeclass with pragma let symKind = if n.kind == nkIteratorTy: skIterator else: skProc @@ -2372,9 +2372,9 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result = newOrPrevType(tyError, prev, c) if n.kind == nkIteratorTy and result.kind == tyProc: - result.flags.incl(tfIterator) + result.incl(tfIterator) if result.callConv == ccClosure and c.config.selectedGC in {gcArc, gcOrc, gcAtomicArc}: - result.flags.incl tfHasAsgn + result.incl tfHasAsgn of nkEnumTy: result = semEnum(c, n, prev) of nkType: result = n.typ of nkStmtListType: result = semStmtListType(c, n, prev) @@ -2404,7 +2404,7 @@ proc setMagicType(conf: ConfigRef; m: PSym, kind: TTypeKind, size: int) = proc setMagicIntegral(conf: ConfigRef; m: PSym, kind: TTypeKind, size: int) = setMagicType(conf, m, kind, size) - incl m.typ.flags, tfCheckedForDestructor + incl m.typ, tfCheckedForDestructor proc processMagicType(c: PContext, m: PSym) = case m.magic @@ -2428,7 +2428,7 @@ proc processMagicType(c: PContext, m: PSym) = setMagicType(c.config, m, tyString, szUncomputedSize) rawAddSon(m.typ, getSysType(c.graph, m.info, tyChar)) if optSeqDestructors in c.config.globalOptions: - incl m.typ.flags, tfHasAsgn + incl m.typ, tfHasAsgn of mCstring: setMagicIntegral(c.config, m, tyCstring, c.config.target.ptrSize) rawAddSon(m.typ, getSysType(c.graph, m.info, tyChar)) @@ -2465,7 +2465,7 @@ proc processMagicType(c: PContext, m: PSym) = of mSeq: setMagicType(c.config, m, tySequence, szUncomputedSize) if optSeqDestructors in c.config.globalOptions: - incl m.typ.flags, tfHasAsgn + incl m.typ, tfHasAsgn if defined(nimsuggest) or c.config.cmd == cmdCheck: # bug #18985 discard else: @@ -2478,8 +2478,8 @@ proc processMagicType(c: PContext, m: PSym) = setMagicIntegral(c.config, m, tyIterable, 0) rawAddSon(m.typ, newTypeS(tyNone, c)) of mPNimrodNode: - incl m.typ.flags, tfTriggersCompileTime - incl m.typ.flags, tfCheckedForDestructor + incl m.typ, tfTriggersCompileTime + incl m.typ, tfCheckedForDestructor of mException: discard of mBuiltinType: case m.name.s @@ -2487,7 +2487,7 @@ proc processMagicType(c: PContext, m: PSym) = of "sink": setMagicType(c.config, m, tySink, szUncomputedSize) of "owned": setMagicType(c.config, m, tyOwned, c.config.target.ptrSize) - incl m.typ.flags, tfHasOwned + incl m.typ, tfHasOwned else: localError(c.config, m.info, errTypeExpected) else: localError(c.config, m.info, errTypeExpected) @@ -2520,7 +2520,7 @@ proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = if typ.kind == tyTypeDesc: if typ.elementType.kind == tyNone: typ = newTypeS(tyTypeDesc, c, newTypeS(tyNone, c)) - incl typ.flags, tfCheckedForDestructor + incl typ, tfCheckedForDestructor else: typ = semGenericConstraints(c, typ) @@ -2538,9 +2538,9 @@ proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = if typ == nil: typ = newTypeS(tyGenericParam, c) - if father == nil: typ.flags.incl tfWildcard + if father == nil: typ.incl tfWildcard - typ.flags.incl tfGenericTypeParam + typ.incl tfGenericTypeParam for j in 0..