diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-05-11 10:11:08 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-05-11 10:11:08 +0200 |
commit | b92fd30282f5063117ae4616aba366f5f445ed8e (patch) | |
tree | 6b4ac1523c4247a22c9900bf8c5a7166d91f9335 | |
parent | f03391d4775bffb3f51c9be47baf04f8b49e2900 (diff) | |
download | Nim-b92fd30282f5063117ae4616aba366f5f445ed8e.tar.gz |
rename tyExpr/tyStmt to tyUntyped/tyTyped (#11227)
-rw-r--r-- | compiler/ast.nim | 6 | ||||
-rw-r--r-- | compiler/ccgexprs.nim | 4 | ||||
-rw-r--r-- | compiler/ccgtypes.nim | 2 | ||||
-rw-r--r-- | compiler/cgmeth.nim | 2 | ||||
-rw-r--r-- | compiler/evalffi.nim | 5 | ||||
-rw-r--r-- | compiler/jsgen.nim | 2 | ||||
-rw-r--r-- | compiler/liftdestructors.nim | 2 | ||||
-rw-r--r-- | compiler/lowerings.nim | 4 | ||||
-rw-r--r-- | compiler/patterns.nim | 4 | ||||
-rw-r--r-- | compiler/plugins/locals.nim | 2 | ||||
-rw-r--r-- | compiler/sem.nim | 18 | ||||
-rw-r--r-- | compiler/semdata.nim | 2 | ||||
-rw-r--r-- | compiler/semexprs.nim | 6 | ||||
-rw-r--r-- | compiler/semstmts.nim | 12 | ||||
-rw-r--r-- | compiler/semtempl.nim | 10 | ||||
-rw-r--r-- | compiler/semtypes.nim | 12 | ||||
-rw-r--r-- | compiler/sigmatch.nim | 22 | ||||
-rw-r--r-- | compiler/suggest.nim | 6 | ||||
-rw-r--r-- | compiler/types.nim | 10 | ||||
-rw-r--r-- | compiler/vmdeps.nim | 4 | ||||
-rw-r--r-- | compiler/vmgen.nim | 6 | ||||
-rw-r--r-- | lib/system/hti.nim | 4 |
22 files changed, 72 insertions, 73 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 76665809a..ad2928521 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -347,7 +347,7 @@ type # (apparently something with bootstrapping) # if you need to add a type, they can apparently be reused tyNone, tyBool, tyChar, - tyEmpty, tyAlias, tyNil, tyExpr, tyStmt, tyTypeDesc, + tyEmpty, tyAlias, tyNil, tyUntyped, tyTyped, tyTypeDesc, tyGenericInvocation, # ``T[a, b]`` for types to invoke tyGenericBody, # ``T[a, b, body]`` last parameter is the body tyGenericInst, # ``T[a, b, realInstance]`` instantiated generic type @@ -448,7 +448,7 @@ const tyUserTypeClass, tyUserTypeClassInst, tyAnd, tyOr, tyNot, tyAnything} - tyMetaTypes* = {tyGenericParam, tyTypeDesc, tyExpr} + tyTypeClasses + tyMetaTypes* = {tyGenericParam, tyTypeDesc, tyUntyped} + tyTypeClasses tyUserTypeClasses* = {tyUserTypeClass, tyUserTypeClassInst} type @@ -1713,7 +1713,7 @@ proc isAtom*(n: PNode): bool {.inline.} = proc isEmptyType*(t: PType): bool {.inline.} = ## 'void' and 'stmt' types are often equivalent to 'nil' these days: - result = t == nil or t.kind in {tyVoid, tyStmt} + result = t == nil or t.kind in {tyVoid, tyTyped} proc makeStmtList*(n: PNode): PNode = if n.kind == nkStmtList: diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index ec32f5975..77cb1cc6f 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2720,8 +2720,8 @@ proc getDefaultValue(p: BProc; typ: PType; info: TLineInfo): Rope = of tyBool: result = rope"NIM_FALSE" of tyEnum, tyChar, tyInt..tyInt64, tyUInt..tyUInt64: result = rope"0" of tyFloat..tyFloat128: result = rope"0.0" - of tyCString, tyString, tyVar, tyLent, tyPointer, tyPtr, tySequence, tyExpr, - tyStmt, tyTypeDesc, tyStatic, tyRef, tyNil: + of tyCString, tyString, tyVar, tyLent, tyPointer, tyPtr, tySequence, tyUntyped, + tyTyped, tyTypeDesc, tyStatic, tyRef, tyNil: result = rope"NIM_NIL" of tyProc: if t.callConv != ccClosure: diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index abdb97e5d..5b46728fe 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -152,7 +152,7 @@ proc mapSetType(conf: ConfigRef; typ: PType): TCTypeKind = proc mapType(conf: ConfigRef; typ: PType): TCTypeKind = ## Maps a Nim type to a C type case typ.kind - of tyNone, tyStmt: result = ctVoid + of tyNone, tyTyped: result = ctVoid of tyBool: result = ctBool of tyChar: result = ctChar of tySet: result = mapSetType(conf, typ) diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index d9e99a84a..db548ccc9 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -91,7 +91,7 @@ proc sameMethodBucket(a, b: PSym): MethodResult = if result == Yes: # check for return type: if not sameTypeOrNil(a.typ.sons[0], b.typ.sons[0]): - if b.typ.sons[0] != nil and b.typ.sons[0].kind == tyExpr: + if b.typ.sons[0] != nil and b.typ.sons[0].kind == tyUntyped: # infer 'auto' from the base to make it consistent: b.typ.sons[0] = a.typ.sons[0] else: diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index 9b2a4f93c..ae48c4a95 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -90,8 +90,8 @@ proc mapType(conf: ConfigRef, t: ast.PType): ptr libffi.TType = else: result = nil of tyFloat, tyFloat64: result = addr libffi.type_double of tyFloat32: result = addr libffi.type_float - of tyVar, tyLent, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString, tyExpr, - tyStmt, tyTypeDesc, tyProc, tyArray, tyStatic, tyNil: + of tyVar, tyLent, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString, tyUntyped, + tyTyped, tyTypeDesc, tyProc, tyArray, tyStatic, tyNil: result = addr libffi.type_pointer of tyDistinct, tyAlias, tySink: result = mapType(conf, t.sons[0]) @@ -498,4 +498,3 @@ proc callForeignFunction*(conf: ConfigRef, fn: PNode, fntyp: PType, let t = args[i+start].typ args[i+start] = unpack(conf, cargs[i], t, args[i+start]) dealloc cargs[i] - diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 193077760..795f1012f 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -190,7 +190,7 @@ proc mapType(typ: PType): TJSTypeKind = of tyNil: result = etyNull of tyGenericParam, tyGenericBody, tyGenericInvocation, tyNone, tyFromExpr, tyForward, tyEmpty, - tyExpr, tyStmt, tyTypeDesc, tyBuiltInTypeClass, tyCompositeTypeClass, + tyUntyped, tyTyped, tyTypeDesc, tyBuiltInTypeClass, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything, tyVoid: result = etyNone of tyGenericInst, tyInferred, tyAlias, tyUserTypeClass, tyUserTypeClassInst, diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index 3e3b74f64..d308aedd9 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -487,7 +487,7 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) = localError(c.graph.config, c.info, "cannot copy openArray") of tyFromExpr, tyProxy, tyBuiltInTypeClass, tyUserTypeClass, tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything, - tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt, + tyGenericParam, tyGenericBody, tyNil, tyUntyped, tyTyped, tyTypeDesc, tyGenericInvocation, tyForward: #internalError(c.graph.config, c.info, "assignment requested for type: " & typeToString(t)) discard diff --git a/compiler/lowerings.nim b/compiler/lowerings.nim index 0b2d56a54..efaba5cf7 100644 --- a/compiler/lowerings.nim +++ b/compiler/lowerings.nim @@ -204,7 +204,7 @@ proc addField*(obj: PType; s: PSym; cache: IdentCache) = field.id = -s.id let t = skipIntLit(s.typ) field.typ = t - assert t.kind != tyStmt + assert t.kind != tyTyped field.position = sonsLen(obj.n) addSon(obj.n, newSymNode(field)) @@ -216,7 +216,7 @@ proc addUniqueField*(obj: PType; s: PSym; cache: IdentCache): PSym {.discardable field.id = -s.id let t = skipIntLit(s.typ) field.typ = t - assert t.kind != tyStmt + assert t.kind != tyTyped field.position = sonsLen(obj.n) addSon(obj.n, newSymNode(field)) result = field diff --git a/compiler/patterns.nim b/compiler/patterns.nim index 560382d93..d9a6e7d1d 100644 --- a/compiler/patterns.nim +++ b/compiler/patterns.nim @@ -78,7 +78,7 @@ proc checkTypes(c: PPatternContext, p: PSym, n: PNode): bool = result = matchNodeKinds(p.constraint, n) if not result: return if isNil(n.typ): - result = p.typ.kind in {tyVoid, tyStmt} + result = p.typ.kind in {tyVoid, tyTyped} else: result = sigmatch.argtypeMatches(c.c, p.typ, n.typ, fromHlo = true) @@ -241,7 +241,7 @@ proc aliasAnalysisRequested(params: PNode): bool = if whichAlias(param) != aqNone: return true proc addToArgList(result, n: PNode) = - if n.typ != nil and n.typ.kind != tyStmt: + if n.typ != nil and n.typ.kind != tyTyped: if n.kind != nkArgList: result.add(n) else: for i in 0 ..< n.len: result.add(n.sons[i]) diff --git a/compiler/plugins/locals.nim b/compiler/plugins/locals.nim index 4dd3e8f9c..eb3324b36 100644 --- a/compiler/plugins/locals.nim +++ b/compiler/plugins/locals.nim @@ -26,7 +26,7 @@ proc semLocals*(c: PContext, n: PNode): PNode = #if it.owner != c.p.owner: return result if it.kind in skLocalVars and it.typ.skipTypes({tyGenericInst, tyVar}).kind notin - {tyVarargs, tyOpenArray, tyTypeDesc, tyStatic, tyExpr, tyStmt, tyEmpty}: + {tyVarargs, tyOpenArray, tyTypeDesc, tyStatic, tyUntyped, tyTyped, tyEmpty}: var field = newSym(skField, it.name, getCurrOwner(c), n.info) field.typ = it.typ.skipTypes({tyVar}) diff --git a/compiler/sem.nim b/compiler/sem.nim index c81e11c36..d4e944028 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -79,7 +79,7 @@ template semIdeForTemplateOrGeneric(c: PContext; n: PNode; proc fitNodePostMatch(c: PContext, formal: PType, arg: PNode): PNode = result = arg let x = result.skipConv - if x.kind in {nkPar, nkTupleConstr, nkCurly} and formal.kind != tyExpr: + if x.kind in {nkPar, nkTupleConstr, nkCurly} and formal.kind != tyUntyped: changeType(c, x, formal, check=true) else: result = skipHiddenSubConv(result) @@ -106,7 +106,7 @@ proc fitNode(c: PContext, formal: PType, arg: PNode; info: TLineInfo): PNode = proc inferWithMetatype(c: PContext, formal: PType, arg: PNode, coerceDistincts = false): PNode -template commonTypeBegin*(): PType = PType(kind: tyExpr) +template commonTypeBegin*(): PType = PType(kind: tyUntyped) proc commonType*(x, y: PType): PType = # new type relation that is used for array constructors, @@ -116,10 +116,10 @@ proc commonType*(x, y: PType): PType = var a = skipTypes(x, {tyGenericInst, tyAlias, tySink}) var b = skipTypes(y, {tyGenericInst, tyAlias, tySink}) result = x - if a.kind in {tyExpr, tyNil}: result = y - elif b.kind in {tyExpr, tyNil}: result = x - elif a.kind == tyStmt: result = a - elif b.kind == tyStmt: result = b + if a.kind in {tyUntyped, tyNil}: result = y + elif b.kind in {tyUntyped, tyNil}: result = x + elif a.kind == tyTyped: result = a + elif b.kind == tyTyped: result = b elif a.kind == tyTypeDesc: # turn any concrete typedesc into the abstract typedesc type if a.len == 0: result = a @@ -290,7 +290,7 @@ proc fixupTypeAfterEval(c: PContext, evaluated, eOrig: PNode): PNode = # recompute the types as 'eval' isn't guaranteed to construct types nor # that the types are sound: when true: - if eOrig.typ.kind in {tyExpr, tyStmt, tyTypeDesc}: + if eOrig.typ.kind in {tyUntyped, tyTyped, tyTypeDesc}: result = semExprWithType(c, evaluated) else: result = evaluated @@ -406,12 +406,12 @@ proc semAfterMacroCall(c: PContext, call, macroResult: PNode, result = semStmt(c, result, flags) else: case s.typ.sons[0].kind - of tyExpr: + of tyUntyped: # BUGFIX: we cannot expect a type here, because module aliases would not # work then (see the ``tmodulealias`` test) # semExprWithType(c, result) result = semExpr(c, result, flags) - of tyStmt: + of tyTyped: result = semStmt(c, result, flags) of tyTypeDesc: if result.kind == nkStmtList: result.kind = nkStmtListType diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 637a13101..05816850a 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -213,7 +213,7 @@ proc newOptionEntry*(conf: ConfigRef): POptionEntry = proc newContext*(graph: ModuleGraph; module: PSym): PContext = new(result) - result.enforceVoidContext = PType(kind: tyStmt) + result.enforceVoidContext = PType(kind: tyTyped) result.ambiguousSymbols = initIntSet() result.optionStack = @[] result.libs = @[] diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 9b36d41ec..44d7cfffd 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -573,7 +573,7 @@ proc fixAbstractType(c: PContext, n: PNode) = if skipTypes(it.sons[1].typ, abstractVar).kind in {tyNil, tyTuple, tySet} or it[1].isArrayConstr: var s = skipTypes(it.typ, abstractVar) - if s.kind != tyExpr: + if s.kind != tyUntyped: changeType(c, it.sons[1], s, check=true) n.sons[i] = it.sons[1] @@ -1779,7 +1779,7 @@ proc semYield(c: PContext, n: PNode): PNode = var iterType = c.p.owner.typ let restype = iterType.sons[0] if restype != nil: - if restype.kind != tyExpr: + if restype.kind != tyUntyped: n.sons[0] = fitNode(c, restype, n.sons[0], n.info) if n.sons[0].typ == nil: internalError(c.config, n.info, "semYield") @@ -1878,7 +1878,7 @@ proc semExpandToAst(c: PContext, n: PNode): PNode = if isCallExpr(macroCall): for i in 1 ..< macroCall.len: - #if macroCall.sons[0].typ.sons[i].kind != tyExpr: + #if macroCall.sons[0].typ.sons[i].kind != tyUntyped: macroCall.sons[i] = semExprWithType(c, macroCall[i], {}) # performing overloading resolution here produces too serious regressions: let headSymbol = macroCall[0] diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 6a92e9221..c84fbd14e 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -133,7 +133,7 @@ proc fixNilType(c: PContext; n: PNode) = proc discardCheck(c: PContext, result: PNode, flags: TExprFlags) = if c.matchedConcept != nil or efInTypeof in flags: return - if result.typ != nil and result.typ.kind notin {tyStmt, tyVoid}: + if result.typ != nil and result.typ.kind notin {tyTyped, tyVoid}: if implicitlyDiscardable(result): var n = newNodeI(nkDiscardStmt, result.info, 1) n[0] = result @@ -166,7 +166,7 @@ proc semIf(c: PContext, n: PNode; flags: TExprFlags): PNode = it.sons[0] = semExprBranchScope(c, it.sons[0]) typ = commonType(typ, it.sons[0]) else: illFormedAst(it, c.config) - if isEmptyType(typ) or typ.kind in {tyNil, tyExpr} or + if isEmptyType(typ) or typ.kind in {tyNil, tyUntyped} or (not hasElse and efInTypeof notin flags): for it in n: discardCheck(c, it.lastSon, flags) result.kind = nkIfStmt @@ -265,7 +265,7 @@ proc semTry(c: PContext, n: PNode; flags: TExprFlags): PNode = closeScope(c) dec c.p.inTryStmt - if isEmptyType(typ) or typ.kind in {tyNil, tyExpr}: + if isEmptyType(typ) or typ.kind in {tyNil, tyUntyped}: discardCheck(c, n.sons[0], flags) for i in 1..n.len-1: discardCheck(c, n.sons[i].lastSon, flags) if typ == c.enforceVoidContext: @@ -919,7 +919,7 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode = else: localError(c.config, n.info, "not all cases are covered") closeScope(c) - if isEmptyType(typ) or typ.kind in {tyNil, tyExpr} or + if isEmptyType(typ) or typ.kind in {tyNil, tyUntyped} or (not hasElse and efInTypeof notin flags): for i in 1..n.len-1: discardCheck(c, n.sons[i].lastSon, flags) # propagate any enforced VoidContext: @@ -1952,7 +1952,7 @@ proc semMethod(c: PContext, n: PNode): PNode = # test case): let disp = getDispatcher(s) # auto return type? - if disp != nil and disp.typ.sons[0] != nil and disp.typ.sons[0].kind == tyExpr: + if disp != nil and disp.typ.sons[0] != nil and disp.typ.sons[0].kind == tyUntyped: let ret = s.typ.sons[0] disp.typ.sons[0] = ret if disp.ast[resultPos].kind == nkSym: @@ -1989,7 +1989,7 @@ proc semMacroDef(c: PContext, n: PNode): PNode = var allUntyped = true for i in 1 .. t.n.len-1: let param = t.n.sons[i].sym - if param.typ.kind != tyExpr: allUntyped = false + if param.typ.kind != tyUntyped: allUntyped = false if allUntyped: incl(s.flags, sfAllUntyped) if t.sons[0] == nil: localError(c.config, n.info, "macro needs a return type") if n.sons[bodyPos].kind == nkEmpty: diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 4b283f793..01a0a41bb 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -595,21 +595,21 @@ proc semTemplateDef(c: PContext, n: PNode): PNode = for i in 1 .. s.typ.n.len-1: let param = s.typ.n.sons[i].sym param.flags.excl sfGenSym - if param.typ.kind != tyExpr: allUntyped = false + if param.typ.kind != tyUntyped: allUntyped = false if sonsLen(gp) > 0: if n.sons[genericParamsPos].kind == nkEmpty: # we have a list of implicit type parameters: n.sons[genericParamsPos] = gp - # no explicit return type? -> use tyStmt + # no explicit return type? -> use tyTyped if n.sons[paramsPos].sons[0].kind == nkEmpty: # use ``stmt`` as implicit result type - s.typ.sons[0] = newTypeS(tyStmt, c) + s.typ.sons[0] = newTypeS(tyTyped, c) s.typ.n.sons[0] = newNodeIT(nkType, n.info, s.typ.sons[0]) else: s.typ = newTypeS(tyProc, c) - # XXX why do we need tyStmt as a return type again? + # XXX why do we need tyTyped as a return type again? s.typ.n = newNodeI(nkFormalParams, n.info) - rawAddSon(s.typ, newTypeS(tyStmt, c)) + rawAddSon(s.typ, newTypeS(tyTyped, c)) addSon(s.typ.n, newNodeIT(nkType, n.info, s.typ.sons[0])) if allUntyped: incl(s.flags, sfAllUntyped) if n.sons[patternPos].kind != nkEmpty: diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 28fc12a21..e24ecdbdf 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1110,7 +1110,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, var owner = getCurrOwner(c).owner # TODO: Disallow typed/untyped in procs in the compiler/stdlib if (owner.kind != skModule or owner.owner.name.s != "stdlib") and - kind == skProc and (typ.kind == tyStmt or typ.kind == tyExpr): + kind == skProc and (typ.kind == tyTyped or typ.kind == tyUntyped): localError(c.config, a.sons[length-2].info, "'" & typ.sym.name.s & "' is only allowed in templates and macros") if hasDefault: @@ -1155,7 +1155,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, if not hasType and not hasDefault: if isType: localError(c.config, a.info, "':' expected") if kind in {skTemplate, skMacro}: - typ = newTypeS(tyExpr, c) + typ = newTypeS(tyUntyped, c) elif skipTypes(typ, {tyGenericInst, tyAlias, tySink}).kind == tyVoid: continue @@ -1192,14 +1192,14 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, # turn explicit 'void' return type into 'nil' because the rest of the # compiler only checks for 'nil': if skipTypes(r, {tyGenericInst, tyAlias, tySink}).kind != tyVoid: - if kind notin {skMacro, skTemplate} and r.kind in {tyStmt, tyExpr}: + if kind notin {skMacro, skTemplate} and r.kind in {tyTyped, tyUntyped}: localError(c.config, n.sons[0].info, "return type '" & typeToString(r) & "' is only valid for macros and templates") # 'auto' as a return type does not imply a generic: elif r.kind == tyAnything: # 'p(): auto' and 'p(): expr' are equivalent, but the rest of the # compiler is hardly aware of 'auto': - r = newTypeS(tyExpr, c) + r = newTypeS(tyUntyped, c) else: if r.sym == nil or sfAnon notin r.sym.flags: let lifted = liftParamType(c, kind, genericParams, r, "result", @@ -1824,9 +1824,9 @@ proc processMagicType(c: PContext, m: PSym) = if m.name.s == "auto": setMagicIntegral(c.config, m, tyAnything, 0) else: - setMagicIntegral(c.config, m, tyExpr, 0) + setMagicIntegral(c.config, m, tyUntyped, 0) of mStmt: - setMagicIntegral(c.config, m, tyStmt, 0) + setMagicIntegral(c.config, m, tyTyped, 0) of mTypeDesc, mType: setMagicIntegral(c.config, m, tyTypeDesc, 0) rawAddSon(m.typ, newTypeS(tyNone, c)) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 326de1706..d2ac311c8 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -214,7 +214,7 @@ proc sumGeneric(t: PType): int = break of tyStatic: return t.sons[0].sumGeneric + 1 - of tyGenericParam, tyExpr, tyStmt: break + of tyGenericParam, tyUntyped, tyTyped: break of tyAlias, tySink: t = t.lastSon of tyBool, tyChar, tyEnum, tyObject, tyPointer, tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128, @@ -988,7 +988,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, result = isNone assert(f != nil) - if f.kind == tyExpr: + if f.kind == tyUntyped: if aOrig != nil: put(c, f, aOrig) return isGeneric @@ -1215,7 +1215,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, if f.kind == tyVarargs: if tfVarargs in a.flags: return typeRel(c, f.base, a.lastSon) - if f.sons[0].kind == tyStmt: return + if f.sons[0].kind == tyTyped: return template matchArrayOrSeq(aBase: PType) = let ff = f.base @@ -1770,7 +1770,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, else: result = isNone - of tyStmt: + of tyTyped: if aOrig != nil: put(c, f, aOrig) result = isGeneric @@ -1975,7 +1975,7 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType, # XXX: duplicating this is ugly, but we cannot (!) move this # directly into typeRel using return-like templates incMatches(m, r) - if f.kind == tyStmt: + if f.kind == tyTyped: return arg elif f.kind == tyTypeDesc: return arg @@ -2173,9 +2173,9 @@ proc paramTypesMatch*(m: var TCandidate, f, a: PType, if x.state != csMatch: internalError(m.c.graph.config, arg.info, "x.state is not csMatch") # ambiguous: more than one symbol fits! - # See tsymchoice_for_expr as an example. 'f.kind == tyExpr' should match + # See tsymchoice_for_expr as an example. 'f.kind == tyUntyped' should match # anyway: - if f.kind in {tyExpr, tyStmt}: result = arg + if f.kind in {tyUntyped, tyTyped}: result = arg else: result = nil else: # only one valid interpretation found: @@ -2199,8 +2199,8 @@ proc setSon(father: PNode, at: int, son: PNode) = # we are allowed to modify the calling node in the 'prepare*' procs: proc prepareOperand(c: PContext; formal: PType; a: PNode): PNode = - if formal.kind == tyExpr and formal.len != 1: - # {tyTypeDesc, tyExpr, tyStmt, tyProxy}: + if formal.kind == tyUntyped and formal.len != 1: + # {tyTypeDesc, tyUntyped, tyTyped, tyProxy}: # a.typ == nil is valid result = a elif a.typ.isNil: @@ -2209,7 +2209,7 @@ proc prepareOperand(c: PContext; formal: PType; a: PNode): PNode = let flags = {efDetermineType, efAllowStmt} #if formal.kind == tyIter: {efDetermineType, efWantIterator} #else: {efDetermineType, efAllowStmt} - #elif formal.kind == tyStmt: {efDetermineType, efWantStmt} + #elif formal.kind == tyTyped: {efDetermineType, efWantStmt} #else: {efDetermineType} result = c.semOperand(c, a, flags) else: @@ -2244,7 +2244,7 @@ proc incrIndexType(t: PType) = inc t.sons[0].n.sons[1].intVal template isVarargsUntyped(x): untyped = - x.kind == tyVarargs and x.sons[0].kind == tyExpr + x.kind == tyVarargs and x.sons[0].kind == tyUntyped proc matchesAux(c: PContext, n, nOrig: PNode, m: var TCandidate, marker: var IntSet) = diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 6ae7c216f..e98451510 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -258,7 +258,7 @@ proc getQuality(s: PSym): range[0..100] = if s.typ != nil and s.typ.len > 1: var exp = s.typ.sons[1].skipTypes({tyGenericInst, tyVar, tyLent, tyAlias, tySink}) if exp.kind == tyVarargs: exp = elemType(exp) - if exp.kind in {tyExpr, tyStmt, tyGenericParam, tyAnything}: return 50 + if exp.kind in {tyUntyped, tyTyped, tyGenericParam, tyAnything}: return 50 return 100 template wholeSymTab(cond, section: untyped) = @@ -319,7 +319,7 @@ proc suggestCall(c: PContext, n, nOrig: PNode, outputs: var Suggestions) = proc typeFits(c: PContext, s: PSym, firstArg: PType): bool {.inline.} = if s.typ != nil and sonsLen(s.typ) > 1 and s.typ.sons[1] != nil: - # special rule: if system and some weird generic match via 'tyExpr' + # special rule: if system and some weird generic match via 'tyUntyped' # or 'tyGenericParam' we won't list it either to reduce the noise (nobody # wants 'system.`-|` as suggestion let m = s.getModule() @@ -327,7 +327,7 @@ proc typeFits(c: PContext, s: PSym, firstArg: PType): bool {.inline.} = if s.kind == skType: return var exp = s.typ.sons[1].skipTypes({tyGenericInst, tyVar, tyLent, tyAlias, tySink}) if exp.kind == tyVarargs: exp = elemType(exp) - if exp.kind in {tyExpr, tyStmt, tyGenericParam, tyAnything}: return + if exp.kind in {tyUntyped, tyTyped, tyGenericParam, tyAnything}: return result = sigmatch.argtypeMatches(c, s.typ.sons[1], firstArg) proc suggestOperations(c: PContext, n, f: PNode, typ: PType, outputs: var Suggestions) = diff --git a/compiler/types.nim b/compiler/types.nim index f702a7521..e07d97948 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -522,7 +522,7 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = result.add(" or ") of tyNot: result = "not " & typeToString(t.sons[0]) - of tyExpr: + of tyUntyped: #internalAssert t.len == 0 result = "untyped" of tyFromExpr: @@ -1033,7 +1033,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = case a.kind of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, - tyInt..tyUInt64, tyStmt, tyExpr, tyVoid: + tyInt..tyUInt64, tyTyped, tyUntyped, tyVoid: result = sameFlags(a, b) of tyStatic, tyFromExpr: result = exprStructuralEquivalent(a.n, b.n) and sameFlags(a, b) @@ -1231,7 +1231,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, of tyTypeDesc: # XXX: This is still a horrible idea... result = nil - of tyExpr, tyStmt, tyStatic: + of tyUntyped, tyTyped, tyStatic: if kind notin {skParam, skResult}: result = t of tyVoid: if taField notin flags: result = t @@ -1475,7 +1475,7 @@ proc skipConvTakeType*(n: PNode): PNode = proc isEmptyContainer*(t: PType): bool = case t.kind - of tyExpr, tyNil: result = true + of tyUntyped, tyNil: result = true of tyArray: result = t.sons[1].kind == tyEmpty of tySet, tySequence, tyOpenArray, tyVarargs: result = t.sons[0].kind == tyEmpty @@ -1506,7 +1506,7 @@ proc skipHiddenSubConv*(n: PNode): PNode = result = n.sons[1] let arg = result.typ let dest = takeType(formal, arg) - if dest == arg and formal.kind != tyExpr: + if dest == arg and formal.kind != tyUntyped: #echo n.info, " came here for ", formal.typeToString result = n else: diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 6d9c56c0e..5887837f6 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -91,8 +91,8 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; of tyBool: result = atomicType("bool", mBool) of tyChar: result = atomicType("char", mChar) of tyNil: result = atomicType("nil", mNil) - of tyExpr: result = atomicType("expr", mExpr) - of tyStmt: result = atomicType("stmt", mStmt) + of tyUntyped: result = atomicType("expr", mExpr) + of tyTyped: result = atomicType("stmt", mStmt) of tyVoid: result = atomicType("void", mVoid) of tyEmpty: result = atomicType("empty", mNone) of tyUncheckedArray: diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 9d9260563..890f28065 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -1378,7 +1378,7 @@ proc genMarshalStore(c: PCtx, n: PNode, dest: var TDest) = const atomicTypes = {tyBool, tyChar, - tyExpr, tyStmt, tyTypeDesc, tyStatic, + tyUntyped, tyTyped, tyTypeDesc, tyStatic, tyEnum, tyOrdinal, tyRange, @@ -1766,8 +1766,8 @@ proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode = of tyCString, tyString: result = newNodeIT(nkStrLit, info, t) result.strVal = "" - of tyVar, tyLent, tyPointer, tyPtr, tyExpr, - tyStmt, tyTypeDesc, tyRef, tyNil: + of tyVar, tyLent, tyPointer, tyPtr, tyUntyped, + tyTyped, tyTypeDesc, tyRef, tyNil: result = newNodeIT(nkNilLit, info, t) of tyProc: if t.callConv != ccClosure: diff --git a/lib/system/hti.nim b/lib/system/hti.nim index e23c6418c..3c5abd073 100644 --- a/lib/system/hti.nim +++ b/lib/system/hti.nim @@ -17,8 +17,8 @@ type tyEmpty, tyArrayConstr, tyNil, - tyExpr, - tyStmt, + tyUntyped, + tyTyped, tyTypeDesc, tyGenericInvocation, # ``T[a, b]`` for types to invoke tyGenericBody, # ``T[a, b, body]`` last parameter is the body |