diff options
author | cooldome <cdome@bk.ru> | 2020-01-07 23:36:57 +0000 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-01-08 00:36:57 +0100 |
commit | 871d5e79b1dc54c1657a1d7f85788e8bd8f4fb28 (patch) | |
tree | 41353387591564db35c1deb7a9619fcf3a3b80d5 /tests/stdlib/tsugar.nim | |
parent | 8bcc7e8b9ea39524bac14f6c89de5213509f4099 (diff) | |
download | Nim-871d5e79b1dc54c1657a1d7f85788e8bd8f4fb28.tar.gz |
distinctBase type trait for distinct types (#13031)
Diffstat (limited to 'tests/stdlib/tsugar.nim')
-rw-r--r-- | tests/stdlib/tsugar.nim | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/stdlib/tsugar.nim b/tests/stdlib/tsugar.nim deleted file mode 100644 index 5006cf52b..000000000 --- a/tests/stdlib/tsugar.nim +++ /dev/null @@ -1,37 +0,0 @@ -discard """ - output: "@[@[], @[], @[], @[], @[]]" -""" -import sugar -import macros - -block distinctBase: - block: - type - Foo[T] = distinct seq[T] - var a: Foo[int] - doAssert a.type.distinctBase is seq[int] - - block: - # simplified from https://github.com/nim-lang/Nim/pull/8531#issuecomment-410436458 - macro uintImpl(bits: static[int]): untyped = - if bits >= 128: - let inner = getAST(uintImpl(bits div 2)) - result = newTree(nnkBracketExpr, ident("UintImpl"), inner) - else: - result = ident("uint64") - - type - BaseUint = UintImpl or SomeUnsignedInt - UintImpl[Baseuint] = object - Uint[bits: static[int]] = distinct uintImpl(bits) - - doAssert Uint[128].distinctBase is UintImpl[uint64] - -# bug #7816 -import sequtils - -proc tester[T](x: T) = - let test = toSeq(0..4).map(i => newSeq[int]()) - echo test - -tester(1) |