The following code...
import unsigned
const bigu64 = 0xffff_ffff_ffff_ffff'u64
proc echoit(v: seq[tuple[u: uint64, v: uint64]]) =
echo v[0].u
echoit(@[(bigu64, bigu64)])
... results in ...
bash-3.2$ nim --version
Nim Compiler Version 0.11.2 (2015-05-04) [MacOSX: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf
git hash: 3bef848a2cf60008f23e72571d7c20c0eb9fd728
active boot switches: -d:release
bash-3.2$ nim compile --run test.nim
config/nim.cfg(53, 3) Hint: added path: '/Users/pete/.babel/pkgs/' [Path]
config/nim.cfg(54, 3) Hint: added path: '/Users/pete/.nimble/pkgs/' [Path]
Hint: used config file '/Users/pete/Downloads/nim-0.11.2/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: test [Processing]
Hint: unsigned [Processing]
test.nim(13, 11) Error: cannot convert -1 to uint64
Changing the "const" in the example above to "var" results in successful compilation and execution.
Is this a bug, or is it a difference between var and const that I don't understand?
Thanks!
I think I have seen a very similar bug report in github issue tracker:
https://github.com/nim-lang/Nim/issues/2731
So you may have to wait until that one is fixed and try again then.
Thanks! Looks like it just got fixed.
As a point of order, should I just log bugs on this sort of thing when it looks like it's likely a bug, rather than a misunderstanding?