diff options
Diffstat (limited to 'compiler/semfold.nim')
-rw-r--r-- | compiler/semfold.nim | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 4131347a2..f0971bf09 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -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: |