summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-08-19 20:28:51 +0200
committerAraq <rumpf_a@web.de>2014-08-19 20:28:51 +0200
commit1deb9820f5473afc1469064488f4ed45a2aabb55 (patch)
treef9d9da752bde565c931330998e907e23a81177b1
parent5a2bea7408d98bb951b1c3504d19147d0b419f7a (diff)
downloadNim-1deb9820f5473afc1469064488f4ed45a2aabb55.tar.gz
fixes #1420
-rw-r--r--compiler/types.nim2
-rw-r--r--tests/misc/tunsignedcmp.nim15
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index 7559f4d2d..b25e3f697 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -99,7 +99,7 @@ proc isPureObject(typ: PType): bool =
 
 proc getOrdValue(n: PNode): BiggestInt = 
   case n.kind
-  of nkCharLit..nkInt64Lit: result = n.intVal
+  of nkCharLit..nkUInt64Lit: result = n.intVal
   of nkNilLit: result = 0
   of nkHiddenStdConv: result = getOrdValue(n.sons[1])
   else:
diff --git a/tests/misc/tunsignedcmp.nim b/tests/misc/tunsignedcmp.nim
new file mode 100644
index 000000000..a66fbaae1
--- /dev/null
+++ b/tests/misc/tunsignedcmp.nim
@@ -0,0 +1,15 @@
+discard """
+  output: '''true
+true
+true'''
+"""
+
+# bug 1420
+import unsigned
+
+var x = 40'u32
+var y = 30'u32
+echo x > y # works
+
+echo((40'i32) > (30'i32))
+echo((40'u32) > (30'u32)) # Error: ordinal type expected