diff options
author | Araq <rumpf_a@web.de> | 2013-08-31 16:45:10 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-08-31 16:45:10 +0200 |
commit | 9c6de08db074dfd41ef4671f99086c1b53a8b540 (patch) | |
tree | 37ba4161f74ce7168cfc2cb7758c6c952a44d815 /compiler | |
parent | b40ab4dc9e4b5ee93f29864218af6b8d78fa1cc2 (diff) | |
download | Nim-9c6de08db074dfd41ef4671f99086c1b53a8b540.tar.gz |
fixes #516
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semcall.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 735e6fac8..a29efcd8a 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -207,11 +207,14 @@ proc SearchForBorrowProc(c: PContext, startScope: PScope, fn: PSym): PSym = # New approach: generate fn(x, y, z) where x, y, z have the proper types # and use the overloading resolution mechanism: var call = newNode(nkCall) + var hasDistinct = false call.add(newIdentNode(fn.name, fn.info)) for i in 1.. <fn.typ.n.len: let param = fn.typ.n.sons[i] let t = skipTypes(param.typ, abstractVar-{tyTypeDesc}) + if t.kind == tyDistinct or param.typ.kind == tyDistinct: hasDistinct = true call.add(newNodeIT(nkEmpty, fn.info, t.baseOfDistinct)) - var resolved = semOverloadedCall(c, call, call, {fn.kind}) - if resolved != nil: - result = resolved.sons[0].sym + if hasDistinct: + var resolved = semOverloadedCall(c, call, call, {fn.kind}) + if resolved != nil: + result = resolved.sons[0].sym |