Skip to content

Commit

Permalink
guards.nim:sameTree(): handle uint literals correctly (#12483) [backp…
Browse files Browse the repository at this point in the history
…ort]
  • Loading branch information
pyokagan authored and Araq committed Oct 22, 2019
1 parent 2ccd1c3 commit ad3c100
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/guards.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/array/tarray.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ad3c100

Please sign in to comment.