summary refs log tree commit diff stats
path: root/compiler/sigmatch.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-07-19 19:27:38 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-07-19 19:27:38 +0200
commitdc4b2c920c9659bcd5691cd1e88140df3dc06330 (patch)
tree1e73de90b6200d6aec3bfa49e62b4f3a83645971 /compiler/sigmatch.nim
parentd455d58af6c511414f59eff2fffd64379dd4deac (diff)
downloadNim-dc4b2c920c9659bcd5691cd1e88140df3dc06330.tar.gz
fixes #4328
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r--compiler/sigmatch.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 4a5132d6d..22915a4bb 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1777,7 +1777,10 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) =
           break
       else:
         # use default value:
-        setSon(m.call, formal.position + 1, copyTree(formal.ast))
+        var def = copyTree(formal.ast)
+        if def.kind == nkNilLit:
+          def = implicitConv(nkHiddenStdConv, formal.typ, def, m, c)
+        setSon(m.call, formal.position + 1, def)
     inc(f)
 
 proc argtypeMatches*(c: PContext, f, a: PType): bool =