parent
de1a283383
commit
0987872675
2 changed files with 7 additions and 2 deletions
|
|
@ -147,11 +147,11 @@ proc evalTypeTrait(c: PContext; traitCall: PNode, operand: PType, context: PSym)
|
||||||
let preferStr = traitCall[2].strVal
|
let preferStr = traitCall[2].strVal
|
||||||
prefer = parseEnum[TPreferedDesc](preferStr)
|
prefer = parseEnum[TPreferedDesc](preferStr)
|
||||||
result = newStrNode(nkStrLit, operand.typeToString(prefer))
|
result = newStrNode(nkStrLit, operand.typeToString(prefer))
|
||||||
result.typ = newType(tyString, context)
|
result.typ = getSysType(c.graph, traitCall[1].info, tyString)
|
||||||
result.info = traitCall.info
|
result.info = traitCall.info
|
||||||
of "name", "$":
|
of "name", "$":
|
||||||
result = newStrNode(nkStrLit, operand.typeToString(preferTypeName))
|
result = newStrNode(nkStrLit, operand.typeToString(preferTypeName))
|
||||||
result.typ = newType(tyString, context)
|
result.typ = getSysType(c.graph, traitCall[1].info, tyString)
|
||||||
result.info = traitCall.info
|
result.info = traitCall.info
|
||||||
of "arity":
|
of "arity":
|
||||||
result = newIntNode(nkIntLit, operand.len - ord(operand.kind==tyProc))
|
result = newIntNode(nkIntLit, operand.len - ord(operand.kind==tyProc))
|
||||||
|
|
|
||||||
|
|
@ -72,3 +72,8 @@ proc testObj(typ: typedesc[object]): Y[typ] =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
discard testObj(X)
|
discard testObj(X)
|
||||||
|
|
||||||
|
|
||||||
|
#bug 12804
|
||||||
|
import typetraits
|
||||||
|
discard int.name[0]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue