typeToString: type float => typedesc[float] (#17011)

* typeToString: type float => typedesc[float]

* fixup

* fix tests
This commit is contained in:
Timothee Cour
2021-02-12 08:10:20 -08:00
committed by GitHub
parent f57774e1e7
commit e40ff24c23
13 changed files with 21 additions and 18 deletions

View File

@@ -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