diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-15 19:43:50 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-16 20:42:06 +0200 |
commit | 7dcf6ff50b03dfd54968383ad5a4258f040eec1b (patch) | |
tree | c38557f95adb9d7e6b78744325579ebce08f0487 | |
parent | 27c2c1e75ce9f7bf21dcbbb4625f494a6ac5837e (diff) | |
download | Nim-7dcf6ff50b03dfd54968383ad5a4258f040eec1b.tar.gz |
fix #997
-rw-r--r-- | compiler/sigmatch.nim | 13 | ||||
-rw-r--r-- | tests/metatype/tstaticparams.nim | 9 |
2 files changed, 15 insertions, 7 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 049c9520b..433455365 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -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}) diff --git a/tests/metatype/tstaticparams.nim b/tests/metatype/tstaticparams.nim index fa162f4e8..d14de7d65 100644 --- a/tests/metatype/tstaticparams.nim +++ b/tests/metatype/tstaticparams.nim @@ -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 |