This commit is contained in:
Zahary Karadjov
2014-03-15 19:43:50 +02:00
parent 27c2c1e75c
commit 7dcf6ff50b
2 changed files with 15 additions and 7 deletions

View File

@@ -1046,12 +1046,13 @@ proc paramTypesMatchAux(m: var TCandidate, f, argType: PType,
# put(m.bindings, f, argType)
return argSemantized
var evaluated = c.semTryConstExpr(c, arg)
if evaluated != nil:
arg.typ = newTypeS(tyStatic, c)
arg.typ.sons = @[evaluated.typ]
arg.typ.n = evaluated
argType = arg.typ
if argType.kind != tyStatic:
var evaluated = c.semTryConstExpr(c, arg)
if evaluated != nil:
arg.typ = newTypeS(tyStatic, c)
arg.typ.sons = @[evaluated.typ]
arg.typ.n = evaluated
argType = arg.typ
var
a = if c.inTypeClass > 0: argType.skipTypes({tyTypeDesc, tyFieldAccessor})

View File

@@ -1,6 +1,6 @@
discard """
file: "tstaticparams.nim"
output: "abracadabra\ntest\n3\n15\4"
output: "abracadabra\ntest\n3\n15\n4\n2"
"""
type
@@ -49,3 +49,10 @@ proc getRows(mtx: Matrix): int =
result = mtx.M
echo getRows(m)
# issue 997
type TTest[T: static[int], U: static[int]] = array[0..T*U, int]
type TTestSub[N: static[int]] = TTest[1, N]
var x: TTestSub[2]
echo x.high