summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-01-31 16:23:38 +0100
committerAraq <rumpf_a@web.de>2015-01-31 16:23:38 +0100
commitab5b8f53914c92875d72b278f966092426d57323 (patch)
tree05fd12f5a52d068fa7a9037d89d7fb22cd7a33c6 /compiler
parent43e5e3ac22e359cf0c328e1c36627187c6c80efd (diff)
downloadNim-ab5b8f53914c92875d72b278f966092426d57323.tar.gz
fixes #1988
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sigmatch.nim12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 549f1f9ad..2e37f3bf1 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1300,7 +1300,6 @@ proc paramTypesMatch*(m: var TCandidate, f, a: PType,
     # incorrect to simply use the first fitting match. However, to implement
     # this correctly is inefficient. We have to copy `m` here to be able to
     # roll back the side effects of the unification algorithm.
-
     let c = m.c
     var x, y, z: TCandidate
     initCandidate(c, x, m.callee)
@@ -1329,12 +1328,15 @@ proc paramTypesMatch*(m: var TCandidate, f, a: PType,
               y = z           # z is as good as x
     if x.state == csEmpty: 
       result = nil
-    elif (y.state == csMatch) and (cmpCandidates(x, y) == 0): 
+    elif y.state == csMatch and cmpCandidates(x, y) == 0: 
       if x.state != csMatch: 
         internalError(arg.info, "x.state is not csMatch") 
-      # ambiguous: more than one symbol fits
-      result = nil
-    else: 
+      # ambiguous: more than one symbol fits!
+      # See tsymchoice_for_expr as an example. 'f.kind == tyExpr' should match
+      # anyway:
+      if f.kind == tyExpr: result = arg
+      else: result = nil
+    else:
       # only one valid interpretation found:
       markUsed(arg.info, arg.sons[best].sym)
       styleCheckUse(arg.info, arg.sons[best].sym)