summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJacek Sieka <arnetheduck@gmail.com>2016-04-04 21:57:56 +0800
committerJacek Sieka <arnetheduck@gmail.com>2016-04-04 21:59:19 +0800
commitcf5b7cbdefc1da9a5c0c8b54226d52e337855534 (patch)
tree24c52e2ba69bc4a7dd5121013676b34b4bc3fef4
parent73e48f9c9cfa3d6f2dad1d9e11efec2975eca1e5 (diff)
downloadNim-cf5b7cbdefc1da9a5c0c8b54226d52e337855534.tar.gz
fix type used for chckRange node boundaries
else you end up with for example an int64-sized value with an int32
type, when checking int32 -> Natural
-rw-r--r--compiler/transf.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim
index a4a15ea4a..0647553c6 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -414,8 +414,8 @@ proc transformConv(c: PTransf, n: PNode): PTransNode =
         result = newTransNode(nkChckRange, n, 3)
       dest = skipTypes(n.typ, abstractVar)
       result[0] = transform(c, n.sons[1])
-      result[1] = newIntTypeNode(nkIntLit, firstOrd(dest), source).PTransNode
-      result[2] = newIntTypeNode(nkIntLit, lastOrd(dest), source).PTransNode
+      result[1] = newIntTypeNode(nkIntLit, firstOrd(dest), dest).PTransNode
+      result[2] = newIntTypeNode(nkIntLit, lastOrd(dest), dest).PTransNode
   of tyFloat..tyFloat128:
     # XXX int64 -> float conversion?
     if skipTypes(n.typ, abstractVar).kind == tyRange: