fixes #14616 [backport:1.2] (#15109)

This commit is contained in:
Andreas Rumpf
2020-07-29 11:11:58 +02:00
committed by GitHub
parent b2a1944587
commit a3a87cdb29
2 changed files with 14 additions and 0 deletions

View File

@@ -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

View File

@@ -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]
"""