parent
5345c5b130
commit
87f8ec5b92
2 changed files with 24 additions and 1 deletions
|
|
@ -1043,7 +1043,8 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
|
||||||
of skConst:
|
of skConst:
|
||||||
markUsed(c.config, n.info, s, c.graph.usageSym)
|
markUsed(c.config, n.info, s, c.graph.usageSym)
|
||||||
onUse(n.info, s)
|
onUse(n.info, s)
|
||||||
case skipTypes(s.typ, abstractInst-{tyTypeDesc}).kind
|
let typ = skipTypes(s.typ, abstractInst-{tyTypeDesc})
|
||||||
|
case typ.kind
|
||||||
of tyNil, tyChar, tyInt..tyInt64, tyFloat..tyFloat128,
|
of tyNil, tyChar, tyInt..tyInt64, tyFloat..tyFloat128,
|
||||||
tyTuple, tySet, tyUInt..tyUInt64:
|
tyTuple, tySet, tyUInt..tyUInt64:
|
||||||
if s.magic == mNone: result = inlineConst(c, n, s)
|
if s.magic == mNone: result = inlineConst(c, n, s)
|
||||||
|
|
@ -1061,6 +1062,12 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
|
||||||
# deal with two different ``[]``.
|
# deal with two different ``[]``.
|
||||||
if s.ast.len == 0: result = inlineConst(c, n, s)
|
if s.ast.len == 0: result = inlineConst(c, n, s)
|
||||||
else: result = newSymNode(s, n.info)
|
else: result = newSymNode(s, n.info)
|
||||||
|
of tyStatic:
|
||||||
|
if typ.n != nil:
|
||||||
|
result = typ.n
|
||||||
|
result.typ = typ.base
|
||||||
|
else:
|
||||||
|
result = newSymNode(s, n.info)
|
||||||
else:
|
else:
|
||||||
result = newSymNode(s, n.info)
|
result = newSymNode(s, n.info)
|
||||||
of skMacro:
|
of skMacro:
|
||||||
|
|
|
||||||
|
|
@ -116,3 +116,19 @@ block:
|
||||||
Tensor[B: static[Backend]; T] = object
|
Tensor[B: static[Backend]; T] = object
|
||||||
|
|
||||||
BackProp[B: static[Backend],T] = proc (gradient: Tensor[B,T]): Tensor[B,T]
|
BackProp[B: static[Backend],T] = proc (gradient: Tensor[B,T]): Tensor[B,T]
|
||||||
|
|
||||||
|
# https://github.com/nim-lang/Nim/issues/10073
|
||||||
|
block:
|
||||||
|
proc foo[N: static int](x: var int,
|
||||||
|
y: int,
|
||||||
|
z: static int,
|
||||||
|
arr: array[N, int]): auto =
|
||||||
|
var t1 = (a: x, b: y, c: z, d: N)
|
||||||
|
var t2 = (x, y, z, N)
|
||||||
|
doAssert t1 == t2
|
||||||
|
result = t1
|
||||||
|
|
||||||
|
var y = 20
|
||||||
|
var x = foo(y, 10, 15, [1, 2, 3])
|
||||||
|
doAssert x == (20, 10, 15, 3)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue