summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-08-27 16:15:37 +0200
committerGitHub <noreply@github.com>2019-08-27 16:15:37 +0200
commit8df745a42ed49533903e5e6034385c5815b47383 (patch)
tree20a0b51e29e0ee1339787deacc517f388e4f5ec0
parent3f5599b3448737df3a15c47b3d65212e1cb3c4ad (diff)
downloadNim-8df745a42ed49533903e5e6034385c5815b47383.tar.gz
fixes #12056 (#12063)
-rw-r--r--compiler/ast.nim2
-rw-r--r--compiler/semfold.nim7
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index 62a3492cc..45c8d5ace 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -1059,7 +1059,7 @@ template `[]`*(n: Indexable, i: BackwardsIndex): Indexable = n[n.len - i.int]
 template `[]=`*(n: Indexable, i: BackwardsIndex; x: Indexable) = n[n.len - i.int] = x
 
 when defined(useNodeIds):
-  const nodeIdToDebug* = 2322967# 2322968
+  const nodeIdToDebug* = -1 # 2322968
   var gNodeId: int
 
 proc newNode*(kind: TNodeKind): PNode =
diff --git a/compiler/semfold.nim b/compiler/semfold.nim
index 38b29344f..564d7f067 100644
--- a/compiler/semfold.nim
+++ b/compiler/semfold.nim
@@ -50,7 +50,10 @@ proc newIntNodeT*(intVal: Int128, n: PNode; g: ModuleGraph): PNode =
   result.info = n.info
 
 proc newFloatNodeT*(floatVal: BiggestFloat, n: PNode; g: ModuleGraph): PNode =
-  result = newFloatNode(nkFloatLit, floatVal)
+  if n.typ.skipTypes(abstractInst).kind == tyFloat32:
+    result = newFloatNode(nkFloat32Lit, floatVal)
+  else:
+    result = newFloatNode(nkFloatLit, floatVal)
   result.typ = n.typ
   result.info = n.info
 
@@ -176,7 +179,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; g: ModuleGraph): PNode =
   of mOrd: result = newIntNodeT(getOrdValue(a), n, g)
   of mChr: result = newIntNodeT(getInt(a), n, g)
   of mUnaryMinusI, mUnaryMinusI64: result = foldUnarySub(getInt(a), n, g)
-  of mUnaryMinusF64: result = newFloatNodeT(- getFloat(a), n, g)
+  of mUnaryMinusF64: result = newFloatNodeT(-getFloat(a), n, g)
   of mNot: result = newIntNodeT(One - getInt(a), n, g)
   of mCard: result = newIntNodeT(nimsets.cardSet(g.config, a), n, g)
   of mBitnotI: