summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-02-12 08:10:20 -0800
committerGitHub <noreply@github.com>2021-02-12 17:10:20 +0100
commite40ff24c23c9010d66282fa8a3489fe6fa7dc1de (patch)
tree408b61c6ef0c220285d8f055f3d98bc4cafc7b50 /compiler
parentf57774e1e70636ab68e5f2bc0a0cb47f7a8628f5 (diff)
downloadNim-e40ff24c23c9010d66282fa8a3489fe6fa7dc1de.tar.gz
typeToString: type float => typedesc[float] (#17011)
* typeToString: type float => typedesc[float]

* fixup

* fix tests
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index 10ff1d09d..6a7b4dbc9 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -448,6 +448,7 @@ proc rangeToStr(n: PNode): string =
 const
   typeToStr: array[TTypeKind, string] = ["None", "bool", "char", "empty",
     "Alias", "typeof(nil)", "untyped", "typed", "typeDesc",
+    # xxx typeDesc=>typedesc: typedesc is declared as such, and is 10x more common.
     "GenericInvocation", "GenericBody", "GenericInst", "GenericParam",
     "distinct $1", "enum", "ordinal[$1]", "array[$1, $2]", "object", "tuple",
     "set[$1]", "range[$1]", "ptr ", "ref ", "var ", "seq[$1]", "proc",
@@ -550,7 +551,7 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
       result.add(']')
     of tyTypeDesc:
       if t[0].kind == tyNone: result = "typedesc"
-      else: result = "type " & typeToString(t[0])
+      else: result = "typedesc[" & typeToString(t[0]) & "]"
     of tyStatic:
       if prefer == preferGenericArg and t.n != nil:
         result = t.n.renderTree