parent
a2587aad0d
commit
fb54f394e8
2 changed files with 13 additions and 3 deletions
|
|
@ -1529,7 +1529,7 @@ proc genRdVar(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) =
|
||||||
|
|
||||||
template needsRegLoad(): untyped =
|
template needsRegLoad(): untyped =
|
||||||
{gfNode, gfNodeAddr} * flags == {} and
|
{gfNode, gfNodeAddr} * flags == {} and
|
||||||
fitsRegister(n.typ.skipTypes({tyVar, tyLent}))
|
fitsRegister(n.typ.skipTypes({tyVar, tyLent, tyStatic}))
|
||||||
|
|
||||||
proc genArrAccess2(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;
|
proc genArrAccess2(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;
|
||||||
flags: TGenFlags) =
|
flags: TGenFlags) =
|
||||||
|
|
@ -1590,7 +1590,7 @@ proc getNullValueAux(obj: PNode, result: PNode; conf: ConfigRef) =
|
||||||
else: globalError(conf, result.info, "cannot create null element for: " & $obj)
|
else: globalError(conf, result.info, "cannot create null element for: " & $obj)
|
||||||
|
|
||||||
proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
|
proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
|
||||||
var t = skipTypes(typ, abstractRange-{tyTypeDesc})
|
var t = skipTypes(typ, abstractRange+{tyStatic}-{tyTypeDesc})
|
||||||
case t.kind
|
case t.kind
|
||||||
of tyBool, tyEnum, tyChar, tyInt..tyInt64:
|
of tyBool, tyEnum, tyChar, tyInt..tyInt64:
|
||||||
result = newNodeIT(nkIntLit, info, t)
|
result = newNodeIT(nkIntLit, info, t)
|
||||||
|
|
@ -1602,7 +1602,7 @@ proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
|
||||||
result = newNodeIT(nkStrLit, info, t)
|
result = newNodeIT(nkStrLit, info, t)
|
||||||
result.strVal = ""
|
result.strVal = ""
|
||||||
of tyVar, tyLent, tyPointer, tyPtr, tyExpr,
|
of tyVar, tyLent, tyPointer, tyPtr, tyExpr,
|
||||||
tyStmt, tyTypeDesc, tyStatic, tyRef, tyNil:
|
tyStmt, tyTypeDesc, tyRef, tyNil:
|
||||||
result = newNodeIT(nkNilLit, info, t)
|
result = newNodeIT(nkNilLit, info, t)
|
||||||
of tyProc:
|
of tyProc:
|
||||||
if t.callConv != ccClosure:
|
if t.callConv != ccClosure:
|
||||||
|
|
|
||||||
10
tests/vm/t9043.nim
Normal file
10
tests/vm/t9043.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
discard """
|
||||||
|
nimout: "(Field0: 2, Field1: 2, Field2: 2, Field3: 2)"
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc foo[N: static[int]](dims: array[N, int])=
|
||||||
|
const N1 = N
|
||||||
|
const N2 = dims.len
|
||||||
|
static: echo (N, dims.len, N1, N2)
|
||||||
|
|
||||||
|
foo([1, 2])
|
||||||
Loading…
Add table
Add a link
Reference in a new issue