This commit is contained in:
cooldome
2019-12-05 06:38:12 +00:00
committed by Andreas Rumpf
parent de1a283383
commit 0987872675
2 changed files with 7 additions and 2 deletions

View File

@@ -147,11 +147,11 @@ proc evalTypeTrait(c: PContext; traitCall: PNode, operand: PType, context: PSym)
let preferStr = traitCall[2].strVal
prefer = parseEnum[TPreferedDesc](preferStr)
result = newStrNode(nkStrLit, operand.typeToString(prefer))
result.typ = newType(tyString, context)
result.typ = getSysType(c.graph, traitCall[1].info, tyString)
result.info = traitCall.info
of "name", "$":
result = newStrNode(nkStrLit, operand.typeToString(preferTypeName))
result.typ = newType(tyString, context)
result.typ = getSysType(c.graph, traitCall[1].info, tyString)
result.info = traitCall.info
of "arity":
result = newIntNode(nkIntLit, operand.len - ord(operand.kind==tyProc))

View File

@@ -72,3 +72,8 @@ proc testObj(typ: typedesc[object]): Y[typ] =
discard
discard testObj(X)
#bug 12804
import typetraits
discard int.name[0]