revives: Move typetraits.$ to system. Fixes #5827 (#10071)

* Move typetraits.`$` to system. Fixes #5827.
* revive PR; adjust code to make sure everything works and add tests
* fix tests/concepts/tstackconcept.nim
* address comments
This commit is contained in:
Timothee Cour 2018-12-29 16:09:47 -08:00 • committed by Andreas Rumpf
commit 0831292863
4 changed files with 44 additions and 25 deletions

View file

@ -4431,3 +4431,12 @@ when defined(genode):
componentConstructHook(env)
# Perform application initialization
# and return to thread entrypoint.
proc `$`*(t: typedesc): string {.magic: "TypeTrait".} =
## Returns the name of the given type.
##
## For more procedures dealing with ``typedesc``, see ``typetraits.nim``.
runnableExamples:
doAssert $(type(42)) == "int"
doAssert $(type("Foo")) == "string"
static: doAssert $(type(@['A', 'B'])) == "seq[char]"