Skip to content

Commit

Permalink
fixes nim-lang#14616 [backport:1.2] (nim-lang#15109)
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq authored and mildred committed Jan 11, 2021
1 parent 4fa88a2 commit 899a7b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/semmagic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -564,5 +564,9 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
if not checkIsolate(n[1]):
localError(c.config, n.info, "expression cannot be isolated: " & $n[1])
result = n
of mPred:
if n[1].typ.skipTypes(abstractInst).kind in {tyUInt..tyUInt64}:
n[0].sym.magic = mSubU
result = n
else:
result = n
10 changes: 10 additions & 0 deletions tests/misc/tunsignedconv.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ discard $(x1,)
# bug #13698
let n: csize = 1 # xxx should that be csize_t or is that essential here?
doAssert $n.int32 == "1"

# bug #14616

let limit = 1'u64

let rangeVar = 0'u64 ..< limit

doAssert repr(rangeVar) == """[a = 0,
b = 0]
"""

0 comments on commit 899a7b6

Please sign in to comment.