import typetraits
type
C[T] = object
type MyInt = int
type C2=C
when defined(case1):
echo C2[int] # C2[system.int]
echo C2[MyInt] # C2[system.int]
when defined(case2):
echo C2[MyInt] # C2[t01_resolveTypeName2.MyInt]
echo C2[int] # C2[t01_resolveTypeName2.MyInt]
# EDIT: using `name` instead of `$` doesn't make a difference, unlike test case for related issue https://github.com/nim-lang/Nim/issues/7976#issuecomment-395246665
when defined(case3):
echo C2[MyInt].name #C2[t01_resolveTypeName2.MyInt]
echo C2[int].name #C2[t01_resolveTypeName2.MyInt]
when defined(case4):
echo C2[int].name #C2[system.int]
echo C2[MyInt].name #C2[system.int]
NOTE: related to, but probably not identical, to #8570, see note there