Merge pull request #3878 from cheatfate/issue3864

bug fix: repr() of sized enums presentation Issue #3864
This commit is contained in:
Andreas Rumpf
2016-02-18 17:17:47 +01:00

View File

@@ -76,6 +76,7 @@ proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} =
# we read an 'int' but this may have been too large, so mask the other bits:
let e = if typ.size == 1: e and 0xff
elif typ.size == 2: e and 0xffff
elif typ.size == 4: e and 0xffffffff
else: e
# XXX we need a proper narrowing based on signedness here
#e and ((1 shl (typ.size*8)) - 1)