summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-02-03 07:57:47 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-02-03 07:57:47 +0100
commit992fd38487afc706d3271beda8189dadfca53592 (patch)
treede7b6f902f500e266a893b569b7022e9d7f506aa
parent212457f5e01d1c52db590da3b9d7f8dd538d9269 (diff)
downloadNim-992fd38487afc706d3271beda8189dadfca53592.tar.gz
make tests green again
-rw-r--r--compiler/sigmatch.nim32
-rw-r--r--tests/macros/tgettypeinst.nim4
2 files changed, 16 insertions, 20 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 1e32cfcf2..123e11c68 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1859,22 +1859,22 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
 
   var r = typeRel(m, f, a)
 
-  when false:
-    # This special typing rule for macros and templates is not documented
-    # anywhere and breaks symmetry.
-    if r != isNone and m.calleeSym != nil and
-      m.calleeSym.kind in {skMacro, skTemplate}:
-      # XXX: duplicating this is ugly, but we cannot (!) move this
-      # directly into typeRel using return-like templates
-      incMatches(m, r)
-      if f.kind == tyStmt:
-        return arg
-      elif f.kind == tyTypeDesc:
-        return arg
-      elif f.kind == tyStatic:
-        return arg.typ.n
-      else:
-        return argSemantized # argOrig
+  # This special typing rule for macros and templates is not documented
+  # anywhere and breaks symmetry. It's hard to get rid of though, my
+  # custom seqs example fails to compile without this:
+  if r != isNone and m.calleeSym != nil and
+    m.calleeSym.kind in {skMacro, skTemplate}:
+    # XXX: duplicating this is ugly, but we cannot (!) move this
+    # directly into typeRel using return-like templates
+    incMatches(m, r)
+    if f.kind == tyStmt:
+      return arg
+    elif f.kind == tyTypeDesc:
+      return arg
+    elif f.kind == tyStatic:
+      return arg.typ.n
+    else:
+      return argSemantized # argOrig
 
   # If r == isBothMetaConvertible then we rerun typeRel.
   # bothMetaCounter is for safety to avoid any infinite loop,
diff --git a/tests/macros/tgettypeinst.nim b/tests/macros/tgettypeinst.nim
index d54b99d77..2f1abe193 100644
--- a/tests/macros/tgettypeinst.nim
+++ b/tests/macros/tgettypeinst.nim
@@ -1,10 +1,6 @@
 discard """
-  disabled: "true"
 """
 
-# disabled: relied on undocumented overloading rules. Too much work
-# to make this sane.
-
 import macros, strUtils
 
 proc symToIdent(x: NimNode): NimNode =