mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
@@ -2228,18 +2228,21 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
|
||||
#discard genProc(c, s)
|
||||
genLit(c, newSymNode(n[namePos].sym), dest)
|
||||
of nkChckRangeF, nkChckRange64, nkChckRange:
|
||||
let
|
||||
tmp0 = c.genx(n[0])
|
||||
tmp1 = c.genx(n[1])
|
||||
tmp2 = c.genx(n[2])
|
||||
c.gABC(n, opcRangeChck, tmp0, tmp1, tmp2)
|
||||
c.freeTemp(tmp1)
|
||||
c.freeTemp(tmp2)
|
||||
if dest >= 0:
|
||||
gABC(c, n, whichAsgnOpc(n), dest, tmp0)
|
||||
c.freeTemp(tmp0)
|
||||
if skipTypes(n.typ, abstractVar).kind in {tyUInt..tyUInt64}:
|
||||
genConv(c, n, n[0], dest)
|
||||
else:
|
||||
dest = tmp0
|
||||
let
|
||||
tmp0 = c.genx(n[0])
|
||||
tmp1 = c.genx(n[1])
|
||||
tmp2 = c.genx(n[2])
|
||||
c.gABC(n, opcRangeChck, tmp0, tmp1, tmp2)
|
||||
c.freeTemp(tmp1)
|
||||
c.freeTemp(tmp2)
|
||||
if dest >= 0:
|
||||
gABC(c, n, whichAsgnOpc(n), dest, tmp0)
|
||||
c.freeTemp(tmp0)
|
||||
else:
|
||||
dest = tmp0
|
||||
of nkEmpty, nkCommentStmt, nkTypeSection, nkConstSection, nkPragma,
|
||||
nkTemplateDef, nkIncludeStmt, nkImportStmt, nkFromStmt, nkExportStmt,
|
||||
nkMixinStmt, nkBindStmt, declarativeDefs, nkMacroDef:
|
||||
|
||||
@@ -17,6 +17,16 @@ doAssert typeOf(myInt16 + 2i32) is int32 # of type `int32`
|
||||
doAssert int32 isnot int64
|
||||
doAssert int32 isnot int
|
||||
|
||||
block: # bug #23947
|
||||
template foo =
|
||||
let test_u64 : uint64 = 0xFF07.uint64
|
||||
let test_u8 : uint8 = test_u64.uint8
|
||||
# Error: illegal conversion from '65287' to '[0..255]'
|
||||
doAssert test_u8 == 7
|
||||
|
||||
static: foo()
|
||||
foo()
|
||||
|
||||
block:
|
||||
# bug #22085
|
||||
const
|
||||
|
||||
Reference in New Issue
Block a user