summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semexprs.nim17
-rw-r--r--compiler/types.nim2
-rw-r--r--tests/misc/tunsignedcmp.nim15
3 files changed, 24 insertions, 10 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index aadcdb2f4..da12ec08c 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -1374,20 +1374,19 @@ proc lookUpForDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PSym =
     if onlyCurrentScope: return 
     checkSonsLen(n, 2)
     var m = lookUpForDefined(c, n.sons[0], onlyCurrentScope)
-    if (m != nil) and (m.kind == skModule): 
-      if (n.sons[1].kind == nkIdent): 
-        var ident = n.sons[1].ident
-        if m == c.module: 
-          result = strTableGet(c.topLevelScope.symbols, ident)
-        else: 
-          result = strTableGet(m.tab, ident)
+    if m != nil and m.kind == skModule:
+      let ident = considerQuotedIdent(n[1])
+      if m == c.module:
+        result = strTableGet(c.topLevelScope.symbols, ident)
       else: 
-        localError(n.sons[1].info, errIdentifierExpected, "")
+        result = strTableGet(m.tab, ident)
   of nkAccQuoted:
     result = lookUpForDefined(c, considerQuotedIdent(n), onlyCurrentScope)
   of nkSym:
     result = n.sym
-  else: 
+  of nkOpenSymChoice, nkClosedSymChoice:
+    result = n.sons[0].sym
+  else:
     localError(n.info, errIdentifierExpected, renderTree(n))
     result = nil
 
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