diff options
author | alaviss <leorize+oss@disroot.org> | 2020-06-30 13:25:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 15:25:53 +0200 |
commit | 56b3d422b014b42c6367fa56916cfd9851884506 (patch) | |
tree | bbd32fac6a407c47bea5552a63f3904ad58effe6 /tests | |
parent | 36fa79a5242d2e39a83083cd66cf3af9f8931f3b (diff) | |
download | Nim-56b3d422b014b42c6367fa56916cfd9851884506.tar.gz |
typetraits: features and fixes (#14791)
* typetraits: add support for nnkTypeOfExpr * typetraits: don't wrap typedesc symbols in StaticParam * typetraits: add nested generics support to genericParams * typetraits: make genericParams understand array[I, T] whackiness Also moved tests to ttypetraits * typetraits: clarify comment on genericParams
Diffstat (limited to 'tests')
-rw-r--r-- | tests/metatype/ttypetraits.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/metatype/ttypetraits.nim b/tests/metatype/ttypetraits.nim index b69ca4c60..ca918266f 100644 --- a/tests/metatype/ttypetraits.nim +++ b/tests/metatype/ttypetraits.nim @@ -221,6 +221,23 @@ block genericParams: doAssert genericParams(Bar4) is (StaticParam[5.0], string) doAssert genericParams(Bar[F, string]) is (StaticParam[5.0], string) + block typeof: + var + a: seq[int] + b: array[42, float] + c: array[char, int] + d: array[1..2, char] + + doAssert genericParams(typeof(a)).get(0) is int + doAssert genericParams(typeof(b)) is (range[0..41], float) + doAssert genericParams(typeof(c)) is (char, int) + doAssert genericParams(typeof(d)) is (range[1..2], char) + + block nestedContainers: + doAssert genericParams(seq[Foo[string, float]]).get(0) is Foo[string, float] + doAssert genericParams(array[10, Foo[Bar[1, int], Bar[2, float]]]) is (StaticParam[10], Foo[Bar[1, int], Bar[2, float]]) + doAssert genericParams(array[1..9, int]) is (range[1..9], int) + ############################################## # bug 13095 |