diff options
-rw-r--r-- | compiler/semmagic.nim | 4 | ||||
-rw-r--r-- | tests/metatype/ttypedesc2.nim | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 3e5c385e9..307e21ec6 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -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)) diff --git a/tests/metatype/ttypedesc2.nim b/tests/metatype/ttypedesc2.nim index 37399784b..89c38f367 100644 --- a/tests/metatype/ttypedesc2.nim +++ b/tests/metatype/ttypedesc2.nim @@ -72,3 +72,8 @@ proc testObj(typ: typedesc[object]): Y[typ] = discard discard testObj(X) + + +#bug 12804 +import typetraits +discard int.name[0] \ No newline at end of file |