summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2019-02-13 14:07:58 +0700
committerAndreas Rumpf <rumpf_a@web.de>2019-02-13 08:07:58 +0100
commit3520253a09cb8f32df834e619c7435092a370e9d (patch)
tree6e7d39ecb0b4fa1a88028b9235fc25a45e61f6ed /compiler
parentb6c22eae6a73438ca9bf48281090ce0958475e06 (diff)
downloadNim-3520253a09cb8f32df834e619c7435092a370e9d.tar.gz
compiler/types: correctly generates signature for non-proc types (#10658)
This makes signatures generated for nimsuggest correctly distinguish
template/macro/converter from proc.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index 23902459e..7034917d4 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -588,7 +588,15 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
     if prefer != preferExported:
       result.add("(" & typeToString(t.sons[0]) & ")")
   of tyProc:
-    result = if tfIterator in t.flags: "iterator " else: "proc "
+    result = if tfIterator in t.flags: "iterator "
+             elif t.owner != nil:
+               case t.owner.kind
+               of skTemplate: "template "
+               of skMacro: "macro "
+               of skConverter: "converter "
+               else: "proc "
+            else:
+              "proc "
     if tfUnresolved in t.flags: result.add "[*missing parameters*]"
     result.add "("
     for i in countup(1, sonsLen(t) - 1):