mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 06:45:27 +00:00
@@ -1985,8 +1985,10 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc) =
|
||||
discard cgsym(p.module, raiser)
|
||||
# This seems to be bug-compatible with Nim version 1 but what we
|
||||
# should really do here is to check if uint64Value < high(int)
|
||||
let n0t = n[0].typ
|
||||
let boundaryCast =
|
||||
if n[0].typ.skipTypes(abstractVarRange).kind in {tyUInt, tyUInt32, tyUInt64}:
|
||||
if n0t.skipTypes(abstractVarRange).kind in {tyUInt, tyUInt32, tyUInt64} or
|
||||
(n0t.sym != nil and sfSystemModule in n0t.sym.owner.flags and n0t.sym.name.s == "csize"):
|
||||
"(NI64)"
|
||||
else:
|
||||
""
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
discard """
|
||||
output: '''uint'''
|
||||
output: '''uint
|
||||
1'''
|
||||
"""
|
||||
|
||||
# Tests unsigned literals and implicit conversion between uints and ints
|
||||
@@ -60,3 +61,7 @@ discard $x0
|
||||
|
||||
const x1 = cast[uint](-1)
|
||||
discard $(x1,)
|
||||
|
||||
# bug 13698
|
||||
let n: csize = 1
|
||||
echo n.int32
|
||||
|
||||
Reference in New Issue
Block a user