Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cooldome committed Dec 4, 2019
1 parent f22d3c7 commit 3eb3fce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/semmagic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ proc evalTypeTrait(c: PContext; traitCall: PNode, operand: PType, context: PSym)
let preferStr = traitCall.sons[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))
Expand Down
5 changes: 5 additions & 0 deletions tests/metatype/ttypedesc2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ proc testObj(typ: typedesc[object]): Y[typ] =
discard

discard testObj(X)


#bug 12804
import typetraits
discard int.name[0]

0 comments on commit 3eb3fce

Please sign in to comment.