fix last remaining warning when building nim (intVal should be Int128) + minor cleanups (#13841)
This commit is contained in:
parent
c167261735
commit
68539a2926
4 changed files with 29 additions and 47 deletions
|
|
@ -20,26 +20,6 @@ proc errorType*(g: ModuleGraph): PType =
|
|||
result = newType(tyError, g.owners[^1])
|
||||
result.flags.incl tfCheckedForDestructor
|
||||
|
||||
proc newIntNodeT*(intVal: BiggestInt, n: PNode; g: ModuleGraph): PNode {.deprecated: "intVal should be Int128".} =
|
||||
case skipTypes(n.typ, abstractVarRange).kind
|
||||
of tyInt:
|
||||
result = newIntNode(nkIntLit, intVal)
|
||||
# See bug #6989. 'pred' et al only produce an int literal type if the
|
||||
# original type was 'int', not a distinct int etc.
|
||||
if n.typ.kind == tyInt:
|
||||
result.typ = getIntLitType(g, result)
|
||||
else:
|
||||
result.typ = n.typ
|
||||
# hrm, this is not correct: 1 + high(int) shouldn't produce tyInt64 ...
|
||||
#setIntLitType(result)
|
||||
of tyChar:
|
||||
result = newIntNode(nkCharLit, intVal)
|
||||
result.typ = n.typ
|
||||
else:
|
||||
result = newIntNode(nkIntLit, intVal)
|
||||
result.typ = n.typ
|
||||
result.info = n.info
|
||||
|
||||
proc newIntNodeT*(intVal: Int128, n: PNode; g: ModuleGraph): PNode =
|
||||
result = newIntTypeNode(intVal, n.typ)
|
||||
# See bug #6989. 'pred' et al only produce an int literal type if the
|
||||
|
|
@ -436,12 +416,13 @@ proc foldConv(n, a: PNode; g: ModuleGraph; check = false): PNode =
|
|||
of tyBool:
|
||||
case srcTyp.kind
|
||||
of tyFloat..tyFloat64:
|
||||
result = newIntNodeT(int(getFloat(a) != 0.0), n, g)
|
||||
result = newIntNodeT(toInt128(getFloat(a) != 0.0), n, g)
|
||||
of tyChar, tyUInt..tyUInt64, tyInt..tyInt64:
|
||||
result = newIntNodeT(int(a.getOrdValue != 0), n, g)
|
||||
else:
|
||||
result = newIntNodeT(toInt128(a.getOrdValue != 0), n, g)
|
||||
of tyBool, tyEnum: # xxx shouldn't we disallow `tyEnum`?
|
||||
result = a
|
||||
result.typ = n.typ
|
||||
else: doAssert false, $srcTyp.kind
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64:
|
||||
case srcTyp.kind
|
||||
of tyFloat..tyFloat64:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue