summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/guards.nim2
-rw-r--r--tests/array/tarray.nim8
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/guards.nim b/compiler/guards.nim
index 52e0a1bdd..8b7dc1d89 100644
--- a/compiler/guards.nim
+++ b/compiler/guards.nim
@@ -436,7 +436,7 @@ proc sameTree*(a, b: PNode): bool =
       if not result and a.sym.magic != mNone:
         result = a.sym.magic == b.sym.magic or sameOpr(a.sym, b.sym)
     of nkIdent: result = a.ident.id == b.ident.id
-    of nkCharLit..nkInt64Lit: result = a.intVal == b.intVal
+    of nkCharLit..nkUInt64Lit: result = a.intVal == b.intVal
     of nkFloatLit..nkFloat64Lit: result = a.floatVal == b.floatVal
     of nkStrLit..nkTripleStrLit: result = a.strVal == b.strVal
     of nkType: result = a.typ == b.typ
diff --git a/tests/array/tarray.nim b/tests/array/tarray.nim
index 30244173a..27288bab3 100644
--- a/tests/array/tarray.nim
+++ b/tests/array/tarray.nim
@@ -582,3 +582,11 @@ template append2*(args: varargs[string, myAppend]): string =
 
 let foo = append2("1", "2", "3")
 echo foo
+
+block t12466:
+  # https://github.com/nim-lang/Nim/issues/12466
+  var a: array[288, uint16]
+  for i in 0'u16 ..< 144'u16:
+    a[0'u16 + i] = i
+  for i in 0'u16 ..< 8'u16:
+    a[0'u16 + i] = i