diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-06-10 23:19:52 +0300 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-06-20 11:29:42 +0200 |
commit | 6f935598f4d70271cdbf664a7b54435a403bb934 (patch) | |
tree | d1487d01fc7338eb23365384e19cb39ec853aad2 | |
parent | 367d23235182ad9468d1e83e9380d2eea0c134b1 (diff) | |
download | Nim-6f935598f4d70271cdbf664a7b54435a403bb934.tar.gz |
close #3153
-rw-r--r-- | tests/metatype/tstaticparams.nim | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/metatype/tstaticparams.nim b/tests/metatype/tstaticparams.nim index 52a501e39..69b62e4a6 100644 --- a/tests/metatype/tstaticparams.nim +++ b/tests/metatype/tstaticparams.nim @@ -1,6 +1,6 @@ discard """ file: "tstaticparams.nim" - output: "abracadabra\ntest\n3\n15\n4\n2\nfloat\n3\nfloat\nyin\nyang\n2" + output: "abracadabra\ntest\n3\n15\n4\n2\nfloat\n3\nfloat\nyin\nyang\n2\n4\n4\n2\n3" """ type @@ -150,3 +150,26 @@ proc arraySize[N: static[int]](A: array[N, int]): int = var A: array[size, int] = [1, 2] echo arraySize(A) +# https://github.com/nim-lang/Nim/issues/3153 + +proc outSize1[M: static[int], A](xs: array[M, A]): int = M +echo outSize1([1, 2, 3, 4]) + +type + Arr[N: static[int], A] = array[N, A] + +proc outSize2[M: static[int], A](xs: Arr[M, A]): int = M +echo outSize2([1, 2, 3, 4]) # 4 + +echo outSize2([ + [1, 2, 3], + [4, 5, 6] +]) # 2 + +proc inSize[M, N: static[int]](xs: Arr[M, Arr[N, int]]): int = N + +echo inSize([ + [1, 2, 3], + [4, 5, 6] +]) + |