typetraits module and tests
This commit is contained in:
parent
a64f03230a
commit
97ab16d46b
2 changed files with 39 additions and 0 deletions
24
tests/run/ttypetraits.nim
Normal file
24
tests/run/ttypetraits.nim
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
discard """
|
||||
msg: "int\nstring\nTBar[int]"
|
||||
output: "int\nstring\nTBar[int]"
|
||||
"""
|
||||
|
||||
import typetraits
|
||||
|
||||
proc foo(x) =
|
||||
static:
|
||||
var t = type(x)
|
||||
echo t.name
|
||||
|
||||
echo x.type.name
|
||||
|
||||
type
|
||||
TBar[U] = object
|
||||
x: U
|
||||
|
||||
var bar: TBar[int]
|
||||
|
||||
foo 10
|
||||
foo "test"
|
||||
foo bar
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue