close #12704 by adding a test (tuple codegen error) (#13592)

* close #12704 by adding a test

* move test to tests/metatype/ttypedesc2.nim
This commit is contained in:
Timothee Cour 2020-03-05 23:55:53 -08:00 • committed by GitHub
commit b80d293a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,9 +35,23 @@ type Point[T] = tuple[x, y: T]
proc origin(T: typedesc): Point[T] = discard proc origin(T: typedesc): Point[T] = discard
discard origin(int) discard origin(int)
block: # issue #12704
const a = $("a", "b")
proc fun() =
const str = $int
let b = $(str, "asdf")
fun()
# https://github.com/nim-lang/Nim/issues/7516 # https://github.com/nim-lang/Nim/issues/7516
import typetraits import typetraits
block: #issue #12704
const a = $("a", "b")
proc fun() =
const str = name(int)
let b = $(str, "asdf")
fun()
proc hasDefault1(T: type = int): auto = return T.name proc hasDefault1(T: type = int): auto = return T.name
doAssert hasDefault1(int) == "int" doAssert hasDefault1(int) == "int"
doAssert hasDefault1(string) == "string" doAssert hasDefault1(string) == "string"