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

(cherry picked from commit a3a87cdb29)
This commit is contained in:
Andreas Rumpf
2020-07-29 11:11:58 +02:00
committed by narimiran
parent 9d11fc026b
commit e9d6d2b961
2 changed files with 14 additions and 0 deletions

View File

@@ -545,6 +545,10 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
let constructed = result[1].typ.base
if constructed.requiresInit:
message(c.config, n.info, warnUnsafeDefault, typeToString(constructed))
of mPred:
if n[1].typ.skipTypes(abstractInst).kind in {tyUInt..tyUInt64}:
n[0].sym.magic = mSubU
result = n
else:
result = n

View File

@@ -65,3 +65,13 @@ discard $(x1,)
# bug 13698
let n: csize = 1
echo n.int32
# bug #14616
let limit = 1'u64
let rangeVar = 0'u64 ..< limit
doAssert repr(rangeVar) == """[a = 0,
b = 0]
"""