diff options
author | Araq <rumpf_a@web.de> | 2013-04-11 19:24:08 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-04-11 19:24:08 +0200 |
commit | f5db2de696af7e33fdcbcf96f2be577c1e9a52e2 (patch) | |
tree | 6fc02c64cbc51090249025a3f0609c30bf1daf64 /compiler | |
parent | 45185f84dfcb8f4f16734fcd22f91834621c60e7 (diff) | |
download | Nim-f5db2de696af7e33fdcbcf96f2be577c1e9a52e2.tar.gz |
improved error message for #291
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semcall.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 46595c1e7..be41299ad 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -174,7 +174,10 @@ proc explicitGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode = # common case; check the only candidate has the right # number of generic type parameters: if safeLen(s.ast.sons[genericParamsPos]) != n.len-1: - return explicitGenericInstError(n) + let expected = safeLen(s.ast.sons[genericParamsPos]) + LocalError(n.info, errGenerated, "cannot instantiate: " & renderTree(n) & + "; got " & $(n.len-1) & " type(s) but expected " & $expected) + return n result = explicitGenericSym(c, n, s) elif a.kind in {nkClosedSymChoice, nkOpenSymChoice}: # choose the generic proc with the proper number of type parameters. |