summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-02-25 08:18:54 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-02-25 08:18:54 +0100
commit4306efada44795f19462714f15cd215a6e8d7ca3 (patch)
treec2e5750a53743c37e3bb718e91a3364fb3b071f1
parentb935eeb997f8474b580f7491f8e26ecd5610cd93 (diff)
parentfa98edc78cf990f2437288af87a9180847f94ed4 (diff)
downloadNim-4306efada44795f19462714f15cd215a6e8d7ca3.tar.gz
Merge branch 'faster-nimsuggest' of github.com:nim-lang/Nim into faster-nimsuggest
-rw-r--r--compiler/cgmeth.nim12
-rw-r--r--tests/method/tautonotgeneric.nim (renamed from tests/metatype/tautonotgeneric.nim)0
-rw-r--r--tools/nimsuggest/nimsuggest.nim2
3 files changed, 11 insertions, 3 deletions
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim
index 3a945ae0a..1d7f5a6e1 100644
--- a/compiler/cgmeth.nim
+++ b/compiler/cgmeth.nim
@@ -60,8 +60,8 @@ type
 proc sameMethodBucket(a, b: PSym): MethodResult =
   if a.name.id != b.name.id: return
   if sonsLen(a.typ) != sonsLen(b.typ):
-    return                    # check for return type:
-  if not sameTypeOrNil(a.typ.sons[0], b.typ.sons[0]): return
+    return
+
   for i in countup(1, sonsLen(a.typ) - 1):
     var aa = a.typ.sons[i]
     var bb = b.typ.sons[i]
@@ -89,6 +89,14 @@ proc sameMethodBucket(a, b: PSym): MethodResult =
         return No
     else:
       return No
+  if result == Yes:
+    # check for return type:
+    if not sameTypeOrNil(a.typ.sons[0], b.typ.sons[0]):
+      if b.typ.sons[0] != nil and b.typ.sons[0].kind == tyExpr:
+        # infer 'auto' from the base to make it consistent:
+        b.typ.sons[0] = a.typ.sons[0]
+      else:
+        return No
 
 proc attachDispatcher(s: PSym, dispatcher: PNode) =
   var L = s.ast.len-1
diff --git a/tests/metatype/tautonotgeneric.nim b/tests/method/tautonotgeneric.nim
index f0d6932f9..f0d6932f9 100644
--- a/tests/metatype/tautonotgeneric.nim
+++ b/tests/method/tautonotgeneric.nim
diff --git a/tools/nimsuggest/nimsuggest.nim b/tools/nimsuggest/nimsuggest.nim
index 57d343ae4..137ac4219 100644
--- a/tools/nimsuggest/nimsuggest.nim
+++ b/tools/nimsuggest/nimsuggest.nim
@@ -423,7 +423,7 @@ proc recompileFullProject(graph: ModuleGraph; cache: IdentCache) =
   graph.resetAllModules()
   GC_fullcollect()
   compileProject(graph, cache)
-  echo "recompiled!"
+  echo GC_getStatistics()
 
 proc mainThread(graph: ModuleGraph; cache: IdentCache) =
   if gLogging: