summary refs log tree commit diff stats
path: root/compiler/sigmatch.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-07-05 00:03:33 +0200
committerAraq <rumpf_a@web.de>2012-07-05 00:03:33 +0200
commit36247e0947699a56d5bc51d48188b6dda1815587 (patch)
treeaf837b557356d4495ce93d5fe735c9ccab169e2e /compiler/sigmatch.nim
parent8ef48a34e5916deccd58a312228c7d2efe39d170 (diff)
downloadNim-36247e0947699a56d5bc51d48188b6dda1815587.tar.gz
added devel/logging; weakrefs test; next steps for proper unsigned support
Diffstat (limited to 'compiler/sigmatch.nim')
-rwxr-xr-xcompiler/sigmatch.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 7a5d959df..6819bb37f 100755
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -162,7 +162,7 @@ proc handleRange(f, a: PType, min, max: TTypeKind): TTypeRelation =
   else:
     var k = skipTypes(a, {tyRange}).kind
     if k == f.kind: result = isSubtype
-    elif k == tyInt:
+    elif k == tyInt and f.kind in {tyRange, tyInt8..tyUInt64}:
       # and a.n != nil and a.n.intVal >= firstOrd(f) and
       #                    a.n.intVal <= lastOrd(f):
       # integer literal in the proper range; we want ``i16 + 4`` to stay an
@@ -188,7 +188,9 @@ proc handleFloatRange(f, a: PType): TTypeRelation =
   else: 
     var k = skipTypes(a, {tyRange}).kind
     if k == f.kind: result = isSubtype
-    elif (k >= tyFloat) and (k <= tyFloat128): result = isConvertible
+    elif k == tyInt and f.kind >= tyFloat and f.kind <= tyFloat128:
+      result = isIntConv
+    elif k >= tyFloat and k <= tyFloat128: result = isConvertible
     else: result = isNone
   
 proc isObjectSubtype(a, f: PType): bool =